summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2021-12-09 16:51:51 +0300
committerGitHub <noreply@github.com>2021-12-09 16:51:51 +0300
commit81a3feae6f838e4ff415fa6e411c569e5db7b932 (patch)
tree9623aec02fd3a8d6484f0d488fa26eaf67d13cee /packaging
parent9e08ce63f746a1bbf70c5f74360085b21fda2ea6 (diff)
fix(updater): don't produce output when static update succeeded (#11879)
Diffstat (limited to 'packaging')
-rwxr-xr-xpackaging/installer/netdata-updater.sh22
1 files changed, 11 insertions, 11 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh
index a76733fbd5..be98079c81 100755
--- a/packaging/installer/netdata-updater.sh
+++ b/packaging/installer/netdata-updater.sh
@@ -123,9 +123,7 @@ create_tmp_directory() {
if [ -z "${TMPDIR}" ] || _cannot_use_tmpdir "${TMPDIR}" ; then
if _cannot_use_tmpdir /tmp ; then
if _cannot_use_tmpdir "${PWD}" ; then
- echo >&2
- echo >&2 "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
- exit 1
+ fatal "Unable to find a usable temporary directory. Please set \$TMPDIR to a path that is both writable and allows execution of files and try again."
else
TMPDIR="${PWD}"
fi
@@ -191,7 +189,7 @@ get_netdata_latest_tag() {
}
newer_commit_date() {
- echo >&3 "Checking if a newer version of the updater script is available."
+ info "Checking if a newer version of the updater script is available."
if command -v jq > /dev/null 2>&1; then
commit_date="$(_safe_download "https://api.github.com/repos/netdata/netdata/commits?path=packaging%2Finstaller%2Fnetdata-updater.sh&page=1&per_page=1" /dev/stdout | jq '.[0].commit.committer.date' | tr -d '"')"
@@ -216,7 +214,7 @@ newer_commit_date() {
self_update() {
if [ -z "${NETDATA_NO_UPDATER_SELF_UPDATE}" ] && newer_commit_date; then
- echo >&3 "Downloading newest version of updater script."
+ info "Downloading newest version of updater script."
ndtmpdir=$(create_tmp_directory)
cd "$ndtmpdir" || exit 1
@@ -226,7 +224,7 @@ self_update() {
export ENVIRONMENT_FILE="${ENVIRONMENT_FILE}"
exec ./netdata-updater.sh --not-running-from-cron --no-updater-self-update --tmpdir-path "$(pwd)"
else
- echo >&3 "Failed to download newest version of updater script, continuing with current version."
+ error "Failed to download newest version of updater script, continuing with current version."
fi
fi
}
@@ -437,7 +435,7 @@ if [ "${IS_NETDATA_STATIC_BINARY}" = "yes" ]; then
ndtmpdir="$(create_tmp_directory)"
PREVDIR="$(pwd)"
- echo >&2 "Entering ${ndtmpdir}"
+ info "Entering ${ndtmpdir}"
cd "${ndtmpdir}" || exit 1
download "${NETDATA_TARBALL_CHECKSUM_URL}" "${ndtmpdir}/sha256sum.txt"
@@ -454,18 +452,20 @@ if [ "${IS_NETDATA_STATIC_BINARY}" = "yes" ]; then
# Do not pass any options other than the accept, for now
# shellcheck disable=SC2086
- if sh "${ndtmpdir}/netdata-latest.gz.run" --accept -- ${REINSTALL_OPTIONS}; then
- rm -r "${ndtmpdir}"
+ if sh "${ndtmpdir}/netdata-latest.gz.run" --accept -- ${REINSTALL_OPTIONS} >&3 2>&3; then
+ rm -rf "${ndtmpdir}" >&3 2>&3
else
- echo >&2 "NOTE: did not remove: ${ndtmpdir}"
+ info "NOTE: did not remove: ${ndtmpdir}"
fi
echo "${install_type}" > /opt/netdata/etc/netdata/.install-type
if [ -e "${PREVDIR}" ]; then
- echo >&2 "Switching back to ${PREVDIR}"
+ info "Switching back to ${PREVDIR}"
cd "${PREVDIR}"
fi
+ [ -n "${logfile}" ] && rm "${logfile}" && logfile=
+ exit 0
else
# the installer updates this script - so we run and exit in a single line
update && exit 0