-
Notifications
You must be signed in to change notification settings - Fork 0
/
installClients.sh
64 lines (53 loc) · 1.14 KB
/
installClients.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
#!/usr/bin/env bash
set -a
. exports/clients
set +a
source './installFromGit.sh'
let githubUser
let githubOrganization
onlyClients=()
while getopts "u:s:o:" opt; do
case ${opt} in
u)
echo "Using github user $OPTARG" >&2
githubUser=$OPTARG;
;;
o)
echo "Using github organization $OPTARG" >&2
githubOrganization=$OPTARG;
;;
s)
echo "Using client $OPTARG" >&2
onlyClients+=($OPTARG);
;;
esac
done
shift $((OPTIND -1))
for opt in "$@"; do
if [[ "$opt" != "-s" ]]; then
echo "Using client $opt" >&2
onlyClients+=($opt)
fi
done
if [[ -z "$githubUser" ]]; then
echo "" 1>&2
echo "Error: Missing github user. Please provide with -u flag" 1>&2
echo "" 1>&2
exit 1
fi
if [[ -z "$githubOrganization" ]]; then
echo "" 1>&2
echo "Error: Missing github organization. Please provide with -o flag" 1>&2
echo "" 1>&2
exit 1
fi
onlyClientsCount=${#onlyClients}
if [ ${onlyClientsCount} -eq 0 ]; then
CLIENT_ARRAY=${CLIENTS[@]}
else
CLIENT_ARRAY=${onlyClients[@]}
fi
for client in ${CLIENT_ARRAY}
do
installFromGit "${client}-web" "${githubUser}" "${githubOrganization}"
done