diff options
-rwxr-xr-x | adu-download | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/adu-download b/adu-download index 57a4716..b58ab97 100755 --- a/adu-download +++ b/adu-download @@ -59,8 +59,26 @@ apt-get -q -y --with-new-pkgs --download-only upgrade | grep "^Get:" | cat ln -s -- "${UPDATE_TARGET}" "${UPDATE_SYMLINK}" 2>/dev/null || true +# Take a list on standard input, and output them all together separated by $1 +listify() { + sep="" + while read -r line; do + printf "%s" "${sep}${line}" + sep="$1" + done + printf "\\n" +} + # Notify logged-in users that updates are available if command -v notify-send >/dev/null; then + sources="$(echo "$upgradeable" \ + | cut -d / -f 1 \ + | xargs -n 1 apt-cache showsrc 2>/dev/null \ + | grep ^Package: \ + | cut -d " " -f 2 \ + | sort -u \ + | listify ", ")" + # Disable shellcheck's "For loops over find output are fragile" warning here # because filenames in `/run/user` are safe, and doing it The Right Way is a # pain because of the environment variable. @@ -70,7 +88,7 @@ if command -v notify-send >/dev/null; then runuser -u "$(stat -c "%U" "$addr")" -- \ notify-send --app-name=apt-desktop-upgrades \ "$upgrades system updates available" \ - "To install them, reboot when it is convenient" + "To install them, reboot when it is convenient\\nUpdates from $sources" done fi |