mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-07-23 15:06:53 +00:00
Update customizable_post_install.sh
This commit is contained in:
parent
1b8fb766a8
commit
98a9225c32
@ -2391,13 +2391,10 @@ EOF
|
|||||||
|
|
||||||
remove_subscription_banner() {
|
remove_subscription_banner() {
|
||||||
msg_info2 "$(translate "Checking Proxmox subscription banner and nag status...")"
|
msg_info2 "$(translate "Checking Proxmox subscription banner and nag status...")"
|
||||||
|
|
||||||
local JS_FILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
|
local JS_FILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
|
||||||
local GZ_FILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz"
|
local GZ_FILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz"
|
||||||
local APT_HOOK="/etc/apt/apt.conf.d/no-nag-script"
|
local APT_HOOK="/etc/apt/apt.conf.d/no-nag-script"
|
||||||
local BACKUP_FILE="${JS_FILE}.bak.$(date +%Y-%m-%d_%H:%M:%S)"
|
|
||||||
|
|
||||||
local PVE_VERSION=$(pveversion | grep "pve-manager" | cut -d'/' -f2)
|
|
||||||
|
|
||||||
|
|
||||||
if ! whiptail --title "Proxmox Subscription Banner" \
|
if ! whiptail --title "Proxmox Subscription Banner" \
|
||||||
@ -2406,11 +2403,11 @@ remove_subscription_banner() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove ALL existing nag-related APT hooks
|
|
||||||
for f in /etc/apt/apt.conf.d/*nag*; do
|
for f in /etc/apt/apt.conf.d/*nag*; do
|
||||||
[[ -e "$f" ]] && rm -f "$f"
|
[[ -e "$f" ]] && rm -f "$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
msg_info "Applying patches to remove subscription banner..."
|
msg_info "Applying patches to remove subscription banner..."
|
||||||
|
|
||||||
sed -i "s/res\.data\.status\.toLowerCase() !== 'NoMoreNagging'/false/g" "$JS_FILE"
|
sed -i "s/res\.data\.status\.toLowerCase() !== 'NoMoreNagging'/false/g" "$JS_FILE"
|
||||||
@ -2443,9 +2440,7 @@ remove_subscription_banner() {
|
|||||||
cat > "$APT_HOOK" << 'EOF'
|
cat > "$APT_HOOK" << 'EOF'
|
||||||
DPkg::Post-Invoke {
|
DPkg::Post-Invoke {
|
||||||
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/res\.data\.status\.toLowerCase() !== '\''NoMoreNagging'\''/false/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/res\.data\.status\.toLowerCase() !== '\''NoMoreNagging'\''/false/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
||||||
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/res\.data\.status\.toLowerCase() !== \"NoMoreNagging\"/false/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
|
||||||
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/res\.data\.status\.toLowerCase() !== '\''active'\''/false/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/res\.data\.status\.toLowerCase() !== '\''active'\''/false/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
||||||
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/res\.data\.status !== '\''Active'\''/false/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
|
||||||
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/subscription = !(/subscription = false \&\& (/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js && sed -i 's/subscription = !(/subscription = false \&\& (/g' /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js";
|
||||||
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz && rm -f /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz";
|
"test -e /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz && rm -f /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz";
|
||||||
};
|
};
|
||||||
@ -2454,7 +2449,20 @@ EOF
|
|||||||
chmod 644 "$APT_HOOK"
|
chmod 644 "$APT_HOOK"
|
||||||
|
|
||||||
apt --reinstall install proxmox-widget-toolkit -y > /dev/null 2>&1
|
apt --reinstall install proxmox-widget-toolkit -y > /dev/null 2>&1
|
||||||
msg_ok "Subscription banner patches applied successfully for Proxmox $PVE_VERSION. Clear your browser cache."
|
|
||||||
|
local changes_applied=0
|
||||||
|
if ! grep -q "res\.data\.status\.toLowerCase() !== 'NoMoreNagging'" "$JS_FILE"; then
|
||||||
|
((changes_applied++))
|
||||||
|
fi
|
||||||
|
if ! grep -q "title: gettext('No valid subscription')" "$JS_FILE"; then
|
||||||
|
((changes_applied++))
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $changes_applied -gt 0 ]]; then
|
||||||
|
msg_ok "Subscription banner removed successfully."
|
||||||
|
else
|
||||||
|
msg_warn "Patches may not have been applied correctly. Please verify manually."
|
||||||
|
fi
|
||||||
msg_success "$(translate "Subscription banner and nag removal process completed")"
|
msg_success "$(translate "Subscription banner and nag removal process completed")"
|
||||||
register_tool "subscription_banner" true
|
register_tool "subscription_banner" true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user