summaryrefslogtreecommitdiffstats
path: root/libexec/container/update
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-11-16 05:26:51 +0000
committerDaniel Baumann <daniel.baumann@open-infrastructure.net>2021-11-16 05:54:23 +0000
commitd03053f58da544a70101ce0142075c6d4575aa16 (patch)
tree660bba0b84c89ecb99b7d28b00a5862983e1baf1 /libexec/container/update
parentRefactoring notification in container update command. (diff)
downloadcompute-tools-d03053f58da544a70101ce0142075c6d4575aa16.tar.xz
compute-tools-d03053f58da544a70101ce0142075c6d4575aa16.zip
Adding notificiations for autoremovals in container update command.
Signed-off-by: Daniel Baumann <daniel.baumann@open-infrastructure.net>
Diffstat (limited to '')
-rwxr-xr-xlibexec/container/update15
1 files changed, 14 insertions, 1 deletions
diff --git a/libexec/container/update b/libexec/container/update
index 7bf5e5f..de76942 100755
--- a/libexec/container/update
+++ b/libexec/container/update
@@ -187,7 +187,20 @@ do
case "${AUTOREMOVE}" in
true)
- container run -n ${NAME} -- "apt ${YES} autoremove ${PURGE}"
+ REMOVE_NUMBER="$(container run -n ${NAME} -- "apt \-\-simulate autoremove" | awk '/^[0-9]* upgraded, / { print $6 }')"
+
+ case "${REMOVE_NUMBER}" in
+ 0)
+ ;;
+
+ *)
+ REMOVE_PACKAGES="$(for LINE in $(container run -n ${NAME} -- "apt \-\-simulate autoremove" | grep '^ '); do echo ${LINE}; done | sed -e 's|^ ||' -e 's| $||'; echo)"
+
+ container run -n ${NAME} -- "apt ${YES} autoremove ${PURGE}"
+
+ Notification "removal(s)" "${REMOVE_NUMBER}" "$(echo ${REMOVE_PACKAGES})"
+ ;;
+ esac
;;
esac