-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
69 lines (57 loc) · 1.35 KB
/
install.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
#!/bin/bash
if (( "${#DEVOPS_FETCH[*]}" < 1 ))
then
DEVOPS_FETCH=(cat)
fi
if (( "${#DEVOPS_LOCATION[*]}" < 1 ))
then
DEVOPS_LOCATION=`dirname "${BASH_SOURCE[0]}"`
fi
if [[ ! -z "${DEVOPS_REMOTE}" ]]
then
if ! which curl 2>&1 >/dev/null
then
apt-get update && apt-get install -qq curl
if [[ "$?" != 0 ]]
then
echo "Could not install basic dependencies" >&2
exit 1
fi
fi
DEVOPS_FETCH=(curl -sL)
DEVOPS_LOCATION="https://raw.githubusercontent.com/burgerdev/devops/master"
fi
if (( $# < 1 ))
then
DEVOPS_SUBS=(ubuntu-basic-packages add-dotfiles add-github-public-keys \
ubuntu-docker-setup ubuntu-kubernetes-setup)
else
DEVOPS_SUBS=("$@")
fi
function run_sub_installer {
logs=`mktemp`
set -o pipefail
"${DEVOPS_FETCH[@]}" "${DEVOPS_LOCATION}/$1" | bash 2>&1 > "${logs}"
status=$?
if [[ "$status" != 0 ]]
then
echo "*** FAILED ***"
cat "${logs}" >&2
fi
rm -f "${logs}"
return $status
}
echo "Installing: ${DEVOPS_SUBS[*]}."
for f in "${DEVOPS_SUBS[@]}"
do
if ! (echo "${DEVOPS_DISABLED_SUBS[*]}" | grep -q "$f" )
then
echo "*** running '$f.sh' ***"
run_sub_installer "$f.sh"
status=$?
if [[ "$status" != 0 ]]
then
exit $status
fi
fi
done