Disable 'pve-enterprise' and 'ceph enterprise' repositories using 'Enabled: false' instead of commenting out lines; add 'Enabled: false' to new repository entries. (#8399)

This commit is contained in:
CanbiZ 2025-10-16 17:03:35 +02:00 committed by GitHub
parent c16e187f36
commit 78c8933855
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 23 deletions

View File

@ -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 <<EOF
# Types: deb
# URIs: https://enterprise.proxmox.com/debian/pbs
# Suites: trixie
# Components: pbs-enterprise
# Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
Types: deb
URIs: https://enterprise.proxmox.com/debian/pbs
Suites: trixie
Components: pbs-enterprise
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
Enabled: false
EOF
msg_ok "Added 'pbs-enterprise' repository (disabled)"
fi
@ -239,11 +246,12 @@ EOF
# --- Test repo (pbs-test, renamed) ---
if ! component_exists_in_sources "pbs-test"; then
cat >/etc/apt/sources.list.d/pbs-test.sources <<EOF
# Types: deb
# URIs: http://download.proxmox.com/debian/pbs
# Suites: trixie
# Components: pbs-test
# Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
Types: deb
URIs: http://download.proxmox.com/debian/pbs
Suites: trixie
Components: pbs-test
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
Enabled: false
EOF
msg_ok "Added 'pbs-test' repository (disabled)"
else

View File

@ -197,7 +197,7 @@ start_routines_9() {
# Check sources.list
if [[ -f "$listfile" ]] && grep -qE '^\s*deb ' "$listfile"; then
(( ++LEGACY_COUNT ))
((++LEGACY_COUNT))
fi
# Check .list files
@ -289,11 +289,15 @@ EOF
msg_ok "Kept 'pve-enterprise' repository"
;;
disable)
msg_info "Disabling (commenting) 'pve-enterprise' repository"
# Comment out every non-comment line in the file that has 'pve-enterprise' in Components
msg_info "Disabling 'pve-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 "Components:.*pve-enterprise" "$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 '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 <<EOF
# Types: deb
# URIs: http://download.proxmox.com/debian/pve
# Suites: trixie
# Components: pve-test
# Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
Types: deb
URIs: http://download.proxmox.com/debian/pve
Suites: trixie
Components: pve-test
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
Enabled: false
EOF
msg_ok "Added 'pve-test' repository"
;;