summaryrefslogtreecommitdiffstats
path: root/tools/sfsnapshot
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sfsnapshot')
-rwxr-xr-xtools/sfsnapshot119
1 files changed, 0 insertions, 119 deletions
diff --git a/tools/sfsnapshot b/tools/sfsnapshot
deleted file mode 100755
index 3b71219..0000000
--- a/tools/sfsnapshot
+++ /dev/null
@@ -1,119 +0,0 @@
1#! /bin/bash
2
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 ...]"
7# Assumes:
8# ssh setup to send to shell.sf.net and $CF without password prompt
9# the compile server has all the prerequisites stated at http://nagiosplug.sourceforge.net/developer-guidelines.html
10# Install in cron with something like:
11# 47 * * * * $HOME/bin/mail_error -o $HOME/sfsnapshot.out -m tonvoon@users.sf.net sfsnapshot r1_3_0
12
13function die { echo $1; exit 1; }
14
15# This makes the distribution. Expects $1 as branches/name, otherwise uses trunk
16function make_dist {
17 if [[ -n $1 ]] ; then
18 svn_url_suffix=$1
19 name=${1##*/}
20 else
21 svn_url_suffix="trunk"
22 name="trunk"
23 fi
24 v="$name-"
25
26 # Get compile server to do the work
27 # Variables will be expanded locally before being run on $CF
28 ssh $CF <<EOF
29 set -x
30 PATH=$PATH:/usr/local/bin
31 [[ ! -d $COMPILE_DIR/$name ]] && mkdir -p $COMPILE_DIR/$name
32 cd $COMPILE_DIR/$name
33
34 # Cannot use cvs export due to conflicts on second run - think this is better for cvs server
35 svn export https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/$svn_url_suffix $PROJECT
36
37 cd $PROJECT
38
39 tools/setup
40
41 ./configure
42
43 # Make the Nagiosplug dist tarball
44 make dist VERSION=$v$DS RELEASE=snapshot
45
46 # May fail if file not generated - do not trap
47 mv *.gz $IN
48
49 rm -rf $COMPILE_DIR
50 # End ssh
51EOF
52}
53
54# Set working variables
55PROJECT=nagiosplug
56
57# This is local to the compile server for faster compile
58COMPILE_DIR=/tmp/tonvoon/tmp_snapshot
59
60# Needs to be on NFS so gz file can be read on the compile shell server
61IN=${HOME}/tmp_snapshot
62
63# Where to place the generated files
64OUT_SERVER="tonvoon@web.sourceforge.net"
65OUT="/home/groups/n/na/nagiosplug/htdocs/snapshot"
66
67# Make sure prereqs are satisfied on server!
68CF="localhost"
69DS=`date -u +%Y%m%d%H%M`
70
71# Setup home directory area
72[[ ! -d $IN ]] && mkdir -p $IN
73
74# Make dists for HEAD and any others in command parameters
75make_dist
76for i in $* ; do
77 make_dist $i
78done
79
80# Create MD5 sum
81cd $IN
82cat <<-END_README > README
83This is the daily SVN snapshot of nagiosplug, consisting of the SVN trunk
84and any other branches.
85
86The nagios-plugins-HEAD.tar.gz link will always go to the latest trunk snapshot
87(name kept for existing tinderbox scripts to link correctly).
88
89The MD5SUM is:
90END_README
91md5sum *.gz | tee -a README > MD5SUM
92
93
94# Check for *.gz files locally (expect NFS between cf shell server and $CF)
95set -x
96cd $IN
97files=$(ls *.gz 2>/dev/null)
98[[ -z $files ]] && die "No files created"
99head_file=$(cd $IN && ls -rt *-trunk-*.gz | head -1 2>/dev/null)
100cat <<-EOF > /tmp/batchfile.$$
101cd $OUT
102rm *.gz
103put *.gz
104ln $head_file nagios-plugins-HEAD.tar.gz
105put MD5SUM
106put README readme
107EOF
108
109# Do the actual transfer
110# Have to put README down as readme because SF's apache server appears to block README files
111sftp -b /tmp/batchfile.$$ $OUT_SERVER
112
113rm -f $files /tmp/batchfile.$$
114
115# Work out success or failure
116expected=$(($# + 1))
117set -- $files
118[[ $# -ne $expected ]] && die "Expected $expected, got $#"
119exit 0