5 |
# download the source code from github and make a tar file |
# download the source code from github and make a tar file |
6 |
repo='altMITgcm' |
repo='altMITgcm' |
7 |
code='MITgcm' |
code='MITgcm' |
8 |
|
tmpFil="/tmp/"`basename $0`".$$" |
9 |
|
|
10 |
umask 0002 |
umask 0002 |
11 |
|
|
12 |
echo 'Changing dir. to /u/httpd/html/download/git_snapshot' |
echo 'Changing dir. to /u/u0/httpd/html/download/git_snapshot' |
13 |
cd /u/httpd/html/download/git_snapshot |
cd /u/u0/httpd/html/download/git_snapshot |
14 |
outp=$? |
outp=$? |
15 |
if test $outp != 0 ; then |
if test $outp != 0 ; then |
16 |
echo " Error in cd : $outp" |
echo " Error in cd : $outp" |
17 |
exit |
exit 1 |
18 |
fi |
fi |
19 |
test -e $code && rm -rf $code |
test -e $code && rm -rf $code |
20 |
|
|
21 |
echo "Make a clone of $code from repo: $repo ..." |
echo "Make a clone of $code from repo: $repo ..." |
22 |
git clone --depth 1 https://github.com/$repo/$code.git |
git clone --depth 1 https://github.com/$repo/$code.git 2> $tmpFil |
23 |
|
outp=$? |
24 |
|
if test $outp = 0 ; then |
25 |
|
echo ' --> done!' |
26 |
|
rm -f $tmpFil |
27 |
|
else |
28 |
|
echo " Error: 'git clone' returned: $outp" |
29 |
|
cat $tmpFil |
30 |
|
rm -f $tmpFil |
31 |
|
exit 2 |
32 |
|
fi |
33 |
# chgrp gcmpack $code |
# chgrp gcmpack $code |
34 |
# chmod 775 $code |
chmod 775 $code |
35 |
|
|
|
echo 'Creating the archive file...' |
|
36 |
rm -rf MITgcm_ss_* |
rm -rf MITgcm_ss_* |
37 |
arName='MITgcm_ss_'`date +%Y%m%d`'.tar' |
arName='MITgcm_ss_'`date +%Y%m%d`'.tar' |
38 |
|
|
39 |
|
echo -n 'Creating the archive file ... ' |
40 |
( cd $code ; git archive -o ../$arName master ) |
( cd $code ; git archive -o ../$arName master ) |
41 |
gzip -9 $arName |
gzip -9 $arName |
42 |
|
#- should check if successful, it not -> exit 3 |
43 |
|
echo 'Done!' |
44 |
|
|
45 |
#chmod 664 ${arName}.gz |
#chmod 664 ${arName}.gz |
46 |
ls -l ${arName}* |
ls -l ${arName}* |
47 |
|
|
|
echo 'Done!' |
|
48 |
exit |
exit |
49 |
|
|
50 |
#-- test for new checkpoint |
#-- test for new checkpoint |
51 |
cd .. |
cd .. |
52 |
version_file="daily_snapshot/MITgcm/doc/tag-index" |
version_file="git_snapshot/$code/doc/tag-index" |
53 |
backupDir="other_checkpoints" |
backupDir="other_checkpoints" |
54 |
if test -f $version_file ; then |
if test -f $version_file ; then |
55 |
thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` |
thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` |
58 |
if test -f $chkptar.tar.gz ; then |
if test -f $chkptar.tar.gz ; then |
59 |
echo "tar file ($chkptar) exist for current tag: $thischkpt" |
echo "tar file ($chkptar) exist for current tag: $thischkpt" |
60 |
else |
else |
61 |
echo -n "Checking out $thischkpt ..." |
# echo -n "Checking out $thischkpt ..." |
62 |
rm -f checkout.out checkout.err |
# rm -f checkout.out checkout.err |
63 |
cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err |
# cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err |
64 |
outp=$? |
outp=$? |
65 |
if test $outp != 0 ; then |
if test $outp != 0 ; then |
66 |
echo " Error in cvs checkout: $outp" |
echo " Error in cvs checkout: $outp" |
67 |
cat checkout.err |
cat checkout.err |
68 |
exit |
exit 4 |
69 |
fi |
fi |
70 |
echo -n " ; making tar file ... " |
echo -n " ; making tar file ... " |
71 |
rm -f checkout.out checkout.err |
rm -f checkout.out checkout.err |
73 |
outp=$? |
outp=$? |
74 |
if test $outp != 0 ; then |
if test $outp != 0 ; then |
75 |
echo " Error in tar command: $outp" |
echo " Error in tar command: $outp" |
76 |
exit |
exit 5 |
77 |
else |
else |
78 |
echo " Done" |
echo " Done" |
79 |
rm -r -f $chkptar |
rm -r -f $chkptar |
95 |
done |
done |
96 |
else |
else |
97 |
echo " no dir: $backupDir" |
echo " no dir: $backupDir" |
98 |
exit |
exit 6 |
99 |
fi |
fi |
100 |
fi |
fi |
101 |
fi |
fi |
|
|
|