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 /adu-download | |
parent | 50c1afddbc30243a419ddc2786912f9634f3d5e9 (diff) |
Experimental support for `apt-listbugs` during downloads
You have to explicitly enable it though
Diffstat (limited to 'adu-download')
-rwxr-xr-x | adu-download | 22 |
1 files changed, 21 insertions, 1 deletions
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 |