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