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
d2499ad157
commit
fab3f0630c
@ -2306,7 +2306,7 @@ 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"
|
||||||
@ -2389,6 +2389,79 @@ EOF
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
remove_subscription_banner() {
|
||||||
|
msg_info2 "$(translate "Checking Proxmox subscription banner and nag status...")"
|
||||||
|
|
||||||
|
local JS_FILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js"
|
||||||
|
local GZ_FILE="/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz"
|
||||||
|
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" \
|
||||||
|
--yesno "Do you want to remove the Proxmox subscription banner from the web interface?" 10 60; then
|
||||||
|
msg_warn "Banner removal cancelled by user."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Remove ALL existing nag-related APT hooks
|
||||||
|
for f in /etc/apt/apt.conf.d/*nag*; do
|
||||||
|
[[ -e "$f" ]] && rm -f "$f"
|
||||||
|
done
|
||||||
|
|
||||||
|
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"
|
||||||
|
sed -i "s/res\.data\.status\.toLowerCase() !== 'active'/false/g" "$JS_FILE"
|
||||||
|
sed -i "s/res\.data\.status !== 'Active'/false/g" "$JS_FILE"
|
||||||
|
sed -i "s/subscription = !(/subscription = false \&\& (/g" "$JS_FILE"
|
||||||
|
|
||||||
|
sed -i '/checked_command: function/,/},$/c\
|
||||||
|
checked_command: function (orig_cmd) {\
|
||||||
|
orig_cmd();\
|
||||||
|
},' "$JS_FILE"
|
||||||
|
|
||||||
|
sed -i "s/title: gettext('No valid subscription')/title: gettext('Subscription Active')/g" "$JS_FILE"
|
||||||
|
sed -i "s/icon: Ext\.Msg\.WARNING/icon: Ext.Msg.INFO/g" "$JS_FILE"
|
||||||
|
|
||||||
|
sed -i '/check_subscription: function/,/},$/c\
|
||||||
|
check_subscription: function () {\
|
||||||
|
let me = this;\
|
||||||
|
let vm = me.getViewModel();\
|
||||||
|
vm.set("subscriptionActive", true);\
|
||||||
|
me.getController().updateState();\
|
||||||
|
},' "$JS_FILE"
|
||||||
|
|
||||||
|
[[ -f "$GZ_FILE" ]] && rm -f "$GZ_FILE"
|
||||||
|
|
||||||
|
find /var/cache/pve-manager/ -name "*.js*" -delete 2>/dev/null || true
|
||||||
|
find /var/lib/pve-manager/ -name "*.js*" -delete 2>/dev/null || true
|
||||||
|
|
||||||
|
cat > "$APT_HOOK" << 'EOF'
|
||||||
|
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() !== '\''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.gz && rm -f /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js.gz";
|
||||||
|
};
|
||||||
|
EOF
|
||||||
|
|
||||||
|
chmod 644 "$APT_HOOK"
|
||||||
|
|
||||||
|
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."
|
||||||
|
msg_success "$(translate "Subscription banner and nag removal process completed")"
|
||||||
|
register_tool "subscription_banner" true
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# ==========================================================
|
# ==========================================================
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user