/[MITgcm]/mitgcm.org/scripts/daily_tarfile
ViewVC logotype

Annotation of /mitgcm.org/scripts/daily_tarfile

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (hide annotations) (download)
Fri Jul 10 00:27:16 2009 UTC (15 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.1: +59 -1 lines
create a new source-code tar-file after a new tag (checkpoint) is made.

1 jmc 1.1 #! /usr/bin/env bash
2    
3 jmc 1.2 # $Header: /u/gcmpack/mitgcm.org/scripts/daily_tarfile,v 1.1 2008/09/06 19:48:45 jmc Exp $
4 jmc 1.1
5     # download the source code and make a tar file
6    
7     export CVSROOT=/u/gcmpack
8    
9     umask 0002
10    
11     echo 'Changing dir. to /u/httpd/html/download/daily_snapshot'
12     cd /u/httpd/html/download/daily_snapshot
13 jmc 1.2 outp=$?
14     if test $outp != 0 ; then
15     echo " Error in cd : $outp"
16     exit
17     fi
18 jmc 1.1 test -e MITgcm && rm -rf MITgcm
19    
20     echo 'Checking out MITgcm...'
21     cvs co -P MITgcm > /dev/null 2>&1
22     #chgrp gcmpack MITgcm
23     #chmod 775 MITgcm
24    
25     echo 'Creating the tar file...'
26     rm -rf MITgcm_ss_*
27     tname='MITgcm_ss_'`date +%Y%m%d`'.tar.gz'
28     tar -czf $tname ./MITgcm
29     #chmod 664 $tname
30     ls -l $tname
31    
32     echo 'Done!'
33    
34 jmc 1.2 #-- 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=`grep '^checkpoint' $version_file | head -1`
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    

  ViewVC Help
Powered by ViewVC 1.1.22