e5a13d479cc9105340ac50d12e4549778d1a8e13
1 #! /bin/bash
3 # Butchered version of snapshot
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 ...]"
7 # Assumes:
8 # ssh setup to send to shell.sf.net and $CF without password prompt
9 # autconf and automake installed on shell cf at v 2.57 & 1.72 and in PATH
11 function die { echo $1; exit 1; }
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
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 -I lib
37 autoheader
38 autoconf
39 automake --add-missing --copy
40 autoreconf
41 ./configure
42 fi
44 # Make the Nagiosplug dist tarball
45 VER=$v$DS VERSION=$v$DS REL=snapshot make -e dist
47 # End ssh
48 EOF
49 }
51 # Set working variables
52 PROJECT=nagiosplug
53 IN=${HOME}/tmp_snapshot
54 OUT_SERVER="shell.sf.net"
55 OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot"
56 CF="usf-cf-x86-linux-2"
57 DS=`date -u +%Y%m%d%H%M`
59 # Make dists for HEAD and any others in command parameters
60 make_dist
61 for i in $* ; do
62 make_dist $i
63 done
65 # Check for *.gz files locally (expect NFS between cf shell server and $CF)
66 set -x
67 files=$(ls $IN/*/$PROJECT/*.gz 2>/dev/null)
68 [[ -z $files ]] && die "No files created"
69 ssh $OUT_SERVER "rm -f $OUT/*.gz"
70 scp $files $OUT_SERVER:$OUT
72 # Create MD5 sum
73 ssh $OUT_SERVER << EOF
74 cd $OUT
75 md5sum *.gz > MD5SUM
76 EOF
78 rm -f $files