forked from tmatilai/gitolite-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
git-gl-htpasswd.sh
executable file
·69 lines (63 loc) · 1.12 KB
/
git-gl-htpasswd.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# Copyright (c) 2010 Teemu Matilainen
#
# Set password on gitolite server to be used with gitweb/apache.
# Requires that the functionality is enabled on the server.
. git-gl-helpers
NONGIT_OK=Yes
OPTIONS_SPEC="\
git gl-htpasswd [--set[=<password>] | --file=<file>] [<server>]
--
q,quiet be quiet
v,verbose be verbose
set?! set the password (from stdin if not specified)
F,file=! set the password from the specified file
<server> Host name, git URL or remote name
"
. git-sh-setup
passwd=
while test $# != 0; do
case "$1" in
-q|--quiet)
GIT_QUIET=1
VERBOSE=
;;
--no-quiet)
GIT_QUIET=
;;
-v|--verbose)
GIT_QUIET=
VERBOSE=1
;;
--no-verbose)
VERBOSE=
;;
--set)
case "$2" in
-*) ;;
*) passwd="$2"; shift ;;
esac
;;
-F|--file)
passwd=$(cat "$2") || exit $?
shift
;;
--)
shift
break
;;
*)
usage
;;
esac
shift
done
test "$#" -le 1 || usage
resolve_remote "$1"
test -n "$GIT_QUIET" -o -z "$VERBOSE" -a -n "$passwd" && exec >/dev/null
if test -n "$passwd"; then
printf '%s' "$passwd" | gl_ssh_command htpasswd
else
gl_ssh_command htpasswd
fi