Created
June 24, 2023 16:18
-
-
Save TimJDFletcher/0dd6c1deeaf549cdaf60ad0f003e531d to your computer and use it in GitHub Desktop.
Upgrading Debian again
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eux -o pipefail | |
# Remove old pi packages list | |
sudo rm -f /etc/apt/apt.conf.d/99rpimonitor /etc/apt/sources.list.d/rpi-monitor.list | |
# Replace version name in all source lists and fix up naming | |
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/* /etc/apt/sources.list | |
sudo sed -i '/debian-security\//b; s/\/debian-security/\/debian-security\//g' /etc/apt/sources.list.d/* /etc/apt/sources.list | |
sudo sed -i '/security/ s,bookworm/updates,bookworm-security,g' /etc/apt/sources.list.d/* /etc/apt/sources.list | |
sudo sed -i '/non-free/ s/\(non-free\)\(.*\)\bnon-free-firmware\b/\1\2 non-free-firmware/' /etc/apt/sources.list.d/* /etc/apt/sources.list | |
# Update package lists | |
sudo apt update | |
# Upgrade openssh and apt first to avoid bugs | |
# https://www.debian.org/releases/stable/amd64/release-notes/ch-information.en.html#ssh-not-available | |
sudo apt --yes install openssh-server apt | |
# Run the upgrade | |
sudo apt --yes dist-upgrade | |
# Remove unneeded packages | |
sudo apt --yes autoremove | |
# Remove orphan packages | |
sudo apt --yes install deborphan aptitude | |
sudo aptitude purge ~o | |
deborphan --guess-all | xargs sudo apt --yes remove | |
sudo apt autoremove | |
sudo apt clean |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment