Update update-lxcs.sh

added back alpine support
This commit is contained in:
tteckster 2022-11-02 12:57:31 -04:00 committed by GitHub
parent 6080629b25
commit b0e517ab74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 10 deletions

View File

@ -16,15 +16,15 @@ while true; do
done done
clear clear
function header_info { function header_info {
echo -e "${BL} cat <<"EOF"
_ _ _____ _____ _______ ______ __ __ __ __ __ _ ________
| | | | __ \| __ \ /\|__ __| ____| / / / /___ ____/ /___ _/ /____ / / | |/ / ____/
| | | | |__) | | | | / \ | | | |__ / / / / __ \/ __ / __ `/ __/ _ \ / / | / /
| | | | ___/| | | |/ /\ \ | | | __| / /_/ / /_/ / /_/ / /_/ / /_/ __/ / /___/ / /___
| |__| | | | |__| / ____ \| | | |____ \____/ .___/\__,_/\__,_/\__/\___/ /_____/_/|_\____/
\____/|_| |_____/_/ \_\_| |______| /_/
${CL}" EOF
} }
header_info header_info
@ -35,7 +35,14 @@ function update_container() {
clear clear
header_info header_info
echo -e "${BL}[Info]${GN} Updating${BL} $container ${CL} \n" echo -e "${BL}[Info]${GN} Updating${BL} $container ${CL} \n"
pct config $container > temp
os=`awk '/^ostype/' temp | cut -d' ' -f2`
if [ "$os" == "alpine" ]
then
pct exec $container -- ash -c "apk update && apk upgrade"
else
pct exec $container -- bash -c "apt update && apt upgrade -y && apt autoremove -y" pct exec $container -- bash -c "apt update && apt upgrade -y && apt autoremove -y"
fi
} }
read -p "Skip stopped containers? " -n 1 -r read -p "Skip stopped containers? " -n 1 -r
echo echo
@ -67,5 +74,5 @@ for container in $containers; do
fi fi
done done
wait wait
rm -rf temp
echo -e "${GN} Finished, All Containers Updated. ${CL} \n" echo -e "${GN} Finished, All Containers Updated. ${CL} \n"