mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2025-08-13 08:22:22 +00:00
Update remove-banner-pve8.sh
This commit is contained in:
parent
eecf7a2194
commit
b0d5562917
@ -31,12 +31,13 @@ remove_subscription_banner_pve8() {
|
||||
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 +%F_%T)"
|
||||
|
||||
local pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+\.[0-9]+' | head -1)
|
||||
local pve_major=$(echo "$pve_version" | cut -d. -f1)
|
||||
|
||||
if [[ "$pve_major" -ge 9 ]]; then
|
||||
msg_error "This script is for PVE 8.x only. Detected PVE $pve_version"
|
||||
if [[ "$pve_major" -ne 8 ]]; then
|
||||
msg_error "This script is only for Proxmox VE 8.x. Detected: $pve_version"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@ -47,17 +48,22 @@ remove_subscription_banner_pve8() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
cp "$JS_FILE" "${JS_FILE}.bak.$(date +%s)"
|
||||
cp "$JS_FILE" "$BACKUP_FILE"
|
||||
|
||||
|
||||
sed -i "s/No valid subscription/Subscription active/g" "$JS_FILE"
|
||||
sed -i "s/Ext.Msg.WARNING/Ext.Msg.INFO/g" "$JS_FILE"
|
||||
sed -i "s/res.data.status.toLowerCase() !== 'active'/false/g" "$JS_FILE"
|
||||
sed -i "s/subscriptionActive: ''/subscriptionActive: true/g" "$JS_FILE"
|
||||
|
||||
[[ -f "$GZ_FILE" ]] && rm -f "$GZ_FILE"
|
||||
[[ -f "$APT_HOOK" ]] && rm -f "$APT_HOOK"
|
||||
|
||||
find /var/cache/pve-manager/ -name "*.js*" -delete 2>/dev/null || true
|
||||
find /var/lib/pve-manager/ -name "*.js*" -delete 2>/dev/null || true
|
||||
|
||||
[[ -f "$APT_HOOK" ]] && rm -f "$APT_HOOK"
|
||||
|
||||
|
||||
msg_ok "Subscription banner removed successfully."
|
||||
|
||||
register_tool "subscription_banner" true
|
||||
@ -65,8 +71,6 @@ remove_subscription_banner_pve8() {
|
||||
|
||||
|
||||
|
||||
|
||||
# Execute function if called directly
|
||||
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
||||
remove_subscription_banner_pve8
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user