Inital commit

This commit is contained in:
2022-04-15 22:42:28 +02:00
commit f58f6a2953
13 changed files with 348 additions and 0 deletions

85
UpdateAll.sh Normal file
View File

@@ -0,0 +1,85 @@
#!/bin/bash
##########################
# ProxMox update tools #
# Update all CT`s/VM`s #
# @author: Bram Prieshof #
##########################
#Load functions
source $(dirname $0)/functions.sh
#ID list of excluded VM/CT's
ExcludeList=()
#Get what sould be updated
UpdateVM=true
UpdateCT=true
#while true; do
# read -p "Wich systems should be updated (A)ll, (C)T's only or (V)M's only? " sysq
# case $sysq in
# [Aa]* )
# UpdateVM=true
# UpdateCT=true
# break;;
# [Cc]* )
# UpdateVM=false
# UpdateCT=true
# break;;
# [Vv]* )
# UpdateVM=true
# UpdateCT=false
# break;;
# * ) echo "Please answer with (A)ll, (C)T's or (V)M's.";;
# esac
#done
while true; do
read -p "Wich software should be updated (P)ackages, (A)pplications or (B)oth? " sofq
case $sofq in
[Pp]* )
UpdatePKG=true
UpdateAPP=false
break;;
[Aa]* )
UpdatePKG=false
UpdateAPP=true
break;;
[Bb]* )
UpdatePKG=true
UpdateAPP=true
break;;
* ) echo "Please answer with (A)ll, (C)T`s or (V)M`s.";;
esac
done
#CT updates
if $UpdateCT; then
for CTID in $(pct list | tail -n+2 | awk '{print $1}'); do
#Skip CT if in ExcludeList
if [[ "${ExcludeList[*]}" =~ $CTID ]]; then echo "Notice: $CTID excluded"; continue; fi
#DEBUG echo "Task for $CTID"
if $UpdatePKG; then
CT-UpdatePackages $CTID
fi
if $UpdateAPP; then
CT-UpdateApplicatons $CTID
fi
done
fi
#VM Updates
if $UpdateVM; then
for VMID in $(qm list | tail -n+2 | awk '{print $1}'); do
#Skip CT if in ExcludeList
if [[ "${ExcludeList[*]}" =~ $VMID ]]; then echo "Notice: $VMID excluded"; continue; fi
#DEBUG echo "Task for $VMID"
if $UpdatePKG; then
VM-UpdatePackages $VMID
fi
if $UpdateAPP; then
VM-UpdateApplicatons $VMID
fi
done
fi