Code

To create nagiosplug daily snapshots on SF
[nagiosplug.git] / tools / sfsnapshot
1 #! /bin/bash
3 # Butchered version of snapshot
4 # Can only run on the shell compile farm server
5 # Assumes:
6 #  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 function die { echo $1; exit 1; }
11 # Set working variables
12 PROJECT=nagiosplug
13 IN=${HOME}/tmp_snapshot
14 OUT_SERVER="shell.sf.net"
15 OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot"
16 CF="usf-cf-x86-linux-2"
17 DS=`date -u +%Y%m%d%H%M`
19 # Get compile server to do the work
20 # Variables will be expanded locally before being run on $CF
21 ssh $CF <<EOF
22 PATH=$PATH
23 [[ ! -d $IN ]] && mkdir -p $IN
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
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
42 # Make the Nagiosplug dist tarball
43 ./configure
44 make dist
46 # End ssh
47 EOF
49 # Check for *.gz files locally (expect NFS between cf shell server and $CF)
50 set -x
51 cd $IN/$PROJECT
52 ls *.gz > /dev/null 2>&1 || die "No file created"
53 ssh $OUT_SERVER "rm -f $OUT/*.gz"
54 scp *.gz $OUT_SERVER:$OUT
55 rm -f *.gz