| 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=/u/gcmpack | 
| 8 |  | #- to allow users to use cvs update/diff on their untar version of the code, | 
| 9 |  | #  switch to pserver method (stored everywhere in the tree in dirs CVS/Root) | 
| 10 |  | export CVSROOT=':pserver:cvsanon@mitgcm.org:/u/gcmpack' | 
| 11 |  |  | 
| 12 | umask 0002 | umask 0002 | 
| 13 |  |  | 
| 14 | echo 'Changing dir. to /u/httpd/html/download/daily_snapshot' | echo 'Changing dir. to /u/u0/httpd/html/download/daily_snapshot' | 
| 15 | cd /u/httpd/html/download/daily_snapshot | cd /u/u0/httpd/html/download/daily_snapshot | 
| 16 | outp=$? | outp=$? | 
| 17 | if test $outp != 0 ; then | if test $outp != 0 ; then | 
| 18 | echo " Error in cd : $outp" | echo " Error in cd : $outp" | 
| 19 | exit | exit 1 | 
| 20 | fi | fi | 
| 21 | test -e MITgcm  &&  rm -rf MITgcm | test -e MITgcm  &&  rm -rf MITgcm | 
| 22 |  |  | 
| 23 | echo 'Checking out MITgcm...' | echo -n 'Checking out MITgcm ... ' | 
| 24 | cvs co -P MITgcm > /dev/null 2>&1 | cvs -q co -P MITgcm > /dev/null | 
| 25 |  | outp=$? | 
| 26 |  | if test $outp = 0 ; then | 
| 27 |  | echo 'Done!' | 
| 28 |  | else | 
| 29 |  | echo " Error in cvs checkout: $outp" | 
| 30 |  | exit 2 | 
| 31 |  | fi | 
| 32 | #chgrp gcmpack MITgcm | #chgrp gcmpack MITgcm | 
| 33 | #chmod 775 MITgcm | #chmod 775 MITgcm | 
| 34 |  |  | 
| 35 | echo 'Creating the tar file...' | rm -f MITgcm_ss_* | 
|  | rm -rf MITgcm_ss_* |  | 
| 36 | tname='MITgcm_ss_'`date +%Y%m%d`'.tar.gz' | tname='MITgcm_ss_'`date +%Y%m%d`'.tar.gz' | 
| 37 |  |  | 
| 38 |  | echo -n 'Creating the tar file ... ' | 
| 39 | tar -czf $tname ./MITgcm | tar -czf $tname ./MITgcm | 
| 40 |  | #- should check if successful, it not -> exit 3 | 
| 41 |  | echo 'Done!' | 
| 42 |  |  | 
| 43 | #chmod 664 $tname | #chmod 664 $tname | 
| 44 | ls -l $tname | ls -l $tname | 
| 45 |  |  | 
|  | echo 'Done!' |  | 
|  |  |  | 
| 46 | #-- test for new checkpoint | #-- test for new checkpoint | 
| 47 | cd .. | cd .. | 
| 48 | version_file="daily_snapshot/MITgcm/doc/tag-index" | version_file="daily_snapshot/MITgcm/doc/tag-index" | 
| 49 | backupDir="other_checkpoints" | backupDir="other_checkpoints" | 
| 50 | if test -f $version_file ; then | if test -f $version_file ; then | 
| 51 | thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` | thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` | 
| 52 | short=`echo $thischkpt | sed 's/checkpoint/c/'` | short=`echo $thischkpt | sed 's/checkpoint/c/'` | 
| 56 | else | else | 
| 57 | echo -n "Checking out $thischkpt ..." | echo -n "Checking out $thischkpt ..." | 
| 58 | rm -f checkout.out checkout.err | rm -f checkout.out checkout.err | 
| 59 | cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err | cvs -q co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err | 
| 60 | outp=$? | outp=$? | 
| 61 | if test $outp != 0 ; then | if test $outp != 0 ; then | 
| 62 | echo " Error in cvs checkout: $outp" | echo " Error in cvs checkout: $outp" | 
| 63 | cat checkout.err | cat checkout.err | 
| 64 | exit | exit 4 | 
| 65 | fi | fi | 
| 66 | echo -n " ; making tar file ... " | echo -n " ; making tar file ... " | 
| 67 | rm -f checkout.out checkout.err | rm -f checkout.out checkout.err | 
| 69 | outp=$? | outp=$? | 
| 70 | if test $outp != 0 ; then | if test $outp != 0 ; then | 
| 71 | echo " Error in tar command: $outp" | echo " Error in tar command: $outp" | 
| 72 | exit | exit 5 | 
| 73 | else | else | 
| 74 | echo " Done" | echo " Done" | 
| 75 | rm -r -f $chkptar | rm -r -f $chkptar | 
| 82 | for xx in $listTar ; do | for xx in $listTar ; do | 
| 83 | if test $xx != $chkptar.tar.gz ; then | if test $xx != $chkptar.tar.gz ; then | 
| 84 | if test -f other_checkpoints/$xx ; then | if test -f other_checkpoints/$xx ; then | 
| 85 | echo "error: $backupDir/$xx already exist" | echo "error: $backupDir/$xx already exist" | 
| 86 | else | else | 
| 87 | echo " mv $xx $backupDir" | echo " mv $xx $backupDir" | 
| 88 | mv $xx $backupDir | mv $xx $backupDir | 
| 91 | done | done | 
| 92 | else | else | 
| 93 | echo " no dir: $backupDir" | echo " no dir: $backupDir" | 
| 94 | exit | exit 6 | 
| 95 | fi | fi | 
| 96 | fi | fi | 
| 97 | fi | fi | 
|  |  |  |