fix(pbs/pve): guard sed against missing /etc/apt/sources.list

PBS 4.x and fresh PVE 9 / Trixie installs no longer ship
/etc/apt/sources.list (deb822 only). Running 'sed -i ... /etc/apt/sources.list || true'
suppresses the exit code but still prints the noisy stderr message
'sed: can't read /etc/apt/sources.list: No such file or directory'
during the post-install routine.

Wrap the call with an existence check so the sed step is skipped cleanly
when the legacy file is absent.

Fixes #14174
This commit is contained in:
MickLesk
2026-05-03 21:04:22 +02:00
parent 980fa9fbb0
commit c3a5abfa0b
3 changed files with 10 additions and 4 deletions
+3 -1
View File
@@ -57,7 +57,9 @@ start_routines() {
yes)
msg_info "Switching to Debian 13 (Trixie) Sources"
rm -f /etc/apt/sources.list.d/*.list
sed -i '/proxmox/d;/bookworm/d' /etc/apt/sources.list || true
if [ -f /etc/apt/sources.list ]; then
sed -i '/proxmox/d;/bookworm/d' /etc/apt/sources.list
fi
cat >/etc/apt/sources.list.d/debian.sources <<EOF
Types: deb
URIs: http://deb.debian.org/debian
+3 -1
View File
@@ -188,7 +188,9 @@ start_routines_4() {
yes)
msg_info "Correcting Debian Sources (deb822)"
rm -f /etc/apt/sources.list.d/*.list
sed -i '/proxmox/d;/bookworm/d' /etc/apt/sources.list || true
if [ -f /etc/apt/sources.list ]; then
sed -i '/proxmox/d;/bookworm/d' /etc/apt/sources.list
fi
cat >/etc/apt/sources.list.d/debian.sources <<EOF
Types: deb
URIs: http://deb.debian.org/debian/
+4 -2
View File
@@ -251,8 +251,10 @@ start_routines_9() {
msg_info "Correcting Proxmox VE Sources (deb822)"
# remove all existing .list files
rm -f /etc/apt/sources.list.d/*.list
# remove bookworm and proxmox entries from sources.list
sed -i '/proxmox/d;/bookworm/d' /etc/apt/sources.list || true
# remove bookworm and proxmox entries from sources.list (if it exists)
if [ -f /etc/apt/sources.list ]; then
sed -i '/proxmox/d;/bookworm/d' /etc/apt/sources.list
fi
# Create new deb822 sources
cat >/etc/apt/sources.list.d/debian.sources <<EOF
Types: deb