summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorDim-P <Dim-P@users.noreply.github.com>2023-02-02 14:48:04 +0000
committerGitHub <noreply@github.com>2023-02-02 14:48:04 +0000
commit161f51132dd83909d4a5652e3e2591d7282d47ed (patch)
tree7f9f6d90bdb9da5862a42be0b9a3d810bc63bf1b /packaging
parentcf8881b91eae992f17fbe6cbd139952bbb34b0a1 (diff)
Fix kickstart and updater not working with BusyBox wget (#14392)
* Fix kickstart.sh failing when using busybox wget * Add a BusyBox compatible wget alternative in telemetry_event() * Fix netdata-updater.sh wget to work with BusyBox
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/installer/kickstart.sh23
-rwxr-xr-xpackaging/installer/netdata-updater.sh2
2 files changed, 17 insertions, 8 deletions
diff --git a/packaging/installer/kickstart.sh b/packaging/installer/kickstart.sh
index 94da3d526c..30c7b4cabb 100755
--- a/packaging/installer/kickstart.sh
+++ b/packaging/installer/kickstart.sh
@@ -302,12 +302,21 @@ EOF
if command -v curl > /dev/null 2>&1; then
curl --silent -o /dev/null -X POST --max-time 2 --header "Content-Type: application/json" -d "${REQ_BODY}" "${TELEMETRY_URL}" > /dev/null
elif command -v wget > /dev/null 2>&1; then
- wget -q -O - --no-check-certificate \
- --method POST \
- --timeout=1 \
- --header 'Content-Type: application/json' \
- --body-data "${REQ_BODY}" \
- "${TELEMETRY_URL}" > /dev/null
+ if wget --help 2>&1 | grep BusyBox > /dev/null 2>&1; then
+ # BusyBox-compatible version of wget, there is no --no-check-certificate option
+ wget -q -O - \
+ -T 1 \
+ --header 'Content-Type: application/json' \
+ --post-data "${REQ_BODY}" \
+ "${TELEMETRY_URL}" > /dev/null
+ else
+ wget -q -O - --no-check-certificate \
+ --method POST \
+ --timeout=1 \
+ --header 'Content-Type: application/json' \
+ --body-data "${REQ_BODY}" \
+ "${TELEMETRY_URL}" > /dev/null
+ fi
fi
}
@@ -592,7 +601,7 @@ get_redirect() {
if command -v curl > /dev/null 2>&1; then
run sh -c "curl ${url} -s -L -I -o /dev/null -w '%{url_effective}' | grep -o '[^/]*$'" || return 1
elif command -v wget > /dev/null 2>&1; then
- run sh -c "wget --max-redirect=0 ${url} 2>&1 | grep Location | cut -d ' ' -f2 | grep -o '[^/]*$'" || return 1
+ run sh -c "wget -S -O /dev/null ${url} 2>&1 | grep -m 1 Location | grep -o '[^/]*$'" || return 1
else
fatal "${ERROR_F0003}" F0003
fi
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh
index 5e6a786eb3..130507c17c 100755
--- a/packaging/installer/netdata-updater.sh
+++ b/packaging/installer/netdata-updater.sh
@@ -378,7 +378,7 @@ get_netdata_latest_tag() {
if command -v curl >/dev/null 2>&1; then
tag=$(curl "${url}" -s -L -I -o /dev/null -w '%{url_effective}' | grep -m 1 -o '[^/]*$')
elif command -v wget >/dev/null 2>&1; then
- tag=$(wget --max-redirect=0 "${url}" 2>&1 | grep Location | cut -d ' ' -f2 | grep -m 1 -o '[^/]*$')
+ tag=$(wget -S -O /dev/null "${url}" 2>&1 | grep -m 1 Location | grep -o '[^/]*$')
else
fatal "I need curl or wget to proceed, but neither of them are available on this system." U0006
fi