summaryrefslogtreecommitdiffstats
path: root/packaging/installer/functions.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-11-28 04:53:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-11-28 04:53:08 +0000
commit315e0143f65da3485dcbcd2f6a3172a351618aec (patch)
treeb713ae472cffab249c95917c6fb6d242d54e0a87 /packaging/installer/functions.sh
parentAdding upstream version 1.18.1. (diff)
downloadnetdata-315e0143f65da3485dcbcd2f6a3172a351618aec.tar.xz
netdata-315e0143f65da3485dcbcd2f6a3172a351618aec.zip
Adding upstream version 1.19.0.upstream/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 03dd8dc8..d2b7b676 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