first commit

This commit is contained in:
dgsoft 2025-05-12 21:48:57 +02:00
commit 0b0b5a56be

View File

@ -0,0 +1,30 @@
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
for CTID in $(pct list | tail -n+2 | awk '{print $1}'); do
echo "==> Checking container $CTID..."
if pct exec $CTID -- which apt >/dev/null 2>&1; then
echo "-> apt found. Running update & upgrade..."
pct exec $CTID -- apt -qq update
pct exec $CTID -- apt -qq upgrade -y
elif pct exec $CTID -- which apt-get >/dev/null 2>&1; then
echo "-> apt-get found. Running update & upgrade..."
pct exec $CTID -- apt-get -qq update
pct exec $CTID -- apt-get -qq upgrade -y
elif pct exec $CTID -- which dnf >/dev/null 2>&1; then
echo "-> dnf found. Running update..."
pct exec $CTID -- dnf -y upgrade --refresh
elif pct exec $CTID -- which yum >/dev/null 2>&1; then
echo "-> yum found. Running update..."
pct exec $CTID -- yum -y update
else
echo "-> No package manager found in container $CTID skipping."
fi
echo
done