From 78c8933855a0fa11d04ba9209d3774677cdedea7 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Thu, 16 Oct 2025 17:03:35 +0200 Subject: [PATCH] Disable 'pve-enterprise' and 'ceph enterprise' repositories using 'Enabled: false' instead of commenting out lines; add 'Enabled: false' to new repository entries. (#8399) --- tools/pve/post-pbs-install.sh | 30 +++++++++++++++--------- tools/pve/post-pve-install.sh | 44 +++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 23 deletions(-) diff --git a/tools/pve/post-pbs-install.sh b/tools/pve/post-pbs-install.sh index 350bd3600..edb4a05d6 100644 --- a/tools/pve/post-pbs-install.sh +++ b/tools/pve/post-pbs-install.sh @@ -204,7 +204,13 @@ You normally need a valid subscription for this. Disable it (recommended)?" 14 58 2 "yes" " " "no" " " 3>&2 2>&1 1>&3) case $CHOICE in yes) - sed -i '/pbs-enterprise/ s/^/# /' /etc/apt/sources.list.d/pbs-enterprise.sources + msg_info "Disabling 'pbs-enterprise' repository" + # Use Enabled: false instead of commenting to avoid malformed entry + if grep -q "^Enabled:" /etc/apt/sources.list.d/pbs-enterprise.sources 2>/dev/null; then + sed -i 's/^Enabled:.*/Enabled: false/' /etc/apt/sources.list.d/pbs-enterprise.sources + else + echo "Enabled: false" >>/etc/apt/sources.list.d/pbs-enterprise.sources + fi msg_ok "Disabled 'pbs-enterprise' repository" ;; no) @@ -213,11 +219,12 @@ Disable it (recommended)?" 14 58 2 "yes" " " "no" " " 3>&2 2>&1 1>&3) esac else cat >/etc/apt/sources.list.d/pbs-enterprise.sources </etc/apt/sources.list.d/pbs-test.sources <>"$file" + fi fi done msg_ok "Disabled 'pve-enterprise' repository" @@ -346,10 +350,15 @@ EOF msg_ok "Kept 'ceph enterprise' repository" ;; disable) - msg_info "Disabling (commenting) 'ceph enterprise' repository" + msg_info "Disabling 'ceph enterprise' repository" + # Use Enabled: false instead of commenting to avoid malformed entry for file in /etc/apt/sources.list.d/*.sources; do if grep -q "enterprise.proxmox.com.*ceph" "$file"; then - sed -i '/^\s*Types:/,/^$/s/^\([^#].*\)$/# \1/' "$file" + if grep -q "^Enabled:" "$file"; then + sed -i 's/^Enabled:.*/Enabled: false/' "$file" + else + echo "Enabled: false" >>"$file" + fi fi done msg_ok "Disabled 'ceph enterprise' repository" @@ -472,7 +481,17 @@ EOF ;; no) msg_error "Selected no to Adding 'ceph package repositories'" - find /etc/apt/sources.list.d/ -type f \( -name "*.sources" -o -name "*.list" \) \ + # Use Enabled: false for .sources files, comment for .list files + for file in /etc/apt/sources.list.d/*.sources; do + if grep -q "enterprise.proxmox.com.*ceph" "$file" 2>/dev/null; then + if grep -q "^Enabled:" "$file"; then + sed -i 's/^Enabled:.*/Enabled: false/' "$file" + else + echo "Enabled: false" >>"$file" + fi + fi + done + find /etc/apt/sources.list.d/ -type f -name "*.list" \ -exec sed -i '/enterprise.proxmox.com.*ceph/s/^/# /' {} \; msg_ok "Disabled all Ceph Enterprise repositories" ;; @@ -491,11 +510,12 @@ EOF yes) msg_info "Adding 'pve-test' repository (deb822, disabled)" cat >/etc/apt/sources.list.d/pve-test.sources <