summaryrefslogtreecommitdiffstats
path: root/packaging/installer/functions.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-11-28 04:53:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-11-28 04:53:29 +0000
commit17c93e2be4ad7b3af0cd6878bdd5d8a4a3e6da99 (patch)
tree3e0c96613972e8bb4afdeeb97a034806363ddfa9 /packaging/installer/functions.sh
parentReleasing debian version 1.18.1-1. (diff)
downloadnetdata-17c93e2be4ad7b3af0cd6878bdd5d8a4a3e6da99.tar.xz
netdata-17c93e2be4ad7b3af0cd6878bdd5d8a4a3e6da99.zip
Merging upstream version 1.19.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer/functions.sh')
-rw-r--r--packaging/installer/functions.sh34
1 files changed, 18 insertions, 16 deletions
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index 03dd8dc89..d2b7b6761 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -728,19 +728,21 @@ safe_sha256sum() {
fi
}
-get_crondir() {
- crondir=
- [ -d "/etc/periodic/daily" ] && crondir="/etc/periodic/daily"
- [ -d "/etc/cron.daily" ] && crondir="/etc/cron.daily"
+_get_crondir() {
+ if [ -d /etc/cron.daily ]; then
+ echo /etc/cron.daily
+ elif [ -d /etc/periodic/daily ]; then
+ echo /etc/periodic/daily
+ else
+ echo >&2 "Cannot figure out the cron directory to handle netdata-updater.sh activation/deactivation"
+ return 1
+ fi
- echo "${crondir}"
+ return 0
}
-check_crondir_permissions() {
- if [ -z "${1}" ]; then
- echo >&2 "Cannot figure out the cron directory to handle netdata-updater.sh activation/deactivation"
- return 1
- elif [ "${UID}" -ne "0" ]; then
+_check_crondir_permissions() {
+ if [ "${UID}" -ne "0" ]; then
# We cant touch cron if we are not running as root
echo >&2 "You need to run the installer as root for auto-updating via cron"
return 1
@@ -773,8 +775,8 @@ cleanup_old_netdata_updater() {
rm -f "${NETDATA_PREFIX}"/usr/libexec/netdata-updater.sh
fi
- crondir="$(get_crondir)"
- check_crondir_permissions "${crondir}" || return 1
+ crondir="$(_get_crondir)" || return 1
+ _check_crondir_permissions "${crondir}" || return 1
if [ -f "${crondir}/netdata-updater.sh" ]; then
echo >&2 "Removing incorrect netdata-updater filename in cron"
@@ -785,8 +787,8 @@ cleanup_old_netdata_updater() {
}
enable_netdata_updater() {
- crondir="$(get_crondir)"
- check_crondir_permissions "${crondir}" || return 1
+ crondir="$(_get_crondir)" || return 1
+ _check_crondir_permissions "${crondir}" || return 1
echo >&2 "Adding to cron"
@@ -803,8 +805,8 @@ enable_netdata_updater() {
}
disable_netdata_updater() {
- crondir="$(get_crondir)"
- check_crondir_permissions "${crondir}" || return 1
+ crondir="$(_get_crondir)" || return 1
+ _check_crondir_permissions "${crondir}" || return 1
echo >&2 "You chose *NOT* to enable auto-update, removing any links to the updater from cron (it may have happened if you are reinstalling)"
echo >&2