diff options
-rwxr-xr-x | tools/sfsnapshot | 92 |
1 files changed, 58 insertions, 34 deletions
diff --git a/tools/sfsnapshot b/tools/sfsnapshot index 47421af..5cbdfb4 100755 --- a/tools/sfsnapshot +++ b/tools/sfsnapshot | |||
@@ -2,55 +2,79 @@ | |||
2 | 2 | ||
3 | # Butchered version of snapshot | 3 | # Butchered version of snapshot |
4 | # Can only run on the shell compile farm server | 4 | # Can only run on the shell compile farm server |
5 | # Will always create a snapshot of HEAD | ||
6 | # If want multiple snapshots, just run with "sfsnapshot {branch} [branch2 ...]" | ||
5 | # Assumes: | 7 | # Assumes: |
6 | # ssh setup to send to shell.sf.net and $CF without password prompt | 8 | # ssh setup to send to shell.sf.net and $CF without password prompt |
7 | # autconf and automake installed on shell cf at v 2.57 & 1.72 and in PATH | 9 | # autconf and automake installed on shell cf at v 2.57 & 1.72 and in PATH |
8 | 10 | ||
9 | function die { echo $1; exit 1; } | 11 | function die { echo $1; exit 1; } |
10 | 12 | ||
13 | # This makes the distribution. Expects $1 as CVS tag, otherwise uses HEAD | ||
14 | function make_dist { | ||
15 | if [[ -n $1 ]] ; then | ||
16 | cvs_rel=$1 | ||
17 | v="$1-" | ||
18 | else | ||
19 | cvs_rel="HEAD" | ||
20 | v="" | ||
21 | fi | ||
22 | |||
23 | # Get compile server to do the work | ||
24 | # Variables will be expanded locally before being run on $CF | ||
25 | ssh $CF <<-EOF | ||
26 | set -x | ||
27 | PATH=$PATH | ||
28 | [[ ! -d $IN/$cvs_rel ]] && mkdir -p $IN/$cvs_rel | ||
29 | cd $IN/$cvs_rel | ||
30 | if [[ -d $PROJECT ]] ; then | ||
31 | cd $PROJECT | ||
32 | cvs update -r $cvs_rel | ||
33 | else | ||
34 | cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nagiosplug co -r $cvs_rel nagiosplug | ||
35 | cd $PROJECT | ||
36 | aclocal | ||
37 | autoheader | ||
38 | autoconf | ||
39 | automake | ||
40 | autoreconf | ||
41 | ./configure | ||
42 | fi | ||
43 | |||
44 | # Make the Nagiosplug dist tarball | ||
45 | VER=$v$DS VERSION=$v$DS REL=snapshot make -e dist | ||
46 | |||
47 | # End ssh | ||
48 | EOF | ||
49 | } | ||
50 | |||
11 | # Set working variables | 51 | # Set working variables |
12 | PROJECT=nagiosplug | 52 | PROJECT=nagiosplug |
13 | IN=${HOME}/tmp_snapshot | 53 | IN=${HOME}/tmp_snapshot |
14 | OUT_SERVER="shell.sf.net" | 54 | OUT_SERVER="shell.sf.net" |
15 | OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot" | 55 | #OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot" |
56 | OUT="~/test" | ||
16 | CF="usf-cf-x86-linux-2" | 57 | CF="usf-cf-x86-linux-2" |
17 | DS=`date -u +%Y%m%d%H%M` | 58 | DS=`date -u +%Y%m%d%H%M` |
18 | 59 | ||
19 | # Get compile server to do the work | 60 | # Make dists for HEAD and any others in command parameters |
20 | # Variables will be expanded locally before being run on $CF | 61 | make_dist |
21 | ssh $CF <<EOF | 62 | for i in $* ; do |
22 | PATH=$PATH | 63 | make_dist $i |
23 | [[ ! -d $IN ]] && mkdir -p $IN | 64 | done |
24 | cd ${IN} | ||
25 | if [[ -d $PROJECT ]] ; then | ||
26 | cd $PROJECT | ||
27 | rm -f configure.in | ||
28 | cvs update | ||
29 | else | ||
30 | cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/nagiosplug co nagiosplug | ||
31 | cd $PROJECT | ||
32 | fi | ||
33 | |||
34 | sed 's/^VER=.*/VER=${DS}/;s/^REL=.*/REL=snapshot/' configure.in > configure.tmp | ||
35 | mv configure.tmp configure.in | ||
36 | aclocal | ||
37 | autoheader | ||
38 | autoconf | ||
39 | automake | ||
40 | autoreconf | ||
41 | |||
42 | # Make the Nagiosplug dist tarball | ||
43 | ./configure | ||
44 | make dist | ||
45 | |||
46 | # End ssh | ||
47 | EOF | ||
48 | 65 | ||
49 | # Check for *.gz files locally (expect NFS between cf shell server and $CF) | 66 | # Check for *.gz files locally (expect NFS between cf shell server and $CF) |
50 | set -x | 67 | set -x |
51 | cd $IN/$PROJECT | 68 | files=$(ls $IN/*/$PROJECT/*.gz 2>/dev/null) |
52 | ls *.gz > /dev/null 2>&1 || die "No file created" | 69 | [[ -z $files ]] && die "No files created" |
53 | ssh $OUT_SERVER "rm -f $OUT/*.gz" | 70 | ssh $OUT_SERVER "rm -f $OUT/*.gz" |
54 | scp *.gz $OUT_SERVER:$OUT | 71 | scp $files $OUT_SERVER:$OUT |
55 | rm -f *.gz | 72 | |
73 | # Create MD5 sum | ||
74 | ssh $OUT_SERVER << EOF | ||
75 | cd $OUT | ||
76 | md5sum *.gz > MD5SUM | ||
77 | EOF | ||
78 | |||
79 | rm -f $files | ||
56 | 80 | ||