mirror of
https://github.com/wickedyoda/public-setupfiles.git
synced 2026-11-16 13:31:56 -06:00
Merge pull request #25 from wickedyoda/debian-upgrade-12-13
Update dist-upgrade.sh
This commit is contained in:
1 file changed
+45
-30
@@ -1,43 +1,58 @@
|
|||||||
# /bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Backup of existing sources.list file
|
# Backup existing sources
|
||||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
|
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup.$(date +%F-%H%M)
|
||||||
|
|
||||||
# Create variable from /etc/os-release file to get ID
|
# Detect OS ID and VERSION_CODENAME
|
||||||
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release)
|
ID=$(grep -oP '(?<=^ID=).+' /etc/os-release)
|
||||||
|
CODENAME=$(grep -oP '(?<=^VERSION_CODENAME=).+' /etc/os-release)
|
||||||
|
|
||||||
|
echo "Detected OS: $ID"
|
||||||
|
echo "Detected Codename: $CODENAME"
|
||||||
|
|
||||||
|
# Debian Only
|
||||||
if [ "$ID" == "debian" ]; then
|
if [ "$ID" == "debian" ]; then
|
||||||
echo "ID_LIKE is debian"
|
echo "Debian system detected."
|
||||||
echo "Updating sources.list file"
|
|
||||||
echo "deb http://deb.debian.org/debian/ bookworm main contrib non-free" | sudo tee /etc/apt/sources.list
|
# Check if we're on Bookworm
|
||||||
echo "deb-src http://deb.debian.org/debian/ bookworm main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
if [ "$CODENAME" != "bookworm" ]; then
|
||||||
echo "deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
echo "This script only upgrades Debian 12 (Bookworm). Current version is: $CODENAME"
|
||||||
echo "deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
exit 1
|
||||||
echo "deb http://deb.debian.org/debian/ bookworm-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
fi
|
||||||
echo "deb-src http://deb.debian.org/debian/ bookworm-backports main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb http://security.debian.org/debian-security/ bookworm-security main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
echo "Upgrading Debian 12 → Debian 13 (Trixie)..."
|
||||||
echo "deb-src http://security.debian.org/debian-security/ bookworm-security main contrib non-free" | sudo tee -a /etc/apt/sources.list
|
echo "Updating sources.list to Trixie..."
|
||||||
|
|
||||||
|
sudo tee /etc/apt/sources.list >/dev/null << EOF
|
||||||
|
deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware
|
||||||
|
deb-src http://deb.debian.org/debian trixie main contrib non-free non-free-firmware
|
||||||
|
|
||||||
|
deb http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
|
||||||
|
deb-src http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
|
||||||
|
|
||||||
|
deb http://deb.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
|
||||||
|
deb-src http://deb.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
|
||||||
|
EOF
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "This script only supports Debian. Exiting."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ID" == "ubuntu" ]; then
|
echo "=== Running apt update ==="
|
||||||
echo "ID_LIKE is ubuntu"
|
|
||||||
echo "Updating sources.list file"
|
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur restricted universe multiverse" | sudo tee /etc/apt/sources.list
|
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb http://archive.ubuntu.com/ubuntu/ Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
echo "deb http://security.ubuntu.com/ubuntu Minotaur main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
# update repositories
|
|
||||||
sudo apt update
|
sudo apt update
|
||||||
|
|
||||||
# Full upgrade of system
|
echo "=== Starting full upgrade ==="
|
||||||
sudo apt full-upgrade -y && sudo apt dist-upgrade -y
|
sudo apt full-upgrade -y
|
||||||
|
sudo apt dist-upgrade -y
|
||||||
|
|
||||||
# Clean up system
|
echo "=== Cleaning system ==="
|
||||||
sudo apt autoremove -y
|
sudo apt autoremove -y
|
||||||
sudo apt clean -y
|
sudo apt clean -y
|
||||||
sudo apt autopurge -y
|
sudo apt autopurge -y
|
||||||
|
|
||||||
echo "System update and cleanup complete!"
|
echo ""
|
||||||
|
echo "======================================================"
|
||||||
|
echo " Debian upgrade to TRIXIE is complete!"
|
||||||
|
echo " It is recommended to reboot now: sudo reboot"
|
||||||
|
echo "======================================================"
|
||||||
Reference in new issue
Block a user