fix: write config before applying patches so pveproxy restarts with new settings (#248)

* fix: write config before applying patches so pveproxy restarts with new settings

* write config per mod only

---------

Co-authored-by: Meliox <na>
This commit is contained in:
Meliox 2026-08-08 22:23:25 +02:00 committed by GitHub
parent 6e3fd7958e
commit 552a5c071b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -137,6 +137,8 @@ main() {
msgb "\n=== Node Info Configuration ===" msgb "\n=== Node Info Configuration ==="
node_info_configure node_info_configure
fi fi
# Write before patching so pveproxy restarts with the new config.
write_main_conf; node_info_write_conf
;; ;;
2) 2)
selected_mod="nag_screen" selected_mod="nag_screen"
@ -147,6 +149,8 @@ main() {
info "Subscription nag screen removal will be applied." info "Subscription nag screen removal will be applied."
nag_screen_configure nag_screen_configure
fi fi
# Write before patching so pveproxy restarts with the new config.
write_main_conf; nag_screen_write_conf
;; ;;
3) 3)
if [[ "$PVE_TRIGGER_ENABLED" == "1" ]]; then if [[ "$PVE_TRIGGER_ENABLED" == "1" ]]; then
@ -154,28 +158,25 @@ main() {
else else
PVE_TRIGGER_ENABLED=1; info "Auto re-patching on PVE upgrade enabled." PVE_TRIGGER_ENABLED=1; info "Auto re-patching on PVE upgrade enabled."
fi fi
write_main_conf # no patches for this option
;; ;;
[nN]) info "No option selected. Exiting."; exit 0 ;; [nN]) info "No option selected. Exiting."; exit 0 ;;
*) warn "Invalid selection. Exiting."; exit 0 ;; *) warn "Invalid selection. Exiting."; exit 0 ;;
esac esac
# ── Write config and apply/revert ───────────────────────────────────────── # ── Apply / revert patches ────────────────────────────────────────────────
# For mods with patches: apply if being enabled, revert if being disabled. # Config is already written above; pveproxy will restart with new settings.
# Option 3 (pve_trigger) has no patches — write_main_conf is sufficient.
if [[ "$patching_needed" == "1" ]]; then if [[ "$patching_needed" == "1" ]]; then
msgb "\n=== Applying patches ===" msgb "\n=== Applying patches ==="
if ! "$APPLY_PATCHES" "$selected_mod"; then if ! "$APPLY_PATCHES" "$selected_mod"; then
err "Could not apply all patches for $selected_mod. Configuration was not updated." err "Could not apply all patches for $selected_mod."
fi fi
elif [[ -n "$selected_mod" ]]; then elif [[ -n "$selected_mod" ]]; then
msgb "\n=== Removing patches ===" msgb "\n=== Removing patches ==="
if ! "$REVERT_PATCHES" "$selected_mod"; then if ! "$REVERT_PATCHES" "$selected_mod"; then
err "Could not revert all patches for $selected_mod. Configuration was not updated." err "Could not revert all patches for $selected_mod."
fi fi
fi fi
write_main_conf
node_info_write_conf
nag_screen_write_conf
msgb "\n=== Done ===" msgb "\n=== Done ==="
info "pve-mod is configured and active." info "pve-mod is configured and active."