summaryrefslogtreecommitdiffstats
path: root/packaging/installer
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-26 08:29:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-26 08:29:53 +0000
commitd608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01 (patch)
tree8c283d1c81d718e64d87d9a2d1132c89f3915939 /packaging/installer
parentReleasing debian version 1.18.0-1. (diff)
downloadnetdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.tar.xz
netdata-d608b19e0d3b3f4d84fcfcdd72bb7e64c86b6f01.zip
Merging upstream version 1.18.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/installer')
-rw-r--r--packaging/installer/README.md8
-rw-r--r--packaging/installer/functions.sh97
2 files changed, 102 insertions, 3 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md
index 22633895..eb6d8942 100644
--- a/packaging/installer/README.md
+++ b/packaging/installer/README.md
@@ -333,7 +333,7 @@ This is how to install the latest Netdata version from sources on FreeBSD:
```sh
# install required packages
-pkg install bash e2fsprogs-libuuid git curl autoconf automake pkgconf pidof
+pkg install bash e2fsprogs-libuuid git curl autoconf automake pkgconf pidof Judy liblz4 libuv json-c
# download Netdata
git clone https://github.com/netdata/netdata.git --depth=100
@@ -347,15 +347,17 @@ cd netdata
To install Netdata on pfSense, run the following commands (within a shell or under the **Diagnostics/Command** prompt within the pfSense web interface).
-Note that the first four packages are downloaded from the pfSense repository for maintaining compatibility with pfSense, Netdata and Python are downloaded from the FreeBSD repository.
+Note that the first four packages are downloaded from the pfSense repository for maintaining compatibility with pfSense, Netdata, Judy and Python are downloaded from the FreeBSD repository.
```sh
pkg install pkgconf
pkg install bash
pkg install e2fsprogs-libuuid
pkg install libuv
+pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/Judy-1.0.5_2.txz
pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/python36-3.6.9.txz
-pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/netdata-1.15.0.txz
+ln -s /usr/local/lib/libjson-c.so /usr/local/lib/libjson-c.so.4
+pkg add http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/netdata-1.17.1.txz
```
**Note:** If you receive a ` Not Found` error during the last two commands above, you will either need to manually look in the [repo folder](http://pkg.freebsd.org/FreeBSD:11:amd64/latest/All/) for the latest available package and use its URL instead, or you can try manually changing the netdata version in the URL to the latest version.
diff --git a/packaging/installer/functions.sh b/packaging/installer/functions.sh
index 2e304434..03dd8dc8 100644
--- a/packaging/installer/functions.sh
+++ b/packaging/installer/functions.sh
@@ -727,3 +727,100 @@ safe_sha256sum() {
fatal "I could not find a suitable checksum binary to use"
fi
}
+
+get_crondir() {
+ crondir=
+ [ -d "/etc/periodic/daily" ] && crondir="/etc/periodic/daily"
+ [ -d "/etc/cron.daily" ] && crondir="/etc/cron.daily"
+
+ echo "${crondir}"
+}
+
+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
+ # 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
+ fi
+
+ return 0
+}
+
+install_netdata_updater() {
+ if [ "${INSTALLER_DIR}" ] && [ -f "${INSTALLER_DIR}/packaging/installer/netdata-updater.sh" ]; then
+ cat "${INSTALLER_DIR}/packaging/installer/netdata-updater.sh" > "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" || return 1
+ fi
+
+ if [ "${NETDATA_SOURCE_DIR}" ] && [ -f "${NETDATA_SOURCE_DIR}/packaging/installer/netdata-updater.sh" ]; then
+ cat "${NETDATA_SOURCE_DIR}/packaging/installer/netdata-updater.sh" > "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" || return 1
+ fi
+
+ sed -e "s|THIS_SHOULD_BE_REPLACED_BY_INSTALLER_SCRIPT|${NETDATA_USER_CONFIG_DIR}/.environment|" -i "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" || return 1
+
+ chmod 0755 ${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh
+ echo >&2 "Update script is located at ${TPUT_GREEN}${TPUT_BOLD}${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh${TPUT_RESET}"
+ echo >&2
+
+ return 0
+}
+
+cleanup_old_netdata_updater() {
+ if [ -f "${NETDATA_PREFIX}"/usr/libexec/netdata-updater.sh ]; then
+ echo >&2 "Removing updater from deprecated location"
+ rm -f "${NETDATA_PREFIX}"/usr/libexec/netdata-updater.sh
+ fi
+
+ crondir="$(get_crondir)"
+ check_crondir_permissions "${crondir}" || return 1
+
+ if [ -f "${crondir}/netdata-updater.sh" ]; then
+ echo >&2 "Removing incorrect netdata-updater filename in cron"
+ rm -f "${crondir}/netdata-updater.sh"
+ fi
+
+ return 0
+}
+
+enable_netdata_updater() {
+ crondir="$(get_crondir)"
+ check_crondir_permissions "${crondir}" || return 1
+
+ echo >&2 "Adding to cron"
+
+ rm -f "${crondir}/netdata-updater"
+ ln -sf "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" "${crondir}/netdata-updater"
+
+ echo >&2 "Auto-updating has been enabled. Updater script linked to: ${TPUT_RED}${TPUT_BOLD}${crondir}/netdata-update${TPUT_RESET}"
+ echo >&2
+ echo >&2 "${TPUT_DIM}${TPUT_BOLD}netdata-updater.sh${TPUT_RESET}${TPUT_DIM} works from cron. It will trigger an email from cron"
+ echo >&2 "only if it fails (it should not print anything when it can update netdata).${TPUT_RESET}"
+ echo >&2
+
+ return 0
+}
+
+disable_netdata_updater() {
+ crondir="$(get_crondir)"
+ 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
+
+ if [ -f "${crondir}/netdata-updater" ]; then
+ echo >&2 "Removing cron reference: ${crondir}/netdata-updater"
+ echo >&2
+ rm -f "${crondir}/netdata-updater"
+ else
+ echo >&2 "Did not find any cron entries to remove"
+ echo >&2
+ fi
+
+ return 0
+}
+
+set_netdata_updater_channel() {
+ sed -e "s/^RELEASE_CHANNEL=.*/RELEASE_CHANNEL=\"${RELEASE_CHANNEL}\"/" -i "${NETDATA_USER_CONFIG_DIR}/.environment"
+}