From 700790bed89240a66b701c5af97fe8fcf7932aca Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Sat, 16 Apr 2022 18:24:49 -0400 Subject: [PATCH] add update_containers script --- bin/update_containers.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 bin/update_containers.sh diff --git a/bin/update_containers.sh b/bin/update_containers.sh new file mode 100755 index 0000000..d83b9f2 --- /dev/null +++ b/bin/update_containers.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +DEBIAN_CONTAINERS="" +ALPINE_CONTAINERS="" + +for c in ${ALPINE_CONTAINERS}; do + if [ $(lxc list -f csv -c s ${c}) = "RUNNING" ]; then + echo "------------------------" + echo "updating $c\n" + lxc exec $c -- apk upgrade -U; + fi +done + +for c in ${DEBIAN_CONTAINERS}; do + if [ $(lxc list -f csv -c s ${c}) = "RUNNING" ]; then + echo "------------------------" + echo "updating $c\n" + lxc exec $c -- apt update; + lxc exec $c -- apt upgrade -y; + fi +done +