Fix nag detection: check for community-scripts dpkg hook and pve-nag-buster
The previous detection only checked for void({ in proxmoxlib.js, which
is the manual sed method. The community-scripts post-install uses a
different approach: a persistent dpkg hook (/etc/apt/apt.conf.d/no-nag-script)
that calls /usr/local/bin/pve-remove-nag.sh after every package update.
That script patches data.status lines from "!== 'active'" to
"== 'NoMoreNagging'".
Now checks (in order):
1. Community-scripts hook files (no-nag-script, pve-remove-nag.sh)
2. pve-nag-buster dpkg hooks
3. void({ JS patch (manual method)
4. Nag text removed entirely
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
9a87261823
commit
68daf96e61
|
|
@ -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---'
|
||||
|
|
|
|||
Loading…
Reference in New Issue