summaryrefslogtreecommitdiffstats
path: root/bin/git-export
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-10-04 22:56:26 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-10-04 22:56:26 (GMT)
commit84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 (patch)
treeaa5eaf24f84315ea5fa143bf287c9fcf7857391f /bin/git-export
parent45d3e695be499cf9f9956c223883073fc20d48b4 (diff)
downloadsite-84c4a5d24cbef536b8248a3d8ff72bb2b4248c29.tar.gz
Add test instance of the web site
Serve https://www.nagios-plugins.org:444/ from the "test" branch of this repository.
Diffstat (limited to 'bin/git-export')
-rwxr-xr-xbin/git-export27
1 files changed, 21 insertions, 6 deletions
diff --git a/bin/git-export b/bin/git-export
index fc76081..06d832a 100755
--- a/bin/git-export
+++ b/bin/git-export
@@ -18,23 +18,38 @@ set -u
18export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' 18export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin'
19 19
20export_prefix='/home/plugins/exported' 20export_prefix='/home/plugins/exported'
21export_branch='master'
22myself=${0##*/} 21myself=${0##*/}
23 22
24if [ $# -lt 1 ] 23usage()
25then 24{
26 echo >&2 "Usage: $myself <repository> ..." 25 echo >&2 "Usage: $myself [-b <branch>] <repository> ..."
27 exit 2 26 exit 2
28fi 27}
28
29while getopts b: option
30do
31 case $option in
32 b)
33 branch=$OPTARG
34 ;;
35 *)
36 usage
37 ;;
38 esac
39done
40
41shift $((OPTIND - 1))
42test $# -ge 1 || usage
29 43
30for repository in "$@" 44for repository in "$@"
31do 45do
32 export_dir="$export_prefix/${repository##*/}" 46 export_dir="$export_prefix/${repository##*/}"
33 export_dir=${export_dir%.git} 47 export_dir=${export_dir%.git}
48 export_dir="$export_dir${branch:+-$branch}"
34 49
35 cd "$repository" 50 cd "$repository"
36 rm -r -f "$export_dir" 51 rm -r -f "$export_dir"
37 mkdir -p "$export_dir" 52 mkdir -p "$export_dir"
38 git archive "$export_branch" | tar -x -C "$export_dir" -f - 53 git archive "${branch:-master}" | tar -x -C "$export_dir" -f -
39 cd "$OLDPWD" 54 cd "$OLDPWD"
40done 55done