debian.11.sh

#!/bin/bash

# Check if the script is run as root
if [ "$EUID" -ne 0 ]; then
  echo "Please run as root"
  exit 1
fi

echo "Updating and upgrading current packages..."
apt update && apt upgrade -y

echo "Installing necessary packages for the upgrade..."
apt install -y apt-transport-https ca-certificates

echo "Changing sources.list to Debian 11 (Bullseye)..."
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sed -i 's|buster/updates|bullseye-security|g' /etc/apt/sources.list

echo "Updating package lists..."
apt update

echo "Performing the full upgrade to Debian 11..."
apt full-upgrade -y

echo "Cleaning up..."
apt autoremove --purge -y

echo "The upgrade is complete. It is recommended to reboot the system."

Leave a Reply

Your email address will not be published. Required fields are marked *