-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·59 lines (53 loc) · 1.11 KB
/
setup.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
#!/bin/bash
usage()
{
cat <<- _EOF_
Usage: ./setup.sh [OPTIONS] COMMAND...
Set up infrastructure for tracking PKGBUILDs.
OPTIONS
-h, --help show this usage message
COMMANDS
ssh append ssh-config rules
hooks add commit hooks
_EOF_
}
ssh() {
echo "Appending ssh-config rules..."
cat <<- _EOF_ >> ~/.ssh/config
Host aur
User aur
Hostname aur4.archlinux.org
IdentityFile ~/.ssh/keys/aur
_EOF_
}
hooks() {
echo "Adding commit hooks..."
shopt -s nullglob
for hook in *.hook; do
ln -sf "$(pwd)/${hook}" ".git/hooks/${hook%.hook}"
done
}
if [[ $# -eq 0 ]]; then
echo "error: No arguments passed."
echo "Try '${0} --help' for more information."
exit 1
fi
while [[ "${1}" != "" ]]; do
case ${1} in
-h|--help)
usage
exit
;;
ssh)
ssh
;;
hooks)
hooks
;;
*)
echo "${0}: unrecognized option '${1}'"
echo "Try '${0} --help' for more information."
exit 1
esac
shift
done