mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-06-30 11:07:38 +00:00
Use onliner for updates (#4414)
This commit is contained in:
@ -13,7 +13,7 @@ function update_container() {
|
||||
echo -e "\n [Info] Updating $container : $name \n"
|
||||
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
|
||||
case "$os" in
|
||||
alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;;
|
||||
alpine) pct exec "$container" -- ash -c "apk -U upgrade" ;;
|
||||
archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;;
|
||||
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;;
|
||||
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -o Dpkg::Options::="--force-confold" dist-upgrade -y; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;;
|
||||
@ -33,17 +33,17 @@ for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
||||
echo -e "[Info] Skipping $container"
|
||||
sleep 1
|
||||
else
|
||||
status=$(pct status $container)
|
||||
template=$(pct config $container | grep -q "template:" && echo "true" || echo "false")
|
||||
status=$(pct status "$container")
|
||||
template=$(pct config "$container" | grep -q "template:" && echo "true" || echo "false")
|
||||
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
||||
echo -e "[Info] Starting $container"
|
||||
pct start $container
|
||||
pct start "$container"
|
||||
sleep 5
|
||||
update_container $container
|
||||
update_container "$container"
|
||||
echo -e "[Info] Shutting down $container"
|
||||
pct shutdown $container &
|
||||
pct shutdown "$container" &
|
||||
elif [ "$status" == "status: running" ]; then
|
||||
update_container $container
|
||||
update_container "$container"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
@ -5,7 +5,7 @@
|
||||
# License: MIT
|
||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
|
||||
function header_info {
|
||||
function header_info() {
|
||||
clear
|
||||
cat <<"EOF"
|
||||
__ __ __ __ __ _ ________
|
||||
@ -64,7 +64,7 @@ function update_container() {
|
||||
echo -e "${BL}[Info]${GN} Updating ${BL}$container${CL} : ${GN}$name${CL} - ${YW}[No disk info for ${os}]${CL}\n"
|
||||
fi
|
||||
case "$os" in
|
||||
alpine) pct exec "$container" -- ash -c "apk update && apk upgrade" ;;
|
||||
alpine) pct exec "$container" -- ash -c "apk -U upgrade" ;;
|
||||
archlinux) pct exec "$container" -- bash -c "pacman -Syyu --noconfirm" ;;
|
||||
fedora | rocky | centos | alma) pct exec "$container" -- bash -c "dnf -y update && dnf -y upgrade" ;;
|
||||
ubuntu | debian | devuan) pct exec "$container" -- bash -c "apt-get update 2>/dev/null | grep 'packages.*upgraded'; apt list --upgradable && apt-get -yq dist-upgrade 2>&1; rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED" ;;
|
||||
|
Reference in New Issue
Block a user