summaryrefslogtreecommitdiffstats
path: root/packaging/makeself/install-or-update.sh
diff options
context:
space:
mode:
authorKonstantinos Natsakis <5933427+knatsakis@users.noreply.github.com>2019-10-17 16:30:49 +0300
committerChris Akritidis <43294513+cakrit@users.noreply.github.com>2019-10-17 15:30:49 +0200
commit4b9cc50adc5d3cd0a644ebbd2d5db4ae66e4208e (patch)
tree5b7b2bf358d6c701b132ceeaaa90cf187ea77390 /packaging/makeself/install-or-update.sh
parente2d151d5923b9ae89d38cd260942a5f4cf11a238 (diff)
Partial fix for #7039 (#7060)
* Partial fix for #7039 Moved updater installation code from netdata-installer.sh to packaging/installer/functions.sh packaging/makeself/install-or-update.sh uses above code to install netdata updater - Moved updater installation code to packaging/installer/functions.sh - packaging/makeself/install-or-update.sh uses above code to install netdata updater * Split install_or_remove_netdata_updater() function * Improved netdata-updater related message output * Improved variable declaration location in install-or-update.sh
Diffstat (limited to 'packaging/makeself/install-or-update.sh')
-rwxr-xr-xpackaging/makeself/install-or-update.sh35
1 files changed, 25 insertions, 10 deletions
diff --git a/packaging/makeself/install-or-update.sh b/packaging/makeself/install-or-update.sh
index 9796eb0851..21b7bf2e08 100755
--- a/packaging/makeself/install-or-update.sh
+++ b/packaging/makeself/install-or-update.sh
@@ -9,6 +9,9 @@ umask 002
# Be nice on production environments
renice 19 $$ >/dev/null 2>/dev/null
+NETDATA_PREFIX="/opt/netdata"
+NETDATA_USER_CONFIG_DIR="${NETDATA_PREFIX}/etc/netdata"
+
# -----------------------------------------------------------------------------
if [ -d /opt/netdata/etc/netdata.old ]; then
progress "Found old etc/netdata directory, reinstating this"
@@ -21,16 +24,15 @@ if [ -d /opt/netdata/etc/netdata.old ]; then
fi
STARTIT=1
-
-while [ ! -z "${1}" ]
-do
- if [ "${1}" = "--dont-start-it" ]
- then
- STARTIT=0
- else
- echo >&2 "Unknown option '${1}'. Ignoring it."
- fi
- shift
+AUTOUPDATE=0
+
+while [ "${1}" ]; do
+ case "${1}" in
+ "--dont-start-it") STARTIT=0;;
+ "--auto-update"|"-u") AUTOUPDATE=1;;
+ *) echo >&2 "Unknown option '${1}'. Ignoring it.";;
+ esac
+ shift 1
done
deleted_stock_configs=0
@@ -138,6 +140,19 @@ install_netdata_service || run_failed "Cannot install netdata init service."
# -----------------------------------------------------------------------------
+progress "Install (but not enable) netdata updater tool"
+cleanup_old_netdata_updater || run_failed "Cannot cleanup old netdata updater tool."
+install_netdata_updater || run_failed "Cannot install netdata updater tool."
+
+progress "Check if we must enable/disable the netdata updater tool"
+if [ "${AUTOUPDATE}" = "1" ]; then
+ enable_netdata_updater || run_failed "Cannot enable netdata updater tool"
+else
+ disable_netdata_updater || run_failed "Cannot disable netdata updater tool"
+fi
+
+
+# -----------------------------------------------------------------------------
progress "creating quick links"
dir_should_be_link() {