-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathinstall-toolbox
167 lines (141 loc) · 4.56 KB
/
install-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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#!/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
cat << EOF >> ~/.ssh/config
Host github.com bitbucket.org
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
EOF
install_cmd() {
local cmd=$@
if [ `whoami` == 'root' ]; then
`$@`
else
`sudo $@`
fi
}
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 "toolbox_install_error_retry" >> /tmp/toolbox_metrics
fi
install_cmd ln -sf ~/.toolbox/ssh-session-cli $INSTALL_PATH/semaphore
install_cmd chmod +x $INSTALL_PATH/semaphore
if [[ $? -eq 0 ]];then
echo "ssh-session-cli installed"
else
echo "toolbox_install_error_ssh-session-cli" >> /tmp/toolbox_metrics
fi
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 "toolbox_install_error_cache" >> /tmp/toolbox_metrics
fi
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 "toolbox_install_error_sem-context" >> /tmp/toolbox_metrics
fi
install_cmd ln -sf ~/.toolbox/sem-service $INSTALL_PATH/sem-service
install_cmd chmod +x $INSTALL_PATH/sem-service
if [[ $? -eq 0 ]];then
echo "sem-service installed"
else
echo "toolbox_install_error_sem-service" >> /tmp/toolbox_metrics
fi
install_cmd ln -sf ~/.toolbox/sem-dockerize $INSTALL_PATH/sem-dockerize
install_cmd chmod +x $INSTALL_PATH/sem-dockerize
if [[ $? -eq 0 ]];then
echo "sem-dockerize installed"
else
echo "toolbox_install_error_sem-dockerize" >> /tmp/toolbox_metrics
fi
install_cmd ln -sf ~/.toolbox/sem-service-check-params $INSTALL_PATH/sem-service-check-params
install_cmd chmod +x $INSTALL_PATH/sem-service-check-params
if [[ $? -eq 0 ]];then
echo "sem-service-check-params installed"
else
echo "toolbox_install_error_sem-service-check-params" >> /tmp/toolbox_metrics
fi
install_cmd ln -sf ~/.toolbox/sem-semantic-release $INSTALL_PATH/sem-semantic-release
install_cmd chmod +x $INSTALL_PATH/sem-semantic-release
if [[ $? -eq 0 ]];then
echo "sem-semantic-release installed"
else
echo "toolbox_install_error_sem-semantic-release" >> /tmp/toolbox_metrics
fi
echo "Installing the artifacts CLI"
install_cmd mv ~/.toolbox/artifact $INSTALL_PATH/artifact
install_cmd chmod +x $INSTALL_PATH/artifact
if [[ $? -eq 0 ]];then
echo "artifacts installed"
else
echo "toolbox_install_error_artifacts" >> /tmp/toolbox_metrics
fi
echo "Installing the test results CLI"
install_cmd mv ~/.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 "toolbox_install_error_test-results" >> /tmp/toolbox_metrics
fi
if [[ `uname` != "Darwin" ]]; then
echo "Installing the install-package for linux"
install_cmd ln -sf ~/.toolbox/install-package $INSTALL_PATH/install-package
install_cmd ln -sf ~/.toolbox/install-package $INSTALL_PATH/install-package.sh
install_cmd chmod +x $INSTALL_PATH/install-package
if [[ $? -eq 0 ]];then
echo "install-package installed"
else
echo "toolbox_install_error_install-package" >> /tmp/toolbox_metrics
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 "toolbox_install_error_spc" >> /tmp/toolbox_metrics
fi
echo "Installing the when CLI"
ERLANG_VERSION=$(erl -eval 'erlang:display(erlang:system_info(otp_release)), halt().' -noshell | tr -d '"\r')
install_cmd mv ~/.toolbox/when_otp_$ERLANG_VERSION $INSTALL_PATH/when
install_cmd chmod +x $INSTALL_PATH/when
if [[ $? -eq 0 ]];then
echo "when installed"
else
echo "toolbox_install_error_when" >> /tmp/toolbox_metrics
fi
echo "Installing the enetwork CLI"
install_cmd mv ~/.toolbox/enetwork $INSTALL_PATH/enetwork
install_cmd chmod +x $INSTALL_PATH/enetwork
if [[ $? -eq 0 ]];then
echo "enetwork installed"
else
echo "toolbox_install_error_enetwork" >> /tmp/toolbox_metrics
fi
echo "Starting to collect System Metrics in /tmp/system-metrics"
# failure won't be propagated to the caller in case of using &
sh ~/.toolbox/system-metrics-collector &
fi