From 6789b09191e3b1837616b51f0bf676cdb69f852d Mon Sep 17 00:00:00 2001 From: MatMoul Date: Sun, 1 Jun 2025 02:28:01 +0200 Subject: [PATCH] Add debian up --- debian-10/debian-9to10.sh | 32 ++++++++++++++++++ debian-11/debian-10to11.sh | 32 ++++++++++++++++++ debian-12/debian-11to12.sh | 67 ++++++++++++++++++++++++++++++++++++++ debian-13/debian-12to13.sh | 67 ++++++++++++++++++++++++++++++++++++++ debian-up.sh | 20 ++++++++++++ 5 files changed, 218 insertions(+) create mode 100644 debian-10/debian-9to10.sh create mode 100644 debian-11/debian-10to11.sh create mode 100644 debian-12/debian-11to12.sh create mode 100644 debian-13/debian-12to13.sh create mode 100644 debian-up.sh diff --git a/debian-10/debian-9to10.sh b/debian-10/debian-9to10.sh new file mode 100644 index 0000000..ab282a9 --- /dev/null +++ b/debian-10/debian-9to10.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +declare -r FREEMEM=$(free |grep Mem: | awk '{print $4}') + +if [ "${FREEMEM}" -lt 130000 ]; then + echo "Not enough free ram, exiting" + exit 1 +fi + + + +sed -i 's/stretch//buster//' /etc/apt/sources.list +sed -i 's/stretch/buster/' /etc/apt/sources.list.d/* +# Check other sources if needed + + +# Can resolve dpkg issue : +# echo "" > /var/lib/dpkg/available +# sh -c 'for i in /var/lib/apt/lists/*_Packages; do dpkg --merge-avail "$i"; done' + +apt update +apt dist-upgrade -y +apt autoclean -y +apt autopurge -y + +echo "" +hostname +echo "" +echo "If ssh login take time in container, enable nesting on hypervisor." +echo "" +read -n 1 -s -r -p "Press any key to reboot" +reboot diff --git a/debian-11/debian-10to11.sh b/debian-11/debian-10to11.sh new file mode 100644 index 0000000..520a7f0 --- /dev/null +++ b/debian-11/debian-10to11.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +declare -r FREEMEM=$(free |grep Mem: | awk '{print $4}') + +if [ "${FREEMEM}" -lt 130000 ]; then + echo "Not enough free ram, exiting" + exit 1 +fi + + + +sed -i 's/buster/bullseye/' /etc/apt/sources.list +sed -i 's/buster/bullseye/' /etc/apt/sources.list.d/* +# Check other sources if needed + + +# Can resolve dpkg issue : +# echo "" > /var/lib/dpkg/available +# sh -c 'for i in /var/lib/apt/lists/*_Packages; do dpkg --merge-avail "$i"; done' + +apt update +apt dist-upgrade -y +apt autoclean -y +apt autopurge -y + +echo "" +hostname +echo "" +echo "If ssh login take time in container, enable nesting on hypervisor." +echo "" +read -n 1 -s -r -p "Press any key to reboot" +reboot diff --git a/debian-12/debian-11to12.sh b/debian-12/debian-11to12.sh new file mode 100644 index 0000000..da222aa --- /dev/null +++ b/debian-12/debian-11to12.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +declare -r FREEMEM=$(free |grep Mem: | awk '{print $4}') + +if [ "${FREEMEM}" -lt 130000 ]; then + echo "Not enough free ram, exiting" + exit 1 +fi + +declare PHPOLDVER="" +declare -r PHPOLD=$(apt list --installed | grep php) +if [[ "${PHPOLD}" != "" ]] ;then + PHPOLDVER=$(ls /etc/php | tail -n 1) + apt list --installed | grep php > ./11to12-phpold.txt + sed -i 's/\/.*//' ./11to12-phpold.txt +fi + + + + +sed -i 's/bullseye/bookworm/' /etc/apt/sources.list +sed -i 's/bullseye/bookworm/' /etc/apt/sources.list.d/* +# Check other sources if needed + + +# Can resolve dpkg issue : +# echo "" > /var/lib/dpkg/available +# sh -c 'for i in /var/lib/apt/lists/*_Packages; do dpkg --merge-avail "$i"; done' + +apt update +apt dist-upgrade -y +apt autoclean -y +apt autopurge -y + +declare PHPNEWVER="" +declare -r PHPNEW=$(apt list --installed | grep php) +if [[ "${PHPNEW}" != "" ]] ;then + PHPNEWVER=$(ls /etc/php | tail -n 1) + apt list --installed | grep php > ./11to12-phpnew.txt + sed -i 's/\/.*//' ./11to12-phpnew.txt + + cp ./11to12-phpold.txt ./11to12-phpold.fordiff + sed -i "s/${PHPOLDVER}/${PHPNEWVER}/" ./11to12-phpold.fordiff + diff ./11to12-phpold.fordiff ./11to12-phpnew.txt | grep "<" > ./11to12-php.diff + rm ./11to12-phpold.fordiff + + echo "" + echo "PHP V${PHPOLDVER} detected" + echo "New version : ${PHPNEWVER}" + echo "" + cat ./11to12-php.diff + echo "" + echo "You can consult files 11to12-php.* after reboot" + echo "" +fi + +#if [ -d /sys/firmware/efi ]; then +# if [ -d /etc/pve ]; then +# apt install -y systemd-boot +# fi +#fi + + +echo "" +hostname +read -n 1 -s -r -p "Press any key to reboot" +reboot diff --git a/debian-13/debian-12to13.sh b/debian-13/debian-12to13.sh new file mode 100644 index 0000000..5409203 --- /dev/null +++ b/debian-13/debian-12to13.sh @@ -0,0 +1,67 @@ +#!/bin/bash + +declare -r FREEMEM=$(free |grep Mem: | awk '{print $4}') + +if [ "${FREEMEM}" -lt 130000 ]; then + echo "Not enough free ram, exiting" + exit 1 +fi + +declare PHPOLDVER="" +declare -r PHPOLD=$(apt list --installed | grep php) +if [[ "${PHPOLD}" != "" ]] ;then + PHPOLDVER=$(ls /etc/php | tail -n 1) + apt list --installed | grep php > ./12to13-phpold.txt + sed -i 's/\/.*//' ./12to13-phpold.txt +fi + + + + +sed -i 's/bookworm/trixie/' /etc/apt/sources.list +sed -i 's/bookworm/trixie/' /etc/apt/sources.list.d/* +# Check other sources if needed + + +# Can resolve dpkg issue : +# echo "" > /var/lib/dpkg/available +# sh -c 'for i in /var/lib/apt/lists/*_Packages; do dpkg --merge-avail "$i"; done' + +apt update +apt dist-upgrade -y +apt autoclean -y +apt autopurge -y + +declare PHPNEWVER="" +declare -r PHPNEW=$(apt list --installed | grep php) +if [[ "${PHPNEW}" != "" ]] ;then + PHPNEWVER=$(ls /etc/php | tail -n 1) + apt list --installed | grep php > ./12to13-phpnew.txt + sed -i 's/\/.*//' ./12to13-phpnew.txt + + cp ./12to13-phpold.txt ./12to13-phpold.fordiff + sed -i "s/${PHPOLDVER}/${PHPNEWVER}/" ./12to13-phpold.fordiff + diff ./12to13-phpold.fordiff ./12to13-phpnew.txt | grep "<" > ./12to13-php.diff + rm ./12to13-phpold.fordiff + + echo "" + echo "PHP V${PHPOLDVER} detected" + echo "New version : ${PHPNEWVER}" + echo "" + cat ./12to13-php.diff + echo "" + echo "You can consult files 12to13-php.* after reboot" + echo "" +fi + +#if [ -d /sys/firmware/efi ]; then +# if [ -d /etc/pve ]; then +# apt install -y systemd-boot +# fi +#fi + + +echo "" +hostname +read -n 1 -s -r -p "Press any key to reboot" +reboot diff --git a/debian-up.sh b/debian-up.sh new file mode 100644 index 0000000..ee73bf2 --- /dev/null +++ b/debian-up.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +declare BASE_URL=https://git.netm.ch/m/os-init/raw/branch/main +declare DEBVER=0 +declare DEBVERUP=0 + +getVer() { + DEBVER=$(grep "VERSION_ID=" /etc/os-release | sed 's/"//g' | sed 's/.*=//') + DEBVERUP=$((DEBVER+1)) +} + +run() { + apt update -y + apt install -y wget + wget -P /tmp ${BASE_URL}/debain-${DEBVERUP}/debian-${DEBVER}to${DEBVERUP}.sh + bash /tmp/debian-${DEBVER}to${DEBVERUP}.sh +} + +getVer +run