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

Contents of /mitgcm.org/scripts/mk_git_tarfile

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


Revision 1.2 - (show annotations) (download)
Mon Jul 31 20:22:37 2017 UTC (6 years, 9 months ago) by jmc
Branch: MAIN
Changes since 1.1: +2 -2 lines
fix missing space

1 #! /usr/bin/env bash
2
3 # $Header: /u/gcmpack/mitgcm.org/scripts/mk_git_tarfile,v 1.1 2017/07/31 20:19:08 jmc Exp $
4
5 # download the source code from github and make a tar file
6 repo='altMITgcm'
7 code='MITgcm66h'
8
9 umask 0002
10
11 echo 'Changing dir. to /u/httpd/html/download/git_snapshot'
12 cd /u/httpd/html/download/git_snapshot
13 outp=$?
14 if test $outp != 0 ; then
15 echo " Error in cd : $outp"
16 exit
17 fi
18 test -e $code && rm -rf $code
19
20 echo "Make a clone of $code from repo: $repo ..."
21 git clone --depth 1 https://github.com/$repo/$code.git
22 # chgrp gcmpack $code
23 # chmod 775 $code
24
25 echo 'Creating the archive file...'
26 rm -rf MITgcm_ss_*
27 arName='MITgcm_ss_'`date +%Y%m%d`'.tar'
28 ( cd $code ; git archive -o ../$arName master )
29 gzip -9 $arName
30 #chmod 664 ${arName}.gz
31 ls -l ${arName}*
32
33 echo 'Done!'
34 exit
35
36 #-- test for new checkpoint
37 cd ..
38 version_file="daily_snapshot/MITgcm/doc/tag-index"
39 backupDir="other_checkpoints"
40 if test -f $version_file ; then
41 thischkpt=`awk '/^checkpoint/{print $1; exit}' $version_file`
42 short=`echo $thischkpt | sed 's/checkpoint/c/'`
43 chkptar="MITgcm_$short"
44 if test -f $chkptar.tar.gz ; then
45 echo "tar file ($chkptar) exist for current tag: $thischkpt"
46 else
47 echo -n "Checking out $thischkpt ..."
48 rm -f checkout.out checkout.err
49 cvs co -P -d $chkptar -r $thischkpt MITgcm 1> checkout.out 2> checkout.err
50 outp=$?
51 if test $outp != 0 ; then
52 echo " Error in cvs checkout: $outp"
53 cat checkout.err
54 exit
55 fi
56 echo -n " ; making tar file ... "
57 rm -f checkout.out checkout.err
58 tar -cf $chkptar.tar $chkptar
59 outp=$?
60 if test $outp != 0 ; then
61 echo " Error in tar command: $outp"
62 exit
63 else
64 echo " Done"
65 rm -r -f $chkptar
66 fi
67 gzip $chkptar.tar
68 ls -l $chkptar.tar*
69 #-- move previous tar file to backupDir
70 listTar=`ls MITgcm_c*.tar.gz`
71 if test -d $backupDir ; then
72 for xx in $listTar ; do
73 if test $xx != $chkptar.tar.gz ; then
74 if test -f other_checkpoints/$xx ; then
75 echo "error: $backupDir/$xx already exist"
76 else
77 echo " mv $xx $backupDir"
78 mv $xx $backupDir
79 fi
80 fi
81 done
82 else
83 echo " no dir: $backupDir"
84 exit
85 fi
86 fi
87 fi

  ViewVC Help
Powered by ViewVC 1.1.22