| 4 |  |  | 
| 5 | # download the source code and make a tar file | # download the source code and make a tar file | 
| 6 |  |  | 
| 7 | export CVSROOT=/u/gcmpack | export CVSROOT=':pserver:cvsanon@mitgcm.org:/u/gcmpack' | 
| 8 |  |  | 
| 9 | umask 0002 | umask 0002 | 
| 10 |  |  | 
| 11 | echo 'Changing dir. to /u/httpd/html/download/daily_snapshot' | echo 'Changing dir. to /u/httpd/html/download/daily_snapshot' | 
| 12 | cd /u/httpd/html/download/daily_snapshot | cd /u/httpd/html/download/daily_snapshot | 
| 13 |  | outp=$? | 
| 14 |  | if test $outp != 0 ; then | 
| 15 |  | echo " Error in cd : $outp" | 
| 16 |  | exit | 
| 17 |  | fi | 
| 18 | test -e MITgcm  &&  rm -rf MITgcm | test -e MITgcm  &&  rm -rf MITgcm | 
| 19 |  |  | 
| 20 | echo 'Checking out MITgcm...' | echo 'Checking out MITgcm...' | 
| 21 | cvs co -P MITgcm > /dev/null 2>&1 | cvs co -P MITgcm > /dev/null | 
| 22 | #chgrp gcmpack MITgcm | #chgrp gcmpack MITgcm | 
| 23 | #chmod 775 MITgcm | #chmod 775 MITgcm | 
| 24 |  |  | 
| 31 |  |  | 
| 32 | echo 'Done!' | echo 'Done!' | 
| 33 |  |  | 
| 34 |  | #-- test for new checkpoint | 
| 35 |  | cd .. | 
| 36 |  | version_file="daily_snapshot/MITgcm/doc/tag-index" | 
| 37 |  | backupDir="other_checkpoints" | 
| 38 |  | if test -f $version_file ; then | 
| 39 |  | thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` | 
| 40 |  | short=`echo $thischkpt | sed 's/checkpoint/c/'` | 
| 41 |  | chkptar="MITgcm_$short" | 
| 42 |  | if test -f $chkptar.tar.gz ; then | 
| 43 |  | echo "tar file ($chkptar) exist for current tag: $thischkpt" | 
| 44 |  | else | 
| 45 |  | echo -n "Checking out $thischkpt ..." | 
| 46 |  | rm -f checkout.out checkout.err | 
| 47 |  | cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err | 
| 48 |  | outp=$? | 
| 49 |  | if test $outp != 0 ; then | 
| 50 |  | echo " Error in cvs checkout: $outp" | 
| 51 |  | cat checkout.err | 
| 52 |  | exit | 
| 53 |  | fi | 
| 54 |  | echo -n " ; making tar file ... " | 
| 55 |  | rm -f checkout.out checkout.err | 
| 56 |  | tar -cf $chkptar.tar $chkptar | 
| 57 |  | outp=$? | 
| 58 |  | if test $outp != 0 ; then | 
| 59 |  | echo " Error in tar command: $outp" | 
| 60 |  | exit | 
| 61 |  | else | 
| 62 |  | echo " Done" | 
| 63 |  | rm -r -f $chkptar | 
| 64 |  | fi | 
| 65 |  | gzip $chkptar.tar | 
| 66 |  | ls -l $chkptar.tar* | 
| 67 |  | #-- move previous tar file to backupDir | 
| 68 |  | listTar=`ls MITgcm_c*.tar.gz` | 
| 69 |  | if test -d $backupDir ; then | 
| 70 |  | for xx in $listTar ; do | 
| 71 |  | if test $xx != $chkptar.tar.gz ; then | 
| 72 |  | if test -f other_checkpoints/$xx ; then | 
| 73 |  | echo "error: $backupDir/$xx already exist" | 
| 74 |  | else | 
| 75 |  | echo " mv $xx $backupDir" | 
| 76 |  | mv $xx $backupDir | 
| 77 |  | fi | 
| 78 |  | fi | 
| 79 |  | done | 
| 80 |  | else | 
| 81 |  | echo " no dir: $backupDir" | 
| 82 |  | exit | 
| 83 |  | fi | 
| 84 |  | fi | 
| 85 |  | fi | 
| 86 |  |  |