From 694002e14a85aafc6a507a035bc81d663dfe109a Mon Sep 17 00:00:00 2001 From: Uruk <68083474+Uruknara@users.noreply.github.com> Date: Tue, 22 Nov 2022 01:04:28 +0100 Subject: [PATCH] Adding more support and little feature (#755) Just adding support of other os and the hostname in the info bar [Update Ubuntu, Debian, Devuan, Alpine Linux, CentOS-Rocky-Alma, Fedora, ArchLinux ] New feature --- misc/update-lxcs.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/misc/update-lxcs.sh b/misc/update-lxcs.sh index 84a59274..59c8f0ce 100644 --- a/misc/update-lxcs.sh +++ b/misc/update-lxcs.sh @@ -34,16 +34,23 @@ function update_container() { container=$1 clear header_info - echo -e "${BL}[Info]${GN} Updating${BL} $container ${CL} \n" + name=`pct exec $container hostname` + echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${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" + if [ "$os" == "alpine" ]; then + pct exec $container -- ash -c "apk update && apk upgrade -y" + elif [ "$os" == "ubuntu" ] || [ "$os" == "debian" ] || [ "$os" == "devuan" ]; then + pct exec $container -- bash -c "apt-get update && apt-get upgrade -y && apt-get clean && apt-get --purge autoremove -y" + elif [ "$os" == "fedora" ]; then + pct exec $container -- bash -c "dnf -y update && dnf -y upgrade && dnf -y --purge autoremove" + elif [ "$os" == "archlinux" ]; then + pct exec $container -- bash -c "pacman -Syyu --noconfirm" else - pct exec $container -- bash -c "apt update && apt upgrade -y && apt autoremove -y" + pct exec $container -- bash -c "yum -y update" fi } + read -p "Skip stopped containers? " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then