mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-11-01 10:22:08 +00:00
feat(pbs): post-install menu for Proxmox Backup Server
- Open the post-install menu from the PBS menu - List only the customizable options that apply to PBS - Offer the PBS no-subscription repository through the native repository API - Upgrade PBS with the package list shown before applying it - Remove and restore the subscription notice on the PBS web interface - Install Figurine on PBS without the Proxmox VE aliases - Offer the Helper-Scripts PBS post-install and microcode scripts - Tune firewall bridges after the systemd udev rules in the automated post-install - Add PBS repository policy tests and syntax checks - Document the PBS differences on the post-install page - Use backups in the Spanish PBS update message
This commit is contained in:
@@ -59,7 +59,12 @@ initialize_cache
|
||||
|
||||
if [[ -f "$LOCAL_SCRIPTS/global/platform-functions.sh" ]]; then
|
||||
source "$LOCAL_SCRIPTS/global/platform-functions.sh"
|
||||
pmx_require_pve || exit 1
|
||||
fi
|
||||
# Proxmox Backup Server runs the same host optimizations; repositories,
|
||||
# package upgrade and the subscription notice follow its own tooling.
|
||||
PMX_ON_PBS=false
|
||||
if declare -F pmx_is_pbs >/dev/null && pmx_is_pbs; then
|
||||
PMX_ON_PBS=true
|
||||
fi
|
||||
|
||||
# Global variables
|
||||
@@ -142,6 +147,10 @@ $(translate "Do you want to continue anyway?")" 13 70
|
||||
|
||||
|
||||
apt_upgrade() {
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
bash "$LOCAL_SCRIPTS/global/update-pbs.sh"
|
||||
return
|
||||
fi
|
||||
local pve_version
|
||||
pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+' | head -1)
|
||||
|
||||
@@ -171,6 +180,20 @@ apt_upgrade() {
|
||||
remove_subscription_banner() {
|
||||
local FUNC_VERSION="1.0"
|
||||
# description: Patch the Proxmox web UI to suppress the subscription dialog and register a successful patch.
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
stop_spinner
|
||||
if ! whiptail --title "Proxmox Backup Server Subscription Banner Removal" \
|
||||
--yesno "$(translate "Do you want to remove the Proxmox subscription banner from the Proxmox Backup Server web interface?")\n\n$(translate "Attention: Removing the subscription banner may cause issues in the web interface after a future update.")\n\n$(translate "If this happens, you can restore the backup from the 'Subscription Banner Removal' option in 'Uninstall optimizations'.")\n\n$(translate "Are you sure you want to continue?")" 14 75; then
|
||||
msg_warn "Banner removal cancelled by user."
|
||||
return 1
|
||||
fi
|
||||
if ! bash "$LOCAL_SCRIPTS/global/remove-banner-pve-v3.sh"; then
|
||||
msg_error "$(translate "Subscription banner removal failed")"
|
||||
return 1
|
||||
fi
|
||||
register_tool "subscription_banner" true "$FUNC_VERSION"
|
||||
return 0
|
||||
fi
|
||||
local pve_version
|
||||
pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+' | head -1)
|
||||
|
||||
@@ -225,6 +248,17 @@ setup_proxmox_repositories() {
|
||||
|
||||
msg_info2 "$(translate "Configuring Proxmox APT repositories...")"
|
||||
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
if ! ensure_pbs_repositories; then
|
||||
msg_error "$(translate "Failed to configure Proxmox Backup Server repositories")"
|
||||
register_tool "proxmox_repos" false "$FUNC_VERSION"
|
||||
return 1
|
||||
fi
|
||||
register_tool "proxmox_repos" true "$FUNC_VERSION"
|
||||
msg_success "$(translate "Proxmox Backup Server APT repositories configured")"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! ensure_repositories; then
|
||||
msg_error "$(translate "Failed to configure Proxmox repositories")"
|
||||
register_tool "proxmox_repos" false "$FUNC_VERSION"
|
||||
@@ -524,7 +558,7 @@ force_apt_ipv4() {
|
||||
# ==========================================================
|
||||
|
||||
apply_network_optimizations() {
|
||||
local FUNC_VERSION="1.1"
|
||||
local FUNC_VERSION="1.2"
|
||||
pmx_journal_context "apply_network_optimizations" "$FUNC_VERSION"
|
||||
# description: Tune TCP buffers, somaxconn, IPv4 hardening and disable rp_filter on fw bridges (PVE 9 compatible).
|
||||
msg_info "$(translate "Optimizing network settings...")"
|
||||
@@ -622,14 +656,16 @@ RemainAfterExit=yes
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
pmx_write_file /etc/udev/rules.d/99-proxmenux-fwbr-tune.rules <<'EOF'
|
||||
pmx_remove_file /etc/udev/rules.d/99-proxmenux-fwbr-tune.rules
|
||||
|
||||
pmx_write_file /etc/udev/rules.d/99-zz-proxmenux-fwbr-tune.rules <<'EOF'
|
||||
ACTION=="add", SUBSYSTEM=="net", KERNEL=="fwbr*", RUN+="/usr/local/sbin/proxmenux-fwbr-tune %k"
|
||||
ACTION=="add", SUBSYSTEM=="net", KERNEL=="fwln*", RUN+="/usr/local/sbin/proxmenux-fwbr-tune %k"
|
||||
ACTION=="add", SUBSYSTEM=="net", KERNEL=="fwpr*", RUN+="/usr/local/sbin/proxmenux-fwbr-tune %k"
|
||||
ACTION=="add", SUBSYSTEM=="net", KERNEL=="tap*", RUN+="/usr/local/sbin/proxmenux-fwbr-tune %k"
|
||||
EOF
|
||||
chmod 0644 /etc/udev/rules.d/99-proxmenux-fwbr-tune.rules
|
||||
chown root:root /etc/udev/rules.d/99-proxmenux-fwbr-tune.rules
|
||||
chmod 0644 /etc/udev/rules.d/99-zz-proxmenux-fwbr-tune.rules
|
||||
chown root:root /etc/udev/rules.d/99-zz-proxmenux-fwbr-tune.rules
|
||||
|
||||
systemctl daemon-reload >/dev/null 2>&1 || true
|
||||
udevadm control --reload-rules >/dev/null 2>&1 || true
|
||||
|
||||
@@ -53,7 +53,12 @@ initialize_cache
|
||||
|
||||
if [[ -f "$LOCAL_SCRIPTS/global/platform-functions.sh" ]]; then
|
||||
source "$LOCAL_SCRIPTS/global/platform-functions.sh"
|
||||
pmx_require_pve || exit 1
|
||||
fi
|
||||
# On Proxmox Backup Server the menu lists only the options that apply to
|
||||
# it; repositories, upgrade and the subscription notice use its tooling.
|
||||
PMX_ON_PBS=false
|
||||
if declare -F pmx_is_pbs >/dev/null && pmx_is_pbs; then
|
||||
PMX_ON_PBS=true
|
||||
fi
|
||||
|
||||
# Load shared global functions
|
||||
@@ -122,6 +127,17 @@ setup_proxmox_repositories() {
|
||||
|
||||
msg_info2 "$(translate "Configuring Proxmox APT repositories...")"
|
||||
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
if ! ensure_pbs_repositories; then
|
||||
msg_error "$(translate "Failed to configure Proxmox Backup Server repositories")"
|
||||
register_tool "proxmox_repos" false "$FUNC_VERSION"
|
||||
return 1
|
||||
fi
|
||||
register_tool "proxmox_repos" true "$FUNC_VERSION"
|
||||
msg_success "$(translate "Proxmox Backup Server APT repositories configured")"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! ensure_repositories; then
|
||||
msg_error "$(translate "Failed to configure Proxmox repositories")"
|
||||
register_tool "proxmox_repos" false "$FUNC_VERSION"
|
||||
@@ -248,6 +264,10 @@ EOF
|
||||
|
||||
|
||||
apt_upgrade() {
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
bash "$LOCAL_SCRIPTS/global/update-pbs.sh"
|
||||
return
|
||||
fi
|
||||
local pve_version
|
||||
pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+' | head -1)
|
||||
|
||||
@@ -2376,6 +2396,14 @@ EOF
|
||||
remove_subscription_banner() {
|
||||
local FUNC_VERSION="1.0"
|
||||
# description: Patch the Proxmox web UI to suppress the "no valid subscription" dialog (PVE 8 + 9 variants supported).
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
if ! bash "$LOCAL_SCRIPTS/global/remove-banner-pve-v3.sh"; then
|
||||
msg_error "$(translate "Subscription banner removal failed")"
|
||||
return 1
|
||||
fi
|
||||
register_tool "subscription_banner" true "$FUNC_VERSION"
|
||||
return 0
|
||||
fi
|
||||
local pve_version
|
||||
pve_version=$(pveversion 2>/dev/null | grep -oP 'pve-manager/\K[0-9]+' | head -1)
|
||||
|
||||
@@ -3143,8 +3171,11 @@ EOF
|
||||
}
|
||||
|
||||
|
||||
ensure_aliases
|
||||
msg_ok "$(translate "Aliases added to .bashrc")"
|
||||
# The aliases call Proxmox VE tools.
|
||||
if [[ "$PMX_ON_PBS" != true ]]; then
|
||||
ensure_aliases
|
||||
msg_ok "$(translate "Aliases added to .bashrc")"
|
||||
fi
|
||||
|
||||
msg_success "$(translate "Figurine installation and configuration completed successfully.")"
|
||||
register_tool "figurine" true "$FUNC_VERSION"
|
||||
@@ -3993,6 +4024,19 @@ main_menu() {
|
||||
"Optional|Install and configure Log2RAM|LOG2RAM"
|
||||
)
|
||||
|
||||
if [[ "$PMX_ON_PBS" == true ]]; then
|
||||
local -A pve_only=(
|
||||
[GUESTAGENT]=1 [VFIO_IOMMU]=1 [OPENVSWITCH]=1 [VZDUMP]=1 [PVEAM]=1
|
||||
[CEPH]=1 [ENABLE_HA]=1 [OVHRTM]=1 [PIGZ]=1
|
||||
)
|
||||
local pbs_options=() option_key
|
||||
for option in "${options[@]}"; do
|
||||
option_key="${option##*|}"
|
||||
[[ -n "${pve_only[$option_key]:-}" ]] || pbs_options+=("$option")
|
||||
done
|
||||
options=("${pbs_options[@]}")
|
||||
fi
|
||||
|
||||
IFS=$'\n' sorted_options=($(for option in "${options[@]}"; do
|
||||
IFS='|' read -r category description function_name <<< "$option"
|
||||
printf "%d|%s|%s|%s\n" "${category_order[$category]:-999}" "$category" "$description" "$function_name"
|
||||
|
||||
@@ -266,6 +266,12 @@ uninstall_subscription_banner() {
|
||||
fi
|
||||
fi
|
||||
|
||||
# Proxmox Backup Server ships the same widget toolkit without the PVE packages.
|
||||
local -a ui_packages=(pve-manager proxmox-widget-toolkit libjs-extjs libpve-http-server-perl)
|
||||
if [[ "$(dpkg-query -W -f='${Status}' proxmox-backup-server 2>/dev/null)" == "install ok installed" ]]; then
|
||||
ui_packages=(proxmox-widget-toolkit libjs-extjs)
|
||||
fi
|
||||
|
||||
if [[ "$restored" == false ]]; then
|
||||
msg_info "$(translate "Performing complete package reinstallation...")"
|
||||
|
||||
@@ -274,7 +280,7 @@ uninstall_subscription_banner() {
|
||||
|
||||
# Reinstall packages with force-confnew to restore original configs
|
||||
if apt-get --reinstall -o Dpkg::Options::="--force-confnew" install \
|
||||
pve-manager proxmox-widget-toolkit libjs-extjs libpve-http-server-perl -y >/dev/null 2>&1; then
|
||||
"${ui_packages[@]}" -y >/dev/null 2>&1; then
|
||||
msg_ok "$(translate "Reinstalled Proxmox packages successfully")"
|
||||
restored=true
|
||||
else
|
||||
@@ -286,7 +292,7 @@ uninstall_subscription_banner() {
|
||||
|
||||
# Second pass reinstallation to ensure everything is clean
|
||||
apt-get update >/dev/null 2>&1
|
||||
apt-get --reinstall install proxmox-widget-toolkit pve-manager libjs-extjs libpve-http-server-perl -y >/dev/null 2>&1 || true
|
||||
apt-get --reinstall install "${ui_packages[@]}" -y >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
msg_info "$(translate "Cleaning cached files...")"
|
||||
|
||||
Reference in New Issue
Block a user