| 34 |
# chgrp gcmpack $git_code |
# chgrp gcmpack $git_code |
| 35 |
chmod 775 $git_code |
chmod 775 $git_code |
| 36 |
|
|
|
rm -rf MITgcm_ss_* |
|
| 37 |
arName='MITgcm_ss_'`date +%Y%m%d`'.tar' |
arName='MITgcm_ss_'`date +%Y%m%d`'.tar' |
| 38 |
|
fixName=MITgcm_today_snapshot.tar.gz |
| 39 |
|
rm -rf MITgcm_ss_* $fixName |
| 40 |
|
|
| 41 |
echo -n 'Creating the archive file ... ' |
echo -n 'Creating the archive file ... ' |
| 42 |
( cd $git_code ; git archive --prefix MITgcm/ -o ../$arName master ) |
( cd $git_code ; git archive --prefix MITgcm/ -o ../$arName master ) |
| 43 |
gzip -9 $arName |
gzip -9 $arName |
| 44 |
#- should check if successful, it not -> exit 3 |
#- should check if successful, it not -> exit 3 |
| 45 |
echo 'Done!' |
if test -e ${arName}.gz ; then |
| 46 |
|
echo 'Done!' |
| 47 |
#chmod 664 ${arName}.gz |
#chmod 664 ${arName}.gz |
| 48 |
ls -l ${arName}* |
ls -l ${arName}* | tee -a $HOME/testing/logs/tar_file_list |
| 49 |
|
#- make a link to a fixed name: |
| 50 |
|
ln -s ${arName}.gz $fixName |
| 51 |
|
ls -l $fixName |
| 52 |
|
else |
| 53 |
|
echo 'Fail: no gzip archive file!' |
| 54 |
|
ls -l ${arName}* |
| 55 |
|
exit 3 |
| 56 |
|
fi |
| 57 |
|
|
| 58 |
#exit |
#exit |
| 59 |
backupDir="other_checkpoints" |
backupDir="other_checkpoints" |
| 83 |
ls -l ${savRepo}* |
ls -l ${savRepo}* |
| 84 |
|
|
| 85 |
#-- test for new checkpoint |
#-- test for new checkpoint |
| 86 |
version_file="$git_code/doc/tag-index" |
version_file="$git_code/doc/tag-index" |
| 87 |
|
#version_file="$git_code/.git/config" |
| 88 |
if test -f $version_file ; then |
if test -f $version_file ; then |
| 89 |
thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` |
thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file` |
| 90 |
|
#- better way to get latest tag ( but only works with git version 2 ) |
| 91 |
|
#thischkpt=`(cd $git_code ; git tag -l --sort=-authordate | head -n 1 )` |
| 92 |
short=`echo $thischkpt | sed 's/checkpoint/c/'` |
short=`echo $thischkpt | sed 's/checkpoint/c/'` |
| 93 |
chkptar="MITgcm_$short" |
chkptar="MITgcm_${short}.tar" |
| 94 |
if test -f ../$chkptar.tar.gz ; then |
if test -f ../$chkptar.gz ; then |
| 95 |
echo "tar file ($chkptar) exist for current tag: $thischkpt" |
echo "tar file ($chkptar) exist for current tag: $thischkpt" |
| 96 |
else |
else |
| 97 |
echo -n " ; checkpoint archive file ... " |
echo -n 'Creating the checkpoint archive file ... ' |
| 98 |
( cd $git_code ; git archive --prefix MITgcm/ -o ../$chkptar $thischkpt ) |
( cd $git_code ; git archive --prefix MITgcm/ -o ../$chkptar $thischkpt ) |
| 99 |
outp=$? |
outp=$? |
| 100 |
if test $outp != 0 ; then |
if test $outp != 0 ; then |
| 103 |
else |
else |
| 104 |
echo " Done" |
echo " Done" |
| 105 |
fi |
fi |
| 106 |
gzip $chkptar.tar |
gzip -9 $chkptar |
| 107 |
ls -l $chkptar.tar* |
ls -l ${chkptar}* |
| 108 |
mv $chkptar.tar.gz .. |
mv $chkptar.gz .. |
| 109 |
#-- move previous tar file to backupDir |
#-- move previous tar file to backupDir |
| 110 |
cd .. |
cd .. |
| 111 |
listTar=`ls MITgcm_c*.tar.gz` |
listTar=`ls MITgcm_c*.tar.gz` |
| 112 |
for xx in $listTar ; do |
for xx in $listTar ; do |
| 113 |
if test $xx != $chkptar.tar.gz ; then |
if test $xx != $chkptar.gz ; then |
| 114 |
if test -f other_checkpoints/$xx ; then |
if test -f other_checkpoints/$xx ; then |
| 115 |
echo "error: $backupDir/$xx already exist" |
echo "error: $backupDir/$xx already exist" |
| 116 |
else |
else |