summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authornagiosplugins <nagiosplugins@nagiosplugins.org>2009-09-25 09:34:37 (GMT)
committernagiosplugins <nagiosplugins@nagiosplugins.org>2009-09-25 09:34:37 (GMT)
commit9b550c5a96c3fb1f312e43c1d29d0e81846c8943 (patch)
tree77042fa0b96915d9ccb7544b8db49eadcfa25258 /tools
parent43c187a9444ddfdac26fb5c2e2f21dd38c72ce8d (diff)
downloadmonitoring-plugins-9b550c5a96c3fb1f312e43c1d29d0e81846c8943.tar.gz
Add sfsnapshotgit
Diffstat (limited to 'tools')
-rwxr-xr-xtools/sfsnapshotgit52
1 files changed, 52 insertions, 0 deletions
diff --git a/tools/sfsnapshotgit b/tools/sfsnapshotgit
new file mode 100755
index 0000000..df0dc35
--- /dev/null
+++ b/tools/sfsnapshotgit
@@ -0,0 +1,52 @@
1#!/bin/bash
2
3# Handle command errors (-e) and coder sleep deprivation issues (-u)
4set -eu
5trap 'echo "An error occurred at line $LINENO"; exit 1' EXIT
6
7# Timestamp
8DS=`date -u +%Y%m%d%H%M`
9
10if [ $# -ne 1 ]
11then
12 HEAD='master'
13else
14 HEAD="$1"
15fi
16
17if [ -z "$HEAD" ]
18then
19 echo "If specified, the refspec must not be empty"
20 exit
21fi
22
23# Clean up and pull
24cd ~/staging/nagiosplugins
25git clean -qfdx
26git checkout "$HEAD"
27git pull origin "$HEAD"
28# Tags are important for git-describe
29git fetch --tags origin
30
31# Write our snapshot version string (similar to NP-VERSION-GEN) to "release"
32VS=$(git describe --abbrev=4 HEAD)
33
34# Configure and dist
35tools/setup
36./configure
37make dist VERSION=${VS#release-} RELEASE=snapshot
38
39# The rest is probably going to change... The mv below is for backwards
40# compatibility, however I'd recommend:
41# ln -s nagios-plugins-${VS#release-}.tar.gz nagios-plugins-$HEAD.tar.gz
42# ln -s nagios-plugins-${VS#release-}.tar.gz nagios-plugins-trunk-$DS.tar.gz
43# ln -s nagios-plugins-master.tar.gz nagios-plugins-HEAD.tar.gz
44# NB: the 3rd one would be permannent, no need to do it each time
45# Additionally, we could check whenever we need to re-generate a snapshot.
46# This way we could make snapshots much more often as only symlink changes
47# would have to be uploaded.
48mv nagios-plugins-${VS#release-}.tar.gz nagios-plugins-trunk-$DS.tar.gz
49cp *.tar.gz /tmp/
50
51trap - EXIT
52