diff options
author | Paul Emm. Katsoulakis <34388743+paulkatsoulakis@users.noreply.github.com> | 2019-07-29 15:33:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-29 15:33:46 +0300 |
commit | c8b82d9a37bea5203000eecdcd0d3a68fdff0ac8 (patch) | |
tree | 99a627b57c646f704aa6374083d5f78c13340cf4 /packaging/installer/netdata-updater.sh | |
parent | 551617bd322e2b855ccf19375650348fda77938a (diff) |
netdata/packaging: Move tarball checksum information into lib dir of netdata (#6555)
* netdata/packaging: Move tarball checksum information into lib dir of netdata
1) Introduce NETDATA_LIB_DIR within environment file, we are going to need to refer to it
2) move NETDATA_TARBALL_CHECKSUM to /netdata.tarball.checksum
3) Make sure you support transitional period, which means load and remove the variable from the old location then move it to the new one
* netdata/packaging: relocate netdata-updater.sh and netdata-uninstaller.sh
Diffstat (limited to 'packaging/installer/netdata-updater.sh')
-rwxr-xr-x | packaging/installer/netdata-updater.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/packaging/installer/netdata-updater.sh b/packaging/installer/netdata-updater.sh index bb5f371879..6609edd5a8 100755 --- a/packaging/installer/netdata-updater.sh +++ b/packaging/installer/netdata-updater.sh @@ -11,7 +11,7 @@ # - NETDATA_TARBALL_URL # - NETDATA_TARBALL_CHECKSUM_URL # - NETDATA_TARBALL_CHECKSUM -# +# - NETDATA_PREFIX / NETDATA_LIB_DIR (After 1.16.1 we will only depend on lib dir) # # Copyright: SPDX-License-Identifier: GPL-3.0-or-later # @@ -142,10 +142,12 @@ update() { info "Re-installing netdata..." eval "${REINSTALL_COMMAND} --dont-wait ${do_not_start}" >&3 2>&3 || fatal "FAILED TO COMPILE/INSTALL NETDATA" + + # We no longer store checksum info here. but leave this so that we clean up all environment files upon next update. sed -i '/NETDATA_TARBALL/d' "${ENVIRONMENT_FILE}" - cat <<EOF >>"${ENVIRONMENT_FILE}" -NETDATA_TARBALL_CHECKSUM="$NEW_CHECKSUM" -EOF + + info "Updating tarball checksum info" + echo "${NEW_CHECKSUM}" > "${NETDATA_LIB_DIR}/netdata.tarball.checksum" fi rm -rf "${tmpdir}" >&3 2>&3 @@ -159,6 +161,12 @@ EOF # shellcheck source=/dev/null source "${ENVIRONMENT_FILE}" || exit 1 +# We dont expect to find lib dir variable on older installations, so load this path if none found +export NETDATA_LIB_DIR="${NETDATA_LIB_DIR:-${NETDATA_PREFIX}/var/lib/netdata}" + +# Source the tarbal checksum, if not already available from environment (for existing installations with the old logic) +[[ -z "${NETDATA_TARBALL_CHECKSUM}" ]] && [[ -f ${NETDATA_LIB_DIR}/netdata.tarball.checksum ]] && NETDATA_TARBALL_CHECKSUM="$(cat "${NETDATA_LIB_DIR}/netdata.tarball.checksum")" + if [ "${INSTALL_UID}" != "$(id -u)" ]; then fatal "You are running this script as user with uid $(id -u). We recommend to run this script as root (user with uid 0)" fi |