@cryptotaxi247 / netdata-1 / commits / a24f5bd75

Revert "Overhaul handling of auto-updates in the installer code. (#12076)" (#12182)

This reverts commit da7f215ad6c98cbf54ab93dbc1d2457ac01dbb08.

Austin S. Hemmelgarn committed Feb 18, 2022 at 20:35 UTC a24f5bd75c1d720cd31f4c4defb25ba010f17269
8 files changed +123 -267
contrib/debian/rules
-8
@@ -75,10 +75,6 @@ override_dh_install:
75 mkdir -p "$(TOP)/var/cache/netdata"
76 mkdir -p "$(TOP)/var/run/netdata"
77
78 - # Copy the updater script
79 - #
80 - cp -v packaging/installer/netdata-updater.sh $(TOP)/usr/libexec/netdata/netdata-updater.sh
81 -
78 # Move files that local user shouldn't be editing to /usr/share/netdata
79 #
80 mkdir -p "$(TOP)/usr/share/netdata/www"
@@ -112,10 +108,6 @@ override_dh_installdocs:
108 override_dh_fixperms:
109 dh_fixperms
110
115 - # Updater script should be executable
116 - #
117 - chmod 0755 $(TOP)/usr/libexec/netdata/netdata-updater.sh
118 -
111 # apps.plugin should only be runnable by the netdata user. It will be
112 # given extra capabilities in the postinst script.
113 #
netdata-installer.sh
+24 -2
@@ -226,6 +226,9 @@ USAGE: ${PROGRAM} [options]
226 --install <path> Install netdata in <path>. Ex. --install /opt will put netdata in /opt/netdata.
227 --dont-start-it Do not (re)start netdata after installation.
228 --dont-wait Run installation in non-interactive mode.
229 + --auto-update or -u Install netdata-updater in cron to automatically check for updates once per day.
230 + --auto-update-type Override the auto-update scheduling mechanism detection, currently supported types
231 + are: systemd, interval, crontab.
232 --stable-channel Use packages from GitHub release pages instead of nightly updates.
233 This results in less frequent updates.
234 --nightly-channel Use most recent nightly updates instead of GitHub releases.
@@ -298,6 +301,7 @@ HEREDOC
301
302 DONOTSTART=0
303 DONOTWAIT=0
304 +AUTOUPDATE=0
305 NETDATA_PREFIX=
306 LIBS_ARE_HERE=0
307 NETDATA_ENABLE_ML=""
@@ -315,8 +319,19 @@ while [ -n "${1}" ]; do
319 "--dont-scrub-cflags-even-though-it-may-break-things") DONT_SCRUB_CFLAGS_EVEN_THOUGH_IT_MAY_BREAK_THINGS=1 ;;
320 "--dont-start-it") DONOTSTART=1 ;;
321 "--dont-wait") DONOTWAIT=1 ;;
318 - "--auto-update" | "-u") ;;
319 - "--auto-update-type") ;;
322 + "--auto-update" | "-u") AUTOUPDATE=1 ;;
323 + "--auto-update-type")
324 + AUTO_UPDATE_TYPE="$(echo "${2}" | tr '[:upper:]' '[:lower:]')"
325 + case "${AUTO_UPDATE_TYPE}" in
326 + systemd|interval|crontab)
327 + shift 1
328 + ;;
329 + *)
330 + echo "Unrecognized value for --auto-update-type. Valid values are: systemd, interval, crontab"
331 + exit 1
332 + ;;
333 + esac
334 + ;;
335 "--stable-channel") RELEASE_CHANNEL="stable" ;;
336 "--nightly-channel") RELEASE_CHANNEL="nightly" ;;
337 "--enable-plugin-freeipmi") NETDATA_CONFIGURE_OPTIONS="$(echo "${NETDATA_CONFIGURE_OPTIONS%--enable-plugin-freeipmi)}" | sed 's/$/ --enable-plugin-freeipmi/g')" ;;
@@ -1881,6 +1896,13 @@ progress "Installing (but not enabling) the netdata updater tool"
1896 cleanup_old_netdata_updater || run_failed "Cannot cleanup old netdata updater tool."
1897 install_netdata_updater || run_failed "Cannot install netdata updater tool."
1898
1899 +progress "Check if we must enable/disable the netdata updater tool"
1900 +if [ "${AUTOUPDATE}" = "1" ]; then
1901 + enable_netdata_updater "${AUTO_UPDATE_TYPE}" || run_failed "Cannot enable netdata updater tool"
1902 +else
1903 + disable_netdata_updater || run_failed "Cannot disable netdata updater tool"
1904 +fi
1905 +
1906 # -----------------------------------------------------------------------------
1907 progress "Wrap up environment set up"
1908
netdata.spec.in
-6
@@ -270,10 +270,6 @@ rm -rf "${RPM_BUILD_ROOT}"
270
271 install -m 644 -p system/netdata.conf "${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}"
272
273 -# ###########################################################
274 -# Install updater script
275 -install -m 755 -p packaging/installer/netdata-updater.sh "${RPM_BUILD_ROOT}%{_libexecdir}/%{name}/netdata-updater.sh"
276 -
273 # ###########################################################
274 # logrotate settings
275 install -m 755 -d "${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d"
@@ -548,8 +544,6 @@ are sensor monitoring, system event monitoring, power control, and serial-over-L
544 %attr(4750,root,netdata) %{_libexecdir}/%{name}/plugins.d/freeipmi.plugin
545
546 %changelog
551 -* Wed Feb 03 2022 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-16
552 -- Bundle updater script in native packages.
547 * Mon Oct 11 2021 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-15
548 - Remove support code for legacy ACLK implementation.
549 * Wed Sep 16 2020 Austin Hemmelgarn <austin@netdata.cloud> 0.0.0-14
packaging/installer/UPDATE.md
+15 -53
@@ -6,9 +6,8 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/packaging/instal
6
7 # Update the Netdata Agent
8
9 -By default, the Netdata Agent automatically updates with the latest nightly or stable version depending on which
10 -you installed. If you opted out of automatic updates, you need to update your Netdata Agent to the latest nightly
11 -or stable version. You can also [enable or disable automatic updates on an existing install](#control-automatic-updates).
9 +By default, the Netdata Agent automatically updates with the latest nightly version. If you opted out of automatic
10 +updates, you need to update your Netdata Agent to the latest nightly or stable version.
11
12 > 💡 Looking to reinstall the Netdata Agent to enable a feature, update an Agent that cannot update automatically, or
13 > troubleshoot an error during the installation process? See our [reinstallation doc](/packaging/installer/REINSTALL.md)
@@ -21,35 +20,28 @@ icon in the local Agent dashboard's top navigation. This modal informs you wheth
20
21 ## Determine which installation method you used
22
24 -Starting with netdata v1.33.0, you can use Netdata itself to determine the installation type by running:
25 -
26 -```bash
27 -netdata -W buildinfo | grep 'Install type:'
28 -```
29 -
30 -If this produces no output, you have an older install and will have to manually look in the Netdata config directory.
23 If you are not sure where your Netdata config directory is, see the [configuration doc](/docs/configure/nodes.md). In
24 most installations, this is `/etc/netdata`.
25
26 Use `cd` to navigate to the Netdata config directory, then use `ls -a` to look for a file called `.install-type`.
27
28 - If the `.install-type` file doex not exist, look for a file in the same directory called `.environment`.
37 - - If the `.environment` file does not exist, then you have a ‘custom’ install.
38 - - If the `.environment` file does exist, then you have either a ‘static’ or ‘build’ install.
29 + - If the `.environment` file does not exist, you probably installed Netdata using your system package manager
30 + and should update it the same way you would run updates on the system itself.
31 + - If the `.environment` file does exist, then our [regular update method](#updates-for-most-systems) should
32 + work correctly.
33 - If the `.install-type` file does exist, check it’s contents with `cat .install-type`.
40 - - The value of the `INSTALL_TYPE` key indicates what type of install you have.
34 + - If the `INSTALL_TYPE` key has a value of `custom`, you probably installed Netdata using your system
35 + package manager and should update it the same way you would run updates on the system itself.
36 + - If the `INSTALL_TYPE` key has a value of `oci`, the install is from a Docker image.
37 + - Otherwise, the install should work with our [regular update method](#updates-for-most-systems).
38
42 -The exact update method to use depends on the install type:
39 +Next, use the appropriate method to update the Netdata Agent:
40
44 -- Installs with an install type of 'custom' usually indicate installing a third-party package through the system
45 - package manager. To update these installs, you should update the package just like you would any other package
46 - on your system.
47 -- Installs with an install type starting with `binpkg` or ending with `build` or `static` can be updated using
48 - our [regular update method](#updates-for-most-systems).
49 -- Installs with an install type of 'oci' were created from our official Docker images, and should be updated
50 - using our [Docker](#docker) update procedure.
51 -- macOS users should check [our update instructions for macOS](#macos).
52 -- Manually built installs should check [our update instructions for manual builds](#manual-installation-from-git).
41 +- [Updates for most systems](#updates-for-most-systems)
42 +- [Docker](#docker)
43 +- [macOS](#macos)
44 +- [Manual installation from Git](#manual-installation-from-git)
45
46 ## Updates for most systems
47
@@ -103,9 +95,6 @@ Homebrew downloads the latest Netdata via the
95 [formulae](https://github.com/Homebrew/homebrew-core/blob/master/Formula/netdata.rb), ensures all dependencies are met,
96 and updates Netdata via reinstallation.
97
106 -If you instead installed Netdata using our one-line installation script, you can use our [regular update
107 -instructions](#updates-for-most-systems) to update Netdata.
108 -
98 ## Manual installation from Git
99
100 If you installed [Netdata manually from Git](/packaging/installer/methods/manual.md), you can run that installer again
@@ -128,31 +117,4 @@ sudo ./netdata-installer.sh
117 > ⚠️ If you installed Netdata with any optional parameters, such as `--no-updates` to disable automatic updates, and
118 > want to retain those settings, you need to set them again during this process.
119
131 -## Control automatic updates
132 -
133 -Starting with Netdata v1.34.0, you can easily enable or disable automatic updates on an existing installation
134 -using the updater script.
135 -
136 -For most installs on Linux, you can enable auto-updates with:
137 -
138 -```bash
139 -/usr/libexec/netdata/netdata-updater.sh --enable-auto-updates
140 -```
141 -
142 -and disable them with:
120
144 -```bash
145 -/usr/libexec/netdata/netdata-updater.sh --disable-auto-updates
146 -```
147 -
148 -For static installs, instead use:
149 -
150 -```bash
151 -/opt/netdata/usr/libexec/netdata/netdata-updater.sh --enable-auto-updates
152 -```
153 -
154 -and:
155 -
156 -```bash
157 -/opt/netdata/usr/libexec/netdata/netdata-updater.sh --disable-auto-updates
158 -```
packaging/installer/functions.sh
+70
@@ -968,6 +968,76 @@ cleanup_old_netdata_updater() {
968 return 0
969 }
970
971 +enable_netdata_updater() {
972 +
973 + if [ -n "${1}" ] ; then
974 + updater_type="${1}"
975 + else
976 + updater_type="$(_get_scheduler_type)"
977 + fi
978 +
979 + case "${updater_type}" in
980 + "systemd")
981 + systemctl enable netdata-updater.timer
982 +
983 + echo >&2 "Auto-updating has been enabled using a systemd timer unit."
984 + echo >&2
985 + echo >&2 "If the update process fails, the failure will be logged to the systemd journal just like a regular service failure."
986 + echo >&2 "Successful updates should produce empty logs."
987 + echo >&2
988 + ;;
989 + "interval")
990 + ln -sf "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" "$(_get_intervaldir)/netdata-updater"
991 +
992 + echo >&2 "Auto-updating has been enabled through cron, updater script linked to ${TPUT_RED}${TPUT_BOLD}$(_get_intervaldir)/netdata-updater${TPUT_RESET}"
993 + echo >&2
994 + echo >&2 "If the update process fails and you have email notifications set up correctly for cron on this system, you should receive an email notification of the failure."
995 + echo >&2 "Successful updates will not send an email."
996 + echo >&2
997 + ;;
998 + "crontab")
999 + cat "${NETDATA_SOURCE_DIR}/system/netdata.crontab" > "/etc/cron.d/netdata-updater"
1000 +
1001 + echo >&2 "Auto-updating has been enabled through cron, using a crontab at ${TPUT_RED}${TPUT_BOLD}/etc/cron.d/netdata-updater${TPUT_RESET}"
1002 + echo >&2
1003 + echo >&2 "If the update process fails and you have email notifications set up correctly for cron on this system, you should receive an email notification of the failure."
1004 + echo >&2 "Successful updates will not send an email."
1005 + echo >&2
1006 + ;;
1007 + *)
1008 + echo >&2 "Unable to determine what type of auto-update scheduling to use, not enabling auto-updates."
1009 + echo >&2
1010 + return 1
1011 + esac
1012 +
1013 + return 0
1014 +}
1015 +
1016 +disable_netdata_updater() {
1017 + 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)"
1018 + echo >&2
1019 +
1020 + if issystemd && [ -n "$(get_systemd_service_dir)" ] ; then
1021 + systemctl disable netdata-updater.timer
1022 + fi
1023 +
1024 + if [ -d /etc/cron.daily ]; then
1025 + rm -f /etc/cron.daily/netdata-updater.sh
1026 + rm -f /etc/cron.daily/netdata-updater
1027 + fi
1028 +
1029 + if [ -d /etc/periodic/daily ]; then
1030 + rm -f /etc/periodic/daily/netdata-updater.sh
1031 + rm -f /etc/periodic/daily/netdata-updater
1032 + fi
1033 +
1034 + if [ -d /etc/cron.d ]; then
1035 + rm -f /etc/cron.d/netdata-updater
1036 + fi
1037 +
1038 + return 0
1039 +}
1040 +
1041 set_netdata_updater_channel() {
1042 sed -i -e "s/^RELEASE_CHANNEL=.*/RELEASE_CHANNEL=\"${RELEASE_CHANNEL}\"/" "${NETDATA_USER_CONFIG_DIR}/.environment"
1043 }
packaging/installer/kickstart.sh
+1 -41
@@ -64,9 +64,8 @@ USAGE: kickstart.sh [options]
64 --dont-start-it Do not start the agent by default (only for static installs or local builds)
65 --stable-channel Install a stable version instead of a nightly build (default: install a nightly build)
66 --nightly-channel Install a nightly build instead of a stable version
67 - --no-updates Do not enable automatic updates (default: enable automatic updates using the best supported scheduling method)
67 + --no-updates Do not enable automatic updates (default: enable automatic updates)
68 --auto-update Enable automatic updates.
69 - --auto-update-type Specify a particular scheduling type for auto-updates (valid types: systemd, interval, crontab)
69 --disable-telemetry Opt-out of anonymous statistics.
70 --native-only Only install if native binary packages are available.
71 --static-only Only install if a static build is available.
@@ -785,30 +784,6 @@ claim() {
784 fi
785 }
786
788 -# ======================================================================
789 -# Auto-update handling code.
790 -set_auto_updates() {
791 - if [ -x "${INSTALL_PREFIX}/usr/libexec/netdata/netdata-updater.sh" ]; then
792 - updater="${INSTALL_PREFIX}/usr/libexec/netdata/netdata-updater.sh"
793 - elif [ -x "${INSTALL_PREFIX}/netdata/usr/libexec/netdata/netdata-updater.sh" ]; then
794 - updater="${INSTALL_PREFIX}/netdata/usr/libexec/netdata/netdata-updater.sh"
795 - else
796 - warning "Could not find netdata-updater.sh."
797 - return 0
798 - fi
799 -
800 - if [ "${NETDATA_AUTO_UPDATES}" = "1" ]; then
801 - # This first case is for catching using a new kickstart script with an old build. It can be safely removed after v1.34.0 is released.
802 - if grep -qv '--enable-auto-updates' ${updater}; then
803 - echo
804 - elif ! ${updater} --enable-auto-updates "${NETDATA_AUTO_UPDATE_TYPE}"; then
805 - error "Failed to enable auto updates. Netdata will still work, but you will need to update manually."
806 - fi
807 - else
808 - ${updater} --disable-auto-updates
809 - fi
810 -}
811 -
787 # ======================================================================
788 # Native package install code.
789
@@ -1253,7 +1228,6 @@ install_on_linux() {
1228 case "$?" in
1229 0)
1230 NETDATA_INSTALL_SUCCESSFUL=1
1256 - INSTALL_PREFIX="/"
1231 ;;
1232 1)
1233 fatal "Unable to install on this system." F0300
@@ -1368,18 +1342,6 @@ while [ -n "${1}" ]; do
1342 "--stable-channel") RELEASE_CHANNEL="stable" ;;
1343 "--no-updates") NETDATA_AUTO_UPDATES=0 ;;
1344 "--auto-update") NETDATA_AUTO_UPDATES="1" ;;
1371 - "--auto-update-method")
1372 - NETDATA_AUTO_UPDATE_TYPE="$(echo "${2}" | tr '[:upper:]' '[:lower:]')"
1373 - case "${NETDATA_AUTO_UPDATE_TYPE}" in
1374 - systemd|interval|crontab)
1375 - shift 1
1376 - ;;
1377 - *)
1378 - echo "Unrecognized value for --auto-update-type. Valid values are: systemd, interval, crontab"
1379 - exit 1
1380 - ;;
1381 - esac
1382 - ;;
1345 "--reinstall") NETDATA_REINSTALL=1 ;;
1346 "--reinstall-even-if-unsafe") NETDATA_UNSAFE_REINSTALL=1 ;;
1347 "--claim-only") NETDATA_CLAIM_ONLY=1 ;;
@@ -1479,8 +1441,6 @@ elif [ "${NETDATA_DISABLE_CLOUD}" -eq 1 ]; then
1441 soft_disable_cloud
1442 fi
1443
1482 -set_auto_updates
1483 -
1444 telemetry_event INSTALL_SUCCESS "" ""
1445 cleanup
1446 trap - EXIT
packaging/installer/netdata-updater.sh
+1 -156
@@ -73,142 +73,6 @@ if [ "${ENVIRONMENT_FILE}" = "THIS_SHOULD_BE_REPLACED_BY_INSTALLER_SCRIPT" ]; th
73 fi
74 fi
75
76 -issystemd() {
77 - # if the directory /lib/systemd/system OR /usr/lib/systemd/system (SLES 12.x) does not exit, it is not systemd
78 - if [ ! -d /lib/systemd/system ] && [ ! -d /usr/lib/systemd/system ]; then
79 - return 1
80 - fi
81 -
82 - # if there is no systemctl command, it is not systemd
83 - systemctl=$(command -v systemctl 2> /dev/null)
84 - if [ -z "${systemctl}" ] || [ ! -x "${systemctl}" ]; then
85 - return 1
86 - fi
87 -
88 - # if pid 1 is systemd, it is systemd
89 - [ "$(basename "$(readlink /proc/1/exe)" 2> /dev/null)" = "systemd" ] && return 0
90 -
91 - # if systemd is not running, it is not systemd
92 - pids=$(safe_pidof systemd 2> /dev/null)
93 - [ -z "${pids}" ] && return 1
94 -
95 - # check if the running systemd processes are not in our namespace
96 - myns="$(readlink /proc/self/ns/pid 2> /dev/null)"
97 - for p in ${pids}; do
98 - ns="$(readlink "/proc/${p}/ns/pid" 2> /dev/null)"
99 -
100 - # if pid of systemd is in our namespace, it is systemd
101 - [ -n "${myns}" ] && [ "${myns}" = "${ns}" ] && return 0
102 - done
103 -
104 - # else, it is not systemd
105 - return 1
106 -}
107 -
108 -_get_scheduler_type() {
109 - if _get_intervaldir > /dev/null ; then
110 - echo 'interval'
111 - elif issystemd ; then
112 - echo 'systemd'
113 - elif [ -d /etc/cron.d ] ; then
114 - echo 'crontab'
115 - else
116 - echo 'none'
117 - fi
118 -}
119 -
120 -_get_intervaldir() {
121 - if [ -d /etc/cron.daily ]; then
122 - echo /etc/cron.daily
123 - elif [ -d /etc/periodic/daily ]; then
124 - echo /etc/periodic/daily
125 - else
126 - return 1
127 - fi
128 -
129 - return 0
130 -}
131 -
132 -enable_netdata_updater() {
133 - if [ -n "${1}" ] ; then
134 - updater_type="${1}"
135 - else
136 - updater_type="$(_get_scheduler_type)"
137 - fi
138 -
139 - case "${updater_type}" in
140 - "systemd")
141 - if issystemd; then
142 - systemctl enable netdata-updater.timer
143 -
144 - info "Auto-updating has been ENABLED using a systemd timer unit.\n"
145 - info "If the update process fails, the failure will be logged to the systemd journal just like a regular service failure."
146 - info "Successful updates should produce empty logs."
147 - else
148 - error "Systemd-based auto-update scheduling requested, but this does not appear to be a systemd system."
149 - error "Auto-updates have NOT been enabled."
150 - return 1
151 - fi
152 - ;;
153 - "interval")
154 - if _get_intervaldir > /dev/null; then
155 - ln -sf "${NETDATA_PREFIX}/usr/libexec/netdata/netdata-updater.sh" "$(_get_intervaldir)/netdata-updater"
156 -
157 - info "Auto-updating has been ENABLED through cron, updater script linked to $(_get_intervaldir)/netdata-updater\n"
158 - info "If the update process fails and you have email notifications set up correctly for cron on this system, you should receive an email notification of the failure."
159 - info "Successful updates will not send an email."
160 - else
161 - error "Interval-based auto-update scheduling requested, but I could not find an interval scheduling directory."
162 - error "Auto-updates have NOT been enabled."
163 - return 1
164 - fi
165 - ;;
166 - "crontab")
167 - if [ -d "/etc/cron.d" ]; then
168 - cat "${NETDATA_SOURCE_DIR}/system/netdata.crontab" > "/etc/cron.d/netdata-updater"
169 -
170 - info "Auto-updating has been ENABLED through cron, using a crontab at /etc/cron.d/netdata-updater\n"
171 - info "If the update process fails and you have email notifications set up correctly for cron on this system, you should receive an email notification of the failure."
172 - info "Successful updates will not send an email."
173 - else
174 - error "Crontab-based auto-update scheduling requested, but there is no '/etc/cron.d'."
175 - error "Auto-updates have NOT been enabled."
176 - return 1
177 - fi
178 - ;;
179 - *)
180 - error "Unable to determine what type of auto-update scheduling to use."
181 - error "Auto-updates have NOT been enabled."
182 - return 1
183 - esac
184 -
185 - return 0
186 -}
187 -
188 -disable_netdata_updater() {
189 - if issystemd && ( systemctl list-units --full -all | grep -Fq "netdata-updater.timer" ) ; then
190 - systemctl disable netdata-updater.timer
191 - fi
192 -
193 - if [ -d /etc/cron.daily ]; then
194 - rm -f /etc/cron.daily/netdata-updater.sh
195 - rm -f /etc/cron.daily/netdata-updater
196 - fi
197 -
198 - if [ -d /etc/periodic/daily ]; then
199 - rm -f /etc/periodic/daily/netdata-updater.sh
200 - rm -f /etc/periodic/daily/netdata-updater
201 - fi
202 -
203 - if [ -d /etc/cron.d ]; then
204 - rm -f /etc/cron.d/netdata-updater
205 - fi
206 -
207 - info "Auto-updates have been DISABLED."
208 -
209 - return 0
210 -}
211 -
76 str_in_list() {
77 printf "%s\n" "${2}" | tr ' ' "\n" | grep -qE "^${1}\$"
78 return $?
@@ -720,25 +584,6 @@ while [ -n "${1}" ]; do
584 elif [ "${1}" = "--tmpdir-path" ]; then
585 NETDATA_TMPDIR_PATH="${2}"
586 shift 2
723 - elif [ "${1}" = "--enable-auto-updates" ]; then
724 - AUTO_UPDATE_TYPE="$(echo "${2}" | tr '[:upper:]' '[:lower:]')"
725 - case "${AUTO_UPDATE_TYPE}" in
726 - systemd|interval|crontab)
727 - enable_netdata_updater "${AUTO_UPDATE_TYPE}"
728 - exit $?
729 - ;;
730 - "")
731 - enable_netdata_updater ""
732 - exit $?
733 - ;;
734 - *)
735 - error "Unrecognized updater type ${2} requested. Supported types are 'systemd', 'interval', and 'crontab'."
736 - exit 1
737 - ;;
738 - esac
739 - elif [ "${1}" = "--disable-auto-updates" ]; then
740 - disable_netdata_updater
741 - exit $?
587 else
588 break
589 fi
@@ -808,7 +653,7 @@ case "${INSTALL_TYPE}" in
653 update_legacy
654 ;;
655 custom)
811 - # At this point, we _should_ have a valid `.environment` file, but it's best to just check.
656 + # At this point, we _should_ have a valid `.environment` file, but it0s best to just check.
657 # If we do, then behave like the legacy updater.
658 if [ -n "${RELEASE_CHANNEL}" ] && [ -n "${NETDATA_PREFIX}" ] && [ -n "${REINSTALL_OPTIONS}" ]; then
659 update_legacy
packaging/makeself/install-or-update.sh
+12 -1
@@ -26,6 +26,7 @@ if [ -d /opt/netdata/etc/netdata.old ]; then
26 fi
27
28 STARTIT=1
29 +AUTOUPDATE=0
30 REINSTALL_OPTIONS=""
31 RELEASE_CHANNEL="nightly" # check .travis/create_artifacts.sh before modifying
32
@@ -35,7 +36,10 @@ while [ "${1}" ]; do
36 STARTIT=0
37 REINSTALL_OPTIONS="${REINSTALL_OPTIONS} ${1}"
38 ;;
38 - "--auto-update" | "-u") ;;
39 + "--auto-update" | "-u")
40 + AUTOUPDATE=1
41 + REINSTALL_OPTIONS="${REINSTALL_OPTIONS} ${1}"
42 + ;;
43 "--stable-channel")
44 RELEASE_CHANNEL="stable"
45 REINSTALL_OPTIONS="${REINSTALL_OPTIONS} ${1}"
@@ -157,6 +161,13 @@ progress "Install (but not enable) netdata updater tool"
161 cleanup_old_netdata_updater || run_failed "Cannot cleanup old netdata updater tool."
162 install_netdata_updater || run_failed "Cannot install netdata updater tool."
163
164 +progress "Check if we must enable/disable the netdata updater tool"
165 +if [ "${AUTOUPDATE}" = "1" ]; then
166 + enable_netdata_updater || run_failed "Cannot enable netdata updater tool"
167 +else
168 + disable_netdata_updater || run_failed "Cannot disable netdata updater tool"
169 +fi
170 +
171 # -----------------------------------------------------------------------------
172 progress "creating quick links"
173