Update update-lxcs.sh

tweak
This commit is contained in:
tteckster 2023-01-10 11:31:30 -05:00 committed by GitHub
parent a8c22e0c67
commit 35d1a9b6c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,20 +1,4 @@
#!/bin/bash #!/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 { function header_info {
cat <<"EOF" cat <<"EOF"
__ __ __ __ __ _ ________ __ __ __ __ __ _ ________
@ -26,8 +10,24 @@ function header_info {
EOF 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 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' ') containers=$(pct list | tail -n +2 | cut -f1 -d' ')
function update_container() { function update_container() {
@ -50,7 +50,7 @@ function update_container() {
pct exec $container -- bash -c "yum -y update" pct exec $container -- bash -c "yum -y update"
fi fi
} }
header_info
read -p "Skip stopped containers? " -n 1 -r read -p "Skip stopped containers? " -n 1 -r
echo echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then if [[ ! $REPLY =~ ^[Yy]$ ]]; then
@ -82,4 +82,6 @@ for container in $containers; do
done done
wait wait
rm -rf temp rm -rf temp
clear
header_info
echo -e "${GN} Finished, All Containers Updated. ${CL} \n" echo -e "${GN} Finished, All Containers Updated. ${CL} \n"