summaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--packaging/installer/README.md8
-rw-r--r--packaging/installer/functions.sh97
-rwxr-xr-xpackaging/makeself/install-or-update.sh40
-rw-r--r--packaging/version2
4 files changed, 133 insertions, 14 deletions
diff --git a/packaging/installer/README.md b/packaging/installer/README.md
index 22633895f..eb6d89423 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 2e3044340..03dd8dc89 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"
+}
diff --git a/packaging/makeself/install-or-update.sh b/packaging/makeself/install-or-update.sh
index 9796eb085..393525554 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,17 @@ 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
+RELEASE_CHANNEL="nightly"
+
+while [ "${1}" ]; do
+ case "${1}" in
+ "--dont-start-it") STARTIT=0;;
+ "--auto-update"|"-u") AUTOUPDATE=1;;
+ "--stable-channel") RELEASE_CHANNEL="stable";;
+ *) echo >&2 "Unknown option '${1}'. Ignoring it.";;
+ esac
+ shift 1
done
deleted_stock_configs=0
@@ -137,6 +141,22 @@ progress "Install netdata at system init"
install_netdata_service || run_failed "Cannot install netdata init service."
+set_netdata_updater_channel || run_failed "Cannot set netdata updater tool release channel to '${RELEASE_CHANNEL}'"
+
+
+# -----------------------------------------------------------------------------
+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"
diff --git a/packaging/version b/packaging/version
index f72019128..2a34c700c 100644
--- a/packaging/version
+++ b/packaging/version
@@ -1 +1 @@
-v1.18.0
+v1.18.1