#!/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 12 (Bookworm)..."
sed -i 's/buster/bookworm/g' /etc/apt/sources.list
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sed -i 's|bullseye-security|bookworm-security|g' /etc/apt/sources.list
echo "Updating package lists..."
apt update
echo "Performing the full upgrade to Debian 12..."
apt full-upgrade -y
echo "Cleaning up..."
apt autoremove --purge -y
echo "The upgrade is complete. It is recommended to reboot the system."
debian.12.sh
