Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix the netdata-updater.sh to correctly pass REINSTALL_OPTIONS (final…
…ly) (#8808)

* Add support for overriding the URL for installing/updating nightlies

* Fix bug with running the makeself archive and importly passing REINSTALL_OPTIONS (not word splitting)
  • Loading branch information
prologic committed Aug 25, 2020
1 parent dde9663 commit 11c610a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
27 changes: 27 additions & 0 deletions build-artifacts.sh
@@ -0,0 +1,27 @@
#!/bin/sh

BASENAME="netdata-$(git describe)"

mkdir -p artifacts

autoreconf -ivf
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--libexecdir=/usr/libexec \
--with-zlib \
--with-math \
--with-user=netdata \
CFLAGS=-O2
make dist
mv "${BASENAME}.tar.gz" artifacts/

USER="" ./packaging/makeself/build-x86_64-static.sh

cp packaging/version artifacts/latest-version.txt

cd artifacts || exit 1
ln -s "${BASENAME}.tar.gz" netdata-latest.tar.gz
ln -s "${BASENAME}.gz.run" netdata-latest.gz.run
sha256sum -b ./* > "sha256sums.txt"
11 changes: 6 additions & 5 deletions packaging/installer/netdata-updater.sh
Expand Up @@ -131,8 +131,8 @@ set_tarball_urls() {
export NETDATA_TARBALL_URL="https://github.com/netdata/netdata/releases/download/$latest/netdata-$latest.${extension}"
export NETDATA_TARBALL_CHECKSUM_URL="https://github.com/netdata/netdata/releases/download/$latest/sha256sums.txt"
else
export NETDATA_TARBALL_URL="$NETDATA_TARBALL_BASEURL/netdata-latest.${extension}"
export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_TARBALL_BASEURL/sha256sums.txt"
export NETDATA_TARBALL_URL="$NETDATA_NIGHTLIES_BASEURL/netdata-latest.${extension}"
export NETDATA_TARBALL_CHECKSUM_URL="$NETDATA_NIGHTLIES_BASEURL/sha256sums.txt"
fi
}

Expand Down Expand Up @@ -242,8 +242,8 @@ 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")"

# Netdata Tarball Base URL (defaults to our Google Storage Bucket)
[ -z "$NETDATA_TARBALL_BASEURL" ] && NETDATA_TARBALL_BASEURL=https://storage.googleapis.com/netdata-nightlies
# Grab the nightlies baseurl (defaulting to our Google Storage bucket)
export NETDATA_NIGHTLIES_BASEURL="${NETDATA_NIGHTLIES_BASEURL:-https://storage.googleapis.com/netdata-nightlies}"

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)"
Expand Down Expand Up @@ -277,7 +277,8 @@ if [ "${IS_NETDATA_STATIC_BINARY}" == "yes" ]; then
fi

# Do not pass any options other than the accept, for now
if sh "${TMPDIR}/netdata-latest.gz.run" --accept -- "${REINSTALL_OPTIONS}"; then
# shellcheck disable=SC2086
if sh "${TMPDIR}/netdata-latest.gz.run" --accept -- ${REINSTALL_OPTIONS}; then
rm -r "${TMPDIR}"
else
echo >&2 "NOTE: did not remove: ${TMPDIR}"
Expand Down

0 comments on commit 11c610a

Please sign in to comment.