Added PostUpgrade tasks for Debian 13 and Alpine 3.23, refactored Type Detection of scripts tageting one system

This commit is contained in:
2026-01-11 01:16:33 +01:00
parent fd4bd0081a
commit d51a694daa
7 changed files with 123 additions and 30 deletions

View File

@@ -17,8 +17,8 @@ if [ -z "${1##*[!0-9]*}" ]; then echo "Invalid ID, usage: $0 <CT/VM-ID>"; exit;
#Setup Vars, since a seemingly valid id is given
ID=$1
VMS=$(qm list | tail -n+2 | awk '{print $1}')
CTS=$(pct list | tail -n+2 | awk '{print $1}')
VMS=($(qm list | tail -n+2 | awk '{print $1}'))
CTS=($(pct list | tail -n+2 | awk '{print $1}'))
ALLIDS=(${CTS[@]} ${VMS[@]})
## Check if ID exists
@@ -31,9 +31,23 @@ IdExists=false
done
if ! $IdExists; then echo "This ID does not exist"; exit; fi
#Check type of ID
if [[ $VMS =~ $ID ]]; then TYPE=VM; fi
if [[ $CTS =~ $ID ]]; then TYPE=CT; fi
#Determine id type
for ArrayID in "${CTS[@]}"; do
if [ $ArrayID -eq $ID ]; then
TYPE=CT
break
fi
done
for ArrayID in "${VMS[@]}"; do
if [ ! -z ${TYPE+x} ]; then break; fi
if [ $ArrayID -eq $ID ]; then
TYPE=VM
break
fi
done
if [ -z ${TYPE+x} ]; then echo "The ID Type chould not be determind"; exit; fi
#Check if VM/CT is running
if ! $($TYPE-State $ID); then echo "This ID is not runnig"; exit; fi