summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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