summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-11-15 21:40:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-11-15 21:40:49 +0000
commit4cbda9a543f43ca8d720d212856b301ba04242a5 (patch)
tree6111950cc256db034ccd3bc9f05534e2073dceff
parentReleasing progress-linux version 20211113-1. (diff)
downloadopen-infrastructure-compute-tools-4cbda9a543f43ca8d720d212856b301ba04242a5.tar.xz
open-infrastructure-compute-tools-4cbda9a543f43ca8d720d212856b301ba04242a5.zip
Merging upstream version 20211115.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
-rw-r--r--CHANGELOG.txt9
-rw-r--r--VERSION.txt2
-rwxr-xr-xlibexec/container/update55
3 files changed, 61 insertions, 5 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index dbce2b3..cdef7dd 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,12 @@
+2021-11-15 Daniel Baumann <daniel.baumann@open-infrastructure.net>
+
+ * Releasing version 20211115.
+
+ [ Daniel Baumann ]
+ * Speeding up full-upgrades in container update command by removing redundant upgrade step.
+ * Preparing update notifications handling in container update command.
+ * Adding notification handling in container update command.
+
2021-11-13 Daniel Baumann <daniel.baumann@open-infrastructure.net>
* Releasing version 20211113.
diff --git a/VERSION.txt b/VERSION.txt
index f048496..4dc8ff2 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-20211113
+20211115
diff --git a/libexec/container/update b/libexec/container/update
index 4c23423..80f154a 100755
--- a/libexec/container/update
+++ b/libexec/container/update
@@ -119,14 +119,61 @@ do
echo "Updating ${NAME}"
echo "################################################################################"
- container run -n ${NAME} -- "apt update && apt ${YES} upgrade"
+ container run -n ${NAME} -- "apt update"
- case "${FULL_UPGRADE}" in
- true)
- container run -n ${NAME} -- "apt update && apt ${YES} full-upgrade"
+ UPDATES="$(container run -n ${NAME} -- "apt \-\-simulate full-upgrade" | awk '/^[0-9]* upgraded, / { print $1 }')"
+
+ case "${UPDATES}" in
+ 0)
+ ;;
+
+ *)
+ PACKAGES="$(for PACKAGE in $(container run -n ${NAME} -- "apt list \-\-upgradable 2>/dev/null | grep '\/'" | awk -F/ '{ print $1 }'); do echo -n "${PACKAGE} "; done | sed -e 's| $||'; echo)"
+
+ case "${FULL_UPGRADE}" in
+ true)
+ container run -n ${NAME} -- "apt ${YES} full-upgrade"
+ ;;
+
+ *)
+ container run -n ${NAME} -- "apt ${YES} upgrade"
+ ;;
+ esac
;;
esac
+ # Notification
+ if [ -n "${PACKAGES}" ]
+ then
+ CONTAINER_USER="${SUDO_USER:-${USER}}"
+
+ DATE="$(date +%Y-%m-%d\ %H:%M:%S)"
+ HOST="$(hostname -f 2> /dev/null || hostname)"
+
+ # logfile
+ echo "${DATE} ${HOST} ${CONTAINER_USER} ${NAME} ${UPDATES} upgraded: ${PACKAGES}" >> "/var/log/${SOFTWARE}/${PROGRAM}.log"
+
+ # irc
+ if [ -e /usr/bin/irk ]
+ then
+ for FILE in "/etc/${SOFTWARE}/${PROGRAM}.conf" "/etc/${SOFTWARE}/${PROGRAM}.conf.d"/*.conf
+ do
+ if [ -e "${FILE}" ]
+ then
+ . "${FILE}"
+ fi
+ done
+
+ if [ -n "${IRK_TARGETS}" ]
+ then
+ for TARGET in ${IRK_TARGETS}
+ do
+ irk "${TARGET}" "\x0300${CONTAINER_USER}\x03@\x0312${HOST}:\x03 \x0303${NAME}\x03 \x0307${UPDATES} upgraded\x03: ${PACKAGES}"
+ done
+ fi
+ fi
+ fi
+
case "${AUTOREMOVE}" in
true)
container run -n ${NAME} -- "apt ${YES} autoremove ${PURGE}"