#!/bin/bash # Install the subscription-nag patch (lib/nag-patch.sh) as a persistent # standalone script under /usr/local/sbin, plus an apt Post-Invoke hook that # re-applies it after every dpkg run - a proxmox-widget-toolkit package # upgrade overwrites the patched file, so without the hook the patch would # silently revert on the next `apt upgrade`. # # Idempotent - safe to re-run. Run as root on the PVE host. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source=lib/common.sh source "${SCRIPT_DIR}/lib/common.sh" require_root INSTALLED="/usr/local/sbin/pve-disable-subscription-nag.sh" write_if_changed "$INSTALLED" "$(cat "${SCRIPT_DIR}/lib/nag-patch.sh")" chmod +x "$INSTALLED" HOOK="/etc/apt/apt.conf.d/85pve-nosubnag" write_if_changed "$HOOK" 'DPkg::Post-Invoke { "test -x /usr/local/sbin/pve-disable-subscription-nag.sh && /usr/local/sbin/pve-disable-subscription-nag.sh || true"; };' "$INSTALLED" echo "Subscription nag patch installed; will reapply automatically after updates."