From 9578c6fa9140a8cd250d2422383ff834b9552745 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Sat, 2 May 2026 12:06:16 +0200 Subject: [PATCH] =?UTF-8?q?core:=20prompt=20to=20also=20run=20installed=20?= =?UTF-8?q?addon=20update=20scripts=20(=E2=80=A6/bin/update=5F*)=20after?= =?UTF-8?q?=20update=5Fscript=20(#14162)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- misc/build.func | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/misc/build.func b/misc/build.func index dfb21213d..20601dccc 100644 --- a/misc/build.func +++ b/misc/build.func @@ -3504,6 +3504,52 @@ msg_menu() { return 0 } +# ------------------------------------------------------------------------------ +# run_addon_updates() +# +# - Scans /usr/local/bin/update_* for addon update scripts installed alongside +# the main application (e.g. by tools/addon/*.sh) +# - For each found addon, prompts the user (60s timeout, default no) whether +# it should be updated as well +# - Skipped entirely when PHS_SILENT=1 to keep unattended updates predictable +# ------------------------------------------------------------------------------ +run_addon_updates() { + shopt -s nullglob + local addons=(/usr/local/bin/update_*) + shopt -u nullglob + + ((${#addons[@]} == 0)) && return 0 + + if [[ "${PHS_SILENT:-0}" == "1" ]]; then + msg_info "Detected ${#addons[@]} addon update script(s) - skipping (PHS_SILENT)" + return 0 + fi + + echo + echo -e "${INFO}${YW} Detected installed addon update script(s):${CL}" + local a name + for a in "${addons[@]}"; do + echo -e "${TAB}- ${a##*/update_}" + done + echo + + local ans + for a in "${addons[@]}"; do + name="${a##*/update_}" + printf 'Do you also want to update addon "%s"? (y/N) [60s]: ' "$name" + ans="" + if read -r -t 60 ans; then :; else echo; fi + case "${ans,,}" in + y | yes) + bash "$a" || msg_warn "Addon update for $name failed (rc=$?)" + ;; + *) + msg_info "Skipped addon: $name" + ;; + esac + done +} + # ------------------------------------------------------------------------------ # start() # @@ -3523,6 +3569,7 @@ start() { ensure_profile_loaded get_lxc_ip update_script + run_addon_updates update_motd_ip cleanup_lxc else @@ -3551,6 +3598,7 @@ start() { ensure_profile_loaded get_lxc_ip update_script + run_addon_updates update_motd_ip cleanup_lxc fi