@cryptotaxi247 / netdata-1 / commits / e2063caa0

Provide necessary permission for the kickstart to run the netdata-updater script (#15132)

Signed-off-by: Tasos Katsoulas <tasos@netdata.cloud> Co-authored-by: Austin S. Hemmelgarn <austin@netdata.cloud>

Tasos Katsoulas committed Jun 2, 2023 at 11:17 UTC e2063caa04f026866514f368b2f72b9741405e45
1 file changed +4 -4
packaging/installer/kickstart.sh
+4 -4
@@ -745,7 +745,7 @@ confirm() {
745 update() {
746 updater="${ndprefix}/usr/libexec/netdata/netdata-updater.sh"
747
748 - if [ -x "${updater}" ]; then
748 + if run_as_root test -x "${updater}"; then
749 if [ "${DRY_RUN}" -eq 1 ]; then
750 progress "Would attempt to update existing installation by running the updater script located at: ${updater}"
751 return 0
@@ -1204,9 +1204,9 @@ claim() {
1204 # ======================================================================
1205 # Auto-update handling code.
1206 set_auto_updates() {
1207 - if [ -x "${INSTALL_PREFIX}/usr/libexec/netdata/netdata-updater.sh" ]; then
1207 + if run_as_root test -x "${INSTALL_PREFIX}/usr/libexec/netdata/netdata-updater.sh"; then
1208 updater="${INSTALL_PREFIX}/usr/libexec/netdata/netdata-updater.sh"
1209 - elif [ -x "${INSTALL_PREFIX}/netdata/usr/libexec/netdata/netdata-updater.sh" ]; then
1209 + elif run_as_root test -x "${INSTALL_PREFIX}/netdata/usr/libexec/netdata/netdata-updater.sh"; then
1210 updater="${INSTALL_PREFIX}/netdata/usr/libexec/netdata/netdata-updater.sh"
1211 else
1212 warning "Could not find netdata-updater.sh. This means that auto-updates cannot (currently) be enabled on this system. See https://learn.netdata.cloud/docs/agent/packaging/installer/update for more information about updating Netdata."
@@ -1217,7 +1217,7 @@ set_auto_updates() {
1217 if [ "${DRY_RUN}" -eq 1 ]; then
1218 progress "Would have attempted to enable automatic updates."
1219 # 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.
1220 - elif ! grep -q '\-\-enable-auto-updates' "${updater}"; then
1220 + elif ! run_as_root grep -q '\-\-enable-auto-updates' "${updater}"; then
1221 echo
1222 elif ! run_as_root "${updater}" --enable-auto-updates "${NETDATA_AUTO_UPDATE_TYPE}"; then
1223 warning "Failed to enable auto updates. Netdata will still work, but you will need to update manually."