From 35d1a9b6c525dcacb19cdfa08713d725f924eaf5 Mon Sep 17 00:00:00 2001 From: tteckster Date: Tue, 10 Jan 2023 11:31:30 -0500 Subject: [PATCH] Update update-lxcs.sh tweak --- misc/update-lxcs.sh | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/misc/update-lxcs.sh b/misc/update-lxcs.sh index 63b452c9..80bd78cc 100644 --- a/misc/update-lxcs.sh +++ b/misc/update-lxcs.sh @@ -1,20 +1,4 @@ #!/bin/bash -set -e -YW=$(echo "\033[33m") -BL=$(echo "\033[36m") -RD=$(echo "\033[01;31m") -CM='\xE2\x9C\x94\033' -GN=$(echo "\033[1;92m") -CL=$(echo "\033[m") -while true; do - read -p "This Will Update All LXC Containers. Proceed(y/n)?" yn - case $yn in - [Yy]*) break ;; - [Nn]*) exit ;; - *) echo "Please answer yes or no." ;; - esac -done -clear function header_info { cat <<"EOF" __ __ __ __ __ _ ________ @@ -26,8 +10,24 @@ function header_info { EOF } +set -e +YW=$(echo "\033[33m") +BL=$(echo "\033[36m") +RD=$(echo "\033[01;31m") +CM='\xE2\x9C\x94\033' +GN=$(echo "\033[1;92m") +CL=$(echo "\033[m") +clear header_info - +while true; do + read -p "This Will Update All LXC Containers. Proceed(y/n)?" yn + case $yn in + [Yy]*) break ;; + [Nn]*) exit ;; + *) echo "Please answer yes or no." ;; + esac +done +clear containers=$(pct list | tail -n +2 | cut -f1 -d' ') function update_container() { @@ -50,7 +50,7 @@ function update_container() { pct exec $container -- bash -c "yum -y update" fi } - +header_info read -p "Skip stopped containers? " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then @@ -82,4 +82,6 @@ for container in $containers; do done wait rm -rf temp +clear +header_info echo -e "${GN} Finished, All Containers Updated. ${CL} \n"