Added PostUpgrade tasks for Debian 13 and Alpine 3.23, refactored Type Detection of scripts tageting one system
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
#!/bin/bash
|
||||
ID=100
|
||||
#ID=$1
|
||||
VMS=$(qm list | tail -n+2 | awk '{print $1}')
|
||||
CTS=$(pct list | tail -n+2 | awk '{print $1}')
|
||||
#ID=100
|
||||
ID=$1
|
||||
VMS=($(qm list | tail -n+2 | awk '{print $1}'))
|
||||
CTS=($(pct list | tail -n+2 | awk '{print $1}'))
|
||||
#Determine id type
|
||||
if [[ $VMS =~ $ID ]]; then TYPE=VM; fi
|
||||
if [[ $CTS =~ $ID ]]; then TYPE=CT; fi
|
||||
echo ID is $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 TYPE=Unset; fi
|
||||
|
||||
echo ID: $ID is $TYPE
|
||||
|
||||
10
Playground/testDetermineTypeOld.sh
Normal file
10
Playground/testDetermineTypeOld.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
ID=100
|
||||
#ID=$1
|
||||
VMS=$(qm list | tail -n+2 | awk '{print $1}')
|
||||
CTS=$(pct list | tail -n+2 | awk '{print $1}')
|
||||
#Determine id type
|
||||
if [[ $VMS =~ $ID ]]; then TYPE=VM; fi
|
||||
if [[ $CTS =~ $ID ]]; then TYPE=CT; fi
|
||||
if [ -z ${TYPE+x} ]; then TYPE=Unset; fi
|
||||
echo ID: $ID is $TYPE
|
||||
Reference in New Issue
Block a user