mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-03 23:45:59 +00:00
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:
@@ -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
|
||||
|
||||
@@ -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/
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user