-
Notifications
You must be signed in to change notification settings - Fork 27
/
install-self-hosted-toolbox
executable file
·95 lines (82 loc) · 2.26 KB
/
install-self-hosted-toolbox
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
set -o pipefail
IFS=$'\n\t'
DIST=$(uname)
case $DIST in
Darwin)
INSTALL_PATH='/usr/local/bin'
;;
Linux)
[[ -f /usr/bin/sudo ]] && sudo rm -f /etc/apt/sources.list.d/python_2.7-source.list
INSTALL_PATH='/usr/local/bin'
;;
*)
echo "Unsupported distro $DIST"
exit 1
;;
esac
install_cmd() {
local cmd=$@
if [ `whoami` == 'root' ]; then
`$@`
else
`sudo $@`
fi
}
echo "Installing the cache CLI"
install_cmd ln -sf ~/.toolbox/cache $INSTALL_PATH/cache
install_cmd chmod +x $INSTALL_PATH/cache
if [[ $? -eq 0 ]];then
echo "cache installed"
else
echo "Error installing the cache CLI at $INSTALL_PATH/cache"
fi
echo "Installing the artifacts CLI"
install_cmd ln -sf ~/.toolbox/artifact $INSTALL_PATH/artifact
install_cmd chmod +x $INSTALL_PATH/artifact
if [[ $? -eq 0 ]];then
echo "artifacts installed"
else
echo "Error installing the artifacts CLI at $INSTALL_PATH/artifact"
fi
echo "Installing the test results CLI"
install_cmd ln -sf ~/.toolbox/test-results $INSTALL_PATH/test-results
install_cmd chmod +x $INSTALL_PATH/test-results
if [[ $? -eq 0 ]];then
echo "test-results installed"
else
echo "Error installing the test-results CLI at $INSTALL_PATH/test-results"
fi
echo "Installing retry"
install_cmd ln -sf ~/.toolbox/retry $INSTALL_PATH/retry
install_cmd chmod +x $INSTALL_PATH/retry
if [[ $? -eq 0 ]];then
echo "retry installed"
else
echo "Error installing retry at $INSTALL_PATH/retry"
fi
echo "Installing the SPC CLI"
install_cmd mv ~/.toolbox/spc $INSTALL_PATH/spc
install_cmd chmod +x $INSTALL_PATH/spc
if [[ $? -eq 0 ]];then
echo "spc installed"
else
echo "Error installing spc at $INSTALL_PATH/spc"
fi
echo "Installing the when CLI"
install_cmd mv ~/.toolbox/when $INSTALL_PATH/when
install_cmd chmod +x $INSTALL_PATH/when
if [[ $? -eq 0 ]];then
echo "when installed"
else
echo "Error installing when at $INSTALL_PATH/when"
fi
echo "Installing the sem-context CLI"
install_cmd ln -sf ~/.toolbox/sem-context $INSTALL_PATH/sem-context
install_cmd chmod +x $INSTALL_PATH/sem-context
if [[ $? -eq 0 ]];then
echo "sem-context installed"
else
echo "Error installing the sem-context CLI at $INSTALL_PATH/sem-context"
fi
source ~/.toolbox/toolbox && echo 'source ~/.toolbox/toolbox' >> ~/.bash_profile