diff options
author | Adam Spragg <adam@spra.gg> | 2022-03-21 14:39:03 +0000 |
---|---|---|
committer | Adam Spragg <adam@spra.gg> | 2022-03-21 14:39:03 +0000 |
commit | 1e1e75f0d5c6e6bfbf67b36266aa97edc7fb8bf1 (patch) | |
tree | 45eeba0b57060274eb59a96f2787b38368c764ed | |
parent | 50c1afddbc30243a419ddc2786912f9634f3d5e9 (diff) |
Experimental support for `apt-listbugs` during downloads
You have to explicitly enable it though
-rw-r--r-- | README.md | 24 | ||||
-rwxr-xr-x | adu-download | 22 |
2 files changed, 28 insertions, 18 deletions
@@ -36,31 +36,21 @@ Similarly, systemd is normally notified on `make uninstall`, but again if `DESTDIR` is set and different from `PREFIX`, the steps are omitted again. -## TODO - -### apt-listbugs +## apt-listbugs We disable `apt-listbugs` during upgrades, because desktop systems typically use `NetworkManager`, which is not started by default for `offline-updates.target`. And if `apt-listbugs` can't reach the network, it aborts the upgrade. -We could try pulling in the network during upgrades, just in case `apt-listbugs` -is installed. But that kind of defeats the purpose of "offline updates". Also, -it's redundant if `apt-listbugs` isn't installed. And given that this package's -target audience is mainly systems that are *not* individually managed by -attentive sysadmins, but are as much as possible fire-and-forget, "stable"/LTS -systems for users who aren't necessarily in a position to make a decision on -whether a bug will affect their workflow, the intersection of those systems with -`apt-desktop-upgrades` installed, and those with `apt-listbugs` installed, is -probably pretty small. +There is experimental functionality for checking `apt-listbugs` (if it is +installed) during the updating/downloading packages phase. If any bugs are found +for any of the packages to be upgraded, then an upgrade is not scheduled (and if +one already is, it is cancelled). -However... +To enable this functionality, set `CHECK_LISTBUGS=true` in `adu-download`. -It would be nice if it were possible somehow to hook `apt-listbugs` (if it's -installed) into the `adu-download` phase of things, and just not download -updates for packages which have bugs (or remove already-downloaded updates). -So, look into a way of doing that. +## TODO ### Notifying users about updates diff --git a/adu-download b/adu-download index c97d6e8..9fcf505 100755 --- a/adu-download +++ b/adu-download @@ -20,6 +20,8 @@ set -e +CHECK_LISTBUGS=false + SBINDIR=/usr/local/sbin UPDATE_SYMLINK="/system-update" @@ -27,11 +29,29 @@ UPDATE_TARGET="${SBINDIR}/adu-upgrade" apt-get -qq update -upgrades=$(apt -qq list --upgradeable 2>/dev/null | wc -l) +upgradeable=$(apt -qq list --upgradeable 2>/dev/null) +upgrades=$(echo "$upgradeable" | wc -l) if [ "$upgrades" -eq 0 ]; then exit 0 fi +if $CHECK_LISTBUGS && command -v apt-listbugs >/dev/null; then + # Sed script to change format of `apt list --upgradeable` to `apt-listbugs` + #sed_upg_lb='s:^\([^/]\+\)/[^ ]\+ \([^ ]\+\) .*:\1:' + sed_upg_lb='s:^\([^/]\+\)/[^ ]\+ \([^ ]\+\) .*:\1/\2:' + + #echo "Checking for bugs in: $(echo "$upgradeable" | sed -e "$sed_upg_lb")" + bugs=$(echo "$upgradeable" | sed -e "$sed_upg_lb" | xargs apt-listbugs -q list | grep -E -- "- #[[:digit:]]+ -") + if [ -n "$bugs" ]; then + #echo "$bugs" + echo "$upgrades upgrades available, but $(echo "$bugs" | wc -l) bugs exist - ignoring upgrade" + if [ x"$(realpath -- "${UPDATE_SYMLINK}")" = x"${UPDATE_TARGET}" ]; then + rm -f -- "${UPDATE_SYMLINK}" + fi + exit 0 + fi +fi + apt-get -q -y --with-new-pkgs --download-only upgrade | grep "^Get:" | cat ln -s -- "${UPDATE_TARGET}" "${UPDATE_SYMLINK}" 2>/dev/null || true |