summaryrefslogtreecommitdiffstats
path: root/bin/git-export
diff options
context:
space:
mode:
Diffstat (limited to 'bin/git-export')
-rwxr-xr-xbin/git-export40
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/git-export b/bin/git-export
new file mode 100755
index 0000000..fc76081
--- /dev/null
+++ b/bin/git-export
@@ -0,0 +1,40 @@
1#!/bin/sh
2#
3# Copyright (c) 2013 Nagios Plugins Development Team
4#
5# Originally written by Holger Weiss <holger@zedat.fu-berlin.de>.
6#
7# This file is free software; the Nagios Plugins Development Team gives
8# unlimited permission to copy and/or distribute it, with or without
9# modifications, as long as this notice is preserved.
10#
11# This program is distributed in the hope that it will be useful, but WITHOUT
12# ANY WARRANTY, to the extent permitted by law; without even the implied
13# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
15set -e
16set -u
17
18export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
19
20export_prefix='/home/plugins/exported'
21export_branch='master'
22myself=${0##*/}
23
24if [ $# -lt 1 ]
25then
26 echo >&2 "Usage: $myself <repository> ..."
27 exit 2
28fi
29
30for repository in "$@"
31do
32 export_dir="$export_prefix/${repository##*/}"
33 export_dir=${export_dir%.git}
34
35 cd "$repository"
36 rm -r -f "$export_dir"
37 mkdir -p "$export_dir"
38 git archive "$export_branch" | tar -x -C "$export_dir" -f -
39 cd "$OLDPWD"
40done