Add lxd-containers-upgrade script
This commit is contained in:
parent
7aa1de4c27
commit
cfa7e66a1f
2 changed files with 25 additions and 0 deletions
16
files/lxd-containers-upgrade.sh
Normal file
16
files/lxd-containers-upgrade.sh
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
for i in $(lxc list --format csv -c n); do
|
||||||
|
lxc snapshot "$i"
|
||||||
|
if lxc exec "$i" -- which apt >/dev/null 2>&1; then
|
||||||
|
echo "Upgrading Debian/Ubuntu $i"
|
||||||
|
lxc exec "$i" -- apt update
|
||||||
|
lxc exec "$i" -- apt upgrade -y
|
||||||
|
fi
|
||||||
|
if lxc exec "$i" -- which pacman >/dev/null 2>&1; then
|
||||||
|
echo "Upgrading ArchLinux $i"
|
||||||
|
lxc exec "$i" -- sudo -u benpro yay -Sc --noconfirm
|
||||||
|
lxc exec "$i" -- sudo -u benpro yay -Syu --noconfirm
|
||||||
|
fi
|
||||||
|
done
|
|
@ -127,3 +127,12 @@ systemd.service(
|
||||||
enabled=True,
|
enabled=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
files.put(
|
||||||
|
name='Add lxd-containers-upgrade.sh',
|
||||||
|
src='files/lxd-containers-upgrade.sh',
|
||||||
|
dest='/usr/local/bin/lxd-containers-upgrade.sh',
|
||||||
|
user='root',
|
||||||
|
group='root',
|
||||||
|
mode='700',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
Reference in a new issue