From 9d038ffcba24459f2f0af15df5b14d52b86fd72c Mon Sep 17 00:00:00 2001 From: pvincent Date: Wed, 2 Feb 2022 21:47:43 +0400 Subject: [PATCH] better debian_bash_upgrade --- lib/functions.sh | 1 + tools/debian_bash_upgrade | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/functions.sh b/lib/functions.sh index 1e37fc7..97f248c 100644 --- a/lib/functions.sh +++ b/lib/functions.sh @@ -1,3 +1,4 @@ +# TODO: remove, leave it in miaou-server/lib/functions.sh only! # idempotent apt install [package1 package2 ...] function idem_apt_install() { for i in $@; do diff --git a/tools/debian_bash_upgrade b/tools/debian_bash_upgrade index faac223..dfb0936 100755 --- a/tools/debian_bash_upgrade +++ b/tools/debian_bash_upgrade @@ -3,26 +3,30 @@ if [[ -d /opt/debian-bash ]]; then local_release=$(cat /opt/debian-bash/.semver_git_tag) fi + +echo -n "debian-bash: collecting latest release from server url ... " remote_release=$(wget_semver artcode pvincent/debian-bash) +echo "$remote_release" if [[ $local_release != $remote_release ]]; then echo "upgrading from <$local_release> to <$remote_release> ..." curl https://git.artcode.re/pvincent/debian-bash/raw/master/install.sh | sudo bash -s -- --full else - echo "debian-bash version $local_release already up-to-date!" + echo "debian-bash: local version $local_release already up-to-date!" # install inside active LXC containers if [[ -f '/snap/bin/lxc' ]]; then - echo "refreshing containers ..." + echo "debian-bash: refreshing containers ..." for container in $(lxc list --format=json | yq '.[] | select(.state.status == "Running") | .name' -); do container_release=$(lxc exec $container -- cat /opt/debian-bash/.semver_git_tag) if [[ $container_release != $remote_release ]]; then echo "upgrade container <$container> from <$container_release> to <$remote_release>" /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r else - echo "container <$container> already up-to-date!" + echo -e "\\tcontainer <$container> already up-to-date!" fi done + echo DONE fi fi