-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdebian10to11.sh
39 lines (29 loc) · 1.05 KB
/
debian10to11.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Check if the script is run as root
if [ "$(id -u)" -ne 0 ]; then
echo "Please run this script as root or use sudo."
exit 1
fi
echo "Step 1: Update the package list and upgrade current packages"
apt update
apt upgrade -y
echo "Step 2: Backup the current sources.list file"
cp /etc/apt/sources.list /etc/apt/sources.list.bak
echo "Step 3: Update the sources.list file to use Debian 11 repositories"
# Overwrite the sources.list with Debian 11 (Bullseye) repositories
cat <<EOL > /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main
deb http://deb.debian.org/debian bullseye-updates main
deb http://security.debian.org/debian-security/ bullseye-security main
EOL
echo "Step 4: Clean the apt cache"
apt clean
echo "Step 5: Update the package list with new Debian 11 sources"
apt update
echo "Step 6: Perform a full upgrade to Debian 11"
apt full-upgrade -y
echo "Step 7: Remove obsolete packages"
apt autoremove -y
echo "Step 8: Reboot the system to complete the upgrade"
reboot
# After the reboot, the system should be running Debian 11.