diff options
author | Adam Spragg <adam@spra.gg> | 2022-04-11 14:39:18 +0100 |
---|---|---|
committer | Adam Spragg <adam@spra.gg> | 2022-04-11 14:39:18 +0100 |
commit | ef128a0d2fb57d752fc71febf6573ba965b077e5 (patch) | |
tree | 963f0767c6ac778560ea922bb234d874e85e6862 | |
parent | e7887ec3a6ae680da35c5e4d869be40e1c3e2605 (diff) |
-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 |