use wget when curl is not available
Costa Tsaousis (ktsaou) committed
May 28, 2017 at 20:07 UTC
cf57a8960ff8b3c53093ab0859721bc2cdb1300e
1 file changed
+35
-5
kickstart-static64.sh
+35
-5
@@ -150,26 +150,56 @@ if [ "$(uname -s)" != "Linux" ]
150
fatal "Static binary versions of netdata are available only for Linux, but this system is $(uname -s)"
151
fi
152
153
+curl="$(which_cmd curl)"
154
+wget="$(which_cmd wget)"
155
+
156
# ---------------------------------------------------------------------------------------------------------------------
157
158
+progress "Checking the latest version of static build..."
159
+
160
BASE='https://raw.githubusercontent.com/firehol/binary-packages/master'
161
157
-progress "Checking the latest version of static build..."
158
-LATEST="$(run curl -Ss "${BASE}/netdata-latest.gz.run")"
162
+LATEST=
163
+if [ ! -z "${curl}" -a -x "${curl}" ]
164
+then
165
+ LATEST="$(run ${curl} "${BASE}/netdata-latest.gz.run")"
166
+elif [ ! -z "${wget}" -a -x "${wget}" ]
167
+then
168
+ LATEST="$(run ${wget} -O - "${BASE}/netdata-latest.gz.run")"
169
+else
170
+ fatal "curl or wget are needed for this script to work."
171
+fi
172
173
if [ -z "${LATEST}" ]
174
then
175
fatal "Cannot find the latest static binary version of netdata."
176
fi
177
178
+# ---------------------------------------------------------------------------------------------------------------------
179
+
180
progress "Downloading static netdata binary: ${LATEST}"
166
-run curl "${BASE}/${LATEST}" >"/tmp/${LATEST}"
167
-if [ $? -ne 0 ]
181
+
182
+ret=1
183
+if [ ! -z "${curl}" -a -x "${curl}" ]
184
+then
185
+ run ${curl} "${BASE}/${LATEST}" >"/tmp/${LATEST}"
186
+ ret=$?
187
+elif [ ! -z "${wget}" -a -x "${wget}" ]
188
+then
189
+ run ${wget} -O "/tmp/${LATEST}" "${BASE}/${LATEST}"
190
+ ret=$?
191
+else
192
+ fatal "curl or wget are needed for this script to work."
193
+fi
194
+
195
+if [ ${ret} -ne 0 -o ! -s "/tmp/${LATEST}" ]
196
then
197
fatal "Failed to download the latest static binary version of netdata."
198
fi
199
172
-progress "Executing the downloaded self-extracting archive"
200
+# ---------------------------------------------------------------------------------------------------------------------
201
+
202
+progress "Installing netdata"
203
204
sudo=
205
[ "${UID}" != "0" ] && sudo="sudo"