aboutsummaryrefslogtreecommitdiff
path: root/adu-download
diff options
context:
space:
mode:
Diffstat (limited to 'adu-download')
-rwxr-xr-xadu-download22
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