From 03df70a244f6c1d55db0860aa34adb8a4349ac97 Mon Sep 17 00:00:00 2001 From: Hartmut Bauer Date: Fri, 16 May 2025 21:23:25 +0200 Subject: [PATCH] podman migration done, auto-update fixes --- main.inc.sh | 25 ++++++++++++++++++++++--- main.sh | 3 ++- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/main.inc.sh b/main.inc.sh index 7381c46..e93f352 100755 --- a/main.inc.sh +++ b/main.inc.sh @@ -197,15 +197,34 @@ do_start_stop_containers() { return $rc } +# podman auto-update nach dem Backup starten +# +# Die fn schreibt sehr viel ins Log, damit der Update ggf. nachvollzogen werden kann, +# wenn etwas daneben geht. +# update_services() { log $DEBUG "$DBG update_services()" mail_log $INFO "$INF update services" - local upd=$($CONTAINER_SVC_UPDATE_USER 2>&1 | tee -a $LOG_FILE | egrep 'registry\s+true' | sed 's/^.* \([^[:space:]]*\/[^[:space:]]*\).*$/\1/g') + local old_img=$($PODMAN ps --format "table {{.ImageID}} {{.Names}} {{.Image}}" --sort names) + echo "$old_img" >>$LOG_FILE 2>&1 + local plan=$($CONTAINER_SVC_UPDATE_USER --dry-run --format "{{.Image}} {{.Updated}}" 2>&1 | grep pending | sed 's/^\(.*\) pending/\1/') + local upd=$($CONTAINER_SVC_UPDATE_USER --format "table {{.Image}} {{.Updated}}" 2>&1 | tee -a $LOG_FILE | grep true | sed 's/^\(.*\) true/\1/') check_pipe_rc ${PIPESTATUS[@]} local rc=$? - for i in $upd; do - mail_log $INFO "$INF $i" + # warten bis alle wieder da sind (wg. ps) + sleep 20 + local new_img=$($PODMAN ps --format "table {{.ImageID}} {{.Names}} {{.Image}}" --sort names) + echo "$new_img" >>$LOG_FILE 2>&1 + for i in $plan; do + mail_log $INFO "$INF pending: $i" done + for i in $upd; do + mail_log $INFO "$INF updated: $i" + done + # diff output bring zu wenig + #log $DEBUG "$DBG diff before after" + #local diff_img=$(diff <(echo "$old_img") <(echo "$new_img")) + #echo "$diff_img" >> $LOG_FILE return $rc } diff --git a/main.sh b/main.sh index 8c8cd23..ed34638 100755 --- a/main.sh +++ b/main.sh @@ -3,6 +3,7 @@ # entrypoint for all actions # +# 2.2.0 16.05.2025 - fixes for auto-update, podman migration done # 2.1.17 11.05.2025 - bugfixes, sort tar archive, split daily/cron daily # 2.1.16 10.05.2025 - fix mail.sh, log results of auto-update # 2.1.15 09.05.2025 - podman auto-update @@ -16,7 +17,7 @@ # 2.1.7 29.04.2025 - 1. Schritt zur Umstellung auf podman # 2.1.6 29.04.2025 - weekly backup Sa->SO -VER="2.1.17" +VER="2.2.0" HERE=$(dirname "$0") THIS_SCRIPT=$0