diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-04 22:56:26 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-10-04 22:56:26 (GMT) |
commit | 84c4a5d24cbef536b8248a3d8ff72bb2b4248c29 (patch) | |
tree | aa5eaf24f84315ea5fa143bf287c9fcf7857391f /bin/git-export | |
parent | 45d3e695be499cf9f9956c223883073fc20d48b4 (diff) | |
download | site-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-x | bin/git-export | 27 |
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 | |||
18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | 18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' |
19 | 19 | ||
20 | export_prefix='/home/plugins/exported' | 20 | export_prefix='/home/plugins/exported' |
21 | export_branch='master' | ||
22 | myself=${0##*/} | 21 | myself=${0##*/} |
23 | 22 | ||
24 | if [ $# -lt 1 ] | 23 | usage() |
25 | then | 24 | { |
26 | echo >&2 "Usage: $myself <repository> ..." | 25 | echo >&2 "Usage: $myself [-b <branch>] <repository> ..." |
27 | exit 2 | 26 | exit 2 |
28 | fi | 27 | } |
28 | |||
29 | while getopts b: option | ||
30 | do | ||
31 | case $option in | ||
32 | b) | ||
33 | branch=$OPTARG | ||
34 | ;; | ||
35 | *) | ||
36 | usage | ||
37 | ;; | ||
38 | esac | ||
39 | done | ||
40 | |||
41 | shift $((OPTIND - 1)) | ||
42 | test $# -ge 1 || usage | ||
29 | 43 | ||
30 | for repository in "$@" | 44 | for repository in "$@" |
31 | do | 45 | do |
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" |
40 | done | 55 | done |