diff --git a/hetzner/proxmox-setup b/hetzner/proxmox-setup index 8106a51..c4ac4c7 100755 --- a/hetzner/proxmox-setup +++ b/hetzner/proxmox-setup @@ -419,22 +419,30 @@ if grep -rq 'pve-no-subscription' /etc/apt/sources.list.d/ 2>/dev/null; then fi echo "$nosub" echo '---NAG_PATCHED---' -# Check if the subscription nag popup needs patching. -# PVE 9.x changed the JS logic so the nag never triggers even without -# patching (the condition checks for 'NoMoreNagging' which never matches). -# PVE 8.x needs the void({ patch to suppress it. -pve_major=$(pvesh get /version --output-format json 2>/dev/null \ - | python3 -c 'import sys,json; print(json.load(sys.stdin)["version"].split(".")[0])' 2>/dev/null \ - || echo '8') -if [ "$pve_major" -ge 9 ] 2>/dev/null; then - echo 'yes' # PVE 9+ nag is effectively disabled +# Detect whether the subscription nag popup has been removed. +# Methods vary by tool and PVE version: +# 1. community-scripts post-install: installs a dpkg hook that patches +# proxmoxlib.js after every update, changing "!== 'active'" to +# "== 'NoMoreNagging'" on data.status lines. Leaves behind: +# - /etc/apt/apt.conf.d/no-nag-script (dpkg hook) +# - /usr/local/bin/pve-remove-nag.sh (the patcher) +# 2. pve-nag-buster: similar dpkg hook approach +# 3. Manual sed: replaces Ext.Msg.show with void({ +nag_patched='no' +# Check for persistent dpkg hook (community-scripts / pve-nag-buster) +if [ -f /etc/apt/apt.conf.d/no-nag-script ] || [ -f /usr/local/bin/pve-remove-nag.sh ]; then + nag_patched='yes' +# Check for pve-nag-buster package hook +elif ls /etc/dpkg/dpkg.cfg.d/*nag* /etc/apt/apt.conf.d/*nag-buster* 2>/dev/null | grep -q .; then + nag_patched='yes' +# Check JS for void({ patch (manual sed method) elif grep -q 'void({' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 2>/dev/null; then - echo 'yes' # PVE 8 with JS patch applied + nag_patched='yes' +# Check if nag text was removed entirely elif ! grep -q "No valid subscription" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js 2>/dev/null; then - echo 'yes' # nag text removed entirely -else - echo 'no' + nag_patched='yes' fi +echo "$nag_patched" echo '---UPGRADABLE---' apt list --upgradable 2>/dev/null | grep -c upgradable || true echo '---VMBR1---'