summaryrefslogtreecommitdiffstats
path: root/tools/sfsnapshotgit
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-09-27 23:10:53 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-09-27 23:10:53 +0200
commit9ae1cd8f91aa6b53404e66588679d852d3972bcd (patch)
tree1edc8a9ac8e36bf8fabeed7b7b3ad933d691438c /tools/sfsnapshotgit
parent983d10e0609175a26675a97129b9e7def18d5f35 (diff)
downloadmonitoring-plugins-9ae1cd8f91aa6b53404e66588679d852d3972bcd.tar.gz
tools: Remove Drupal/SourceForge scripts
We moved our web site away from Drupal and the snapshots/guidelines away from SourceForge. The new infrastructure scripts will be maintained in a separate repository together with the Markdown source of the new web site.
Diffstat (limited to 'tools/sfsnapshotgit')
-rwxr-xr-xtools/sfsnapshotgit77
1 files changed, 0 insertions, 77 deletions
diff --git a/tools/sfsnapshotgit b/tools/sfsnapshotgit
deleted file mode 100755
index 8bc19fce..00000000
--- a/tools/sfsnapshotgit
+++ /dev/null
@@ -1,77 +0,0 @@
1#!/bin/bash
2# sfsnapshotgit - Snapshot script for Git repository
3# Original author: Thomas Guyot-Sionnest <tguyot@gmail.com>
4#
5# Given an optional branch name (master by default), this script creates
6# a snapshot from the tip of the branch and move it to ~/staging/.
7# The repository, origin and destination directory can be overridden
8# with environment variable (see below)
9
10# Handle command errors (-e) and coder sleep deprivation issues (-u)
11set -eu
12trap 'echo "An error occurred in sfsnapshotgit at line $LINENO"; exit 1' EXIT
13
14# Send all command output to STDERR while allowing us to write to STDOUT
15# using fd 3
16exec 3>&1 1>&2
17
18# Git repository, origin and destination directory can be overridden by
19# setting SFSNAP_REPO, SFSNAP_ORIGIN and SFSNAP_DEST respectively from the
20# caller The defaults are:
21SFSNAP_REPO=${SFSNAP_REPO-~/staging/nagiosplugins}
22SFSNAP_ORIGIN=${SFSNAP_ORIGIN-origin}
23SFSNAP_DEST=${SFSNAP_DEST-~/staging/snapshot}
24
25# If one argument is given, this is the branch to create the snapshot from
26if [ $# -eq 0 ]
27then
28 HEAD='master'
29elif [ $# -eq 1 ]
30then
31 if [ -z "$1" ]
32 then
33 echo "If specified, the refspec must not be empty"
34 exit
35 fi
36 HEAD="$1"
37else
38 echo "Too many arguments"
39 exit
40fi
41
42# Clean up and pull
43cd "$SFSNAP_REPO"
44# Sometimes "make dist" can modify versioned files so we must reset first
45git reset --hard
46git clean -qfdx
47
48# Any branch used to create snapshots must already exist and be properly configured
49git checkout "$HEAD"
50
51# Get the remote tracking branch from config
52origin=$(git config branch.$HEAD.remote)
53ref=$(git config branch.$HEAD.merge |sed -e 's|^refs/heads/||')
54git fetch "$origin"
55git reset --hard "$origin/$ref"
56
57# Tags are important for git-describe, but take only the ones from the hard-coded origin
58git fetch --tags "$SFSNAP_ORIGIN"
59
60# Write our snapshot version string (similar to NP-VERSION-GEN) to "release"
61VS=$(git describe --abbrev=4 HEAD)
62VS=${VS#release-}
63
64# Configure and dist only if needed
65if [ ! -e "$SFSNAP_DEST/nagios-plugins-$VS.tar.gz" ]
66then
67 tools/setup
68 ./configure
69 make dist VERSION=$VS RELEASE=snapshot
70 cp nagios-plugins-$VS.tar.gz "$SFSNAP_DEST/"
71fi
72
73# fd 3 goes to STDOUT; print the generated filename
74echo "nagios-plugins-$VS.tar.gz" 1>&3
75
76trap - EXIT
77