/[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.5 - (show annotations) (download)
Wed Jan 24 21:19:30 2018 UTC (6 years, 4 months ago) by jmc
Branch: MAIN
Changes since 1.4: +2 -2 lines
use prefix "MITgcm/" for the git archive command

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

  ViewVC Help
Powered by ViewVC 1.1.22