Add debian up

This commit is contained in:
MatMoul 2025-06-01 02:28:01 +02:00
parent cba1318073
commit 6789b09191
5 changed files with 218 additions and 0 deletions

32
debian-10/debian-9to10.sh Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

20
debian-up.sh Normal file
View File

@ -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