#!/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