Added Debian-Upgrade-Scripts
This commit is contained in:
parent
6a8b9708fd
commit
6abadfc841
2 changed files with 100 additions and 0 deletions
50
system/upgrade_debian_10_to_11.sh
Normal file
50
system/upgrade_debian_10_to_11.sh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
# Define color codes
|
||||
RED='\e[31m'
|
||||
GREEN='\e[32m'
|
||||
YELLOW='\e[33m'
|
||||
BLUE='\e[34m'
|
||||
NC='\e[0m' # No Color
|
||||
|
||||
# Ensure the script is run as root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo -e "${RED}This script must be run as root. Try running it with sudo.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Updating package lists and upgrading installed packages...${NC}"
|
||||
DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
|
||||
echo -e "${BLUE}Upgrading full system...${NC}"
|
||||
DEBIAN_FRONTEND=noninteractive apt full-upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
|
||||
echo -e "${BLUE}Removing obsolete packages...${NC}"
|
||||
apt autoremove -y
|
||||
|
||||
# Update all .list files in /etc/apt/sources.list.d/ and sources.list to Debian 11 Bullseye
|
||||
echo -e "${YELLOW}Updating APT sources list to Debian 11 (Bullseye)...${NC}"
|
||||
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
|
||||
sed -i 's/buster-security/bullseye-security/g' /etc/apt/sources.list
|
||||
find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i 's/buster/bullseye/g' {} +
|
||||
find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i 's/buster-security/bullseye-security/g' {} +
|
||||
|
||||
# Update APT cache and perform upgrade
|
||||
echo -e "${BLUE}Updating package lists...${NC}"
|
||||
apt update
|
||||
|
||||
echo -e "${BLUE}Upgrading to Debian 11 Bullseye...${NC}"
|
||||
DEBIAN_FRONTEND=noninteractive apt upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
DEBIAN_FRONTEND=noninteractive apt full-upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
|
||||
echo -e "${BLUE}Cleaning up unnecessary packages...${NC}"
|
||||
apt autoremove -y
|
||||
apt clean
|
||||
|
||||
echo -e "${GREEN}Upgrade completed. A system reboot is required.${NC}"
|
||||
read -p "Do you want to reboot now? (y/N) " answer
|
||||
if [[ "$answer" =~ ^[Yy]$ ]]; then
|
||||
reboot
|
||||
fi
|
||||
50
system/upgrade_debian_11_to_12.sh
Normal file
50
system/upgrade_debian_11_to_12.sh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
# Define color codes
|
||||
RED='\e[31m'
|
||||
GREEN='\e[32m'
|
||||
YELLOW='\e[33m'
|
||||
BLUE='\e[34m'
|
||||
NC='\e[0m' # No Color
|
||||
|
||||
# Ensure the script is run as root
|
||||
if [[ $EUID -ne 0 ]]; then
|
||||
echo -e "${RED}This script must be run as root. Try running it with sudo.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}Updating package lists and upgrading installed packages...${NC}"
|
||||
DEBIAN_FRONTEND=noninteractive apt update && apt upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
|
||||
echo -e "${BLUE}Upgrading full system...${NC}"
|
||||
DEBIAN_FRONTEND=noninteractive apt full-upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
|
||||
echo -e "${BLUE}Removing obsolete packages...${NC}"
|
||||
apt autoremove -y
|
||||
|
||||
# Update all .list files in /etc/apt/sources.list.d/ and sources.list to Debian 12 Bookworm
|
||||
echo -e "${YELLOW}Updating APT sources list to Debian 12 (Bookworm)...${NC}"
|
||||
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
|
||||
sed -i 's/bullseye-security/bookworm-security/g' /etc/apt/sources.list
|
||||
find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i 's/bullseye/bookworm/g' {} +
|
||||
find /etc/apt/sources.list.d/ -type f -name "*.list" -exec sed -i 's/bullseye-security/bookworm-security/g' {} +
|
||||
|
||||
# Update APT cache and perform upgrade
|
||||
echo -e "${BLUE}Updating package lists...${NC}"
|
||||
apt update
|
||||
|
||||
echo -e "${BLUE}Upgrading to Debian 12 Bookworm...${NC}"
|
||||
DEBIAN_FRONTEND=noninteractive apt upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
DEBIAN_FRONTEND=noninteractive apt full-upgrade -y -o Dpkg::Options::="--force-confold"
|
||||
|
||||
echo -e "${BLUE}Cleaning up unnecessary packages...${NC}"
|
||||
apt autoremove -y
|
||||
apt clean
|
||||
|
||||
echo -e "${GREEN}Upgrade completed. A system reboot is required.${NC}"
|
||||
read -p "Do you want to reboot now? (y/N) " answer
|
||||
if [[ "$answer" =~ ^[Yy]$ ]]; then
|
||||
reboot
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue