From c88e803c97f70a76668aa75c3f2e6fff7f9241cf Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 10 Dec 2016 10:03:25 -0600 Subject: [PATCH] * usr/bin/purge-old-kernels: - Use dpkg first when APT is broken #16 - https://github.com/dustinkirkland/byobu/pull/16 --- debian/changelog | 6 ++++++ usr/bin/purge-old-kernels | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/debian/changelog b/debian/changelog index feac151e..7b1a9d94 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,14 @@ byobu (5.114) unreleased; urgency=medium + [ Dustin Kirkland ] * usr/bin/purge-old-kernels: - use apt-get, rather than apt, for compatibility with trusty/precise apt + [ @alexm ] + * usr/bin/purge-old-kernels: + - Use dpkg first when APT is broken #16 + - https://github.com/dustinkirkland/byobu/pull/16 + -- Dustin Kirkland Wed, 07 Dec 2016 08:18:12 -0600 byobu (5.113-0ubuntu1) zesty; urgency=medium diff --git a/usr/bin/purge-old-kernels b/usr/bin/purge-old-kernels index 2d999c58..c71fe7f9 100755 --- a/usr/bin/purge-old-kernels +++ b/usr/bin/purge-old-kernels @@ -66,5 +66,10 @@ if [ -z "$PURGE" ]; then fi # Use apt-get, rather than apt, for compatibility with precise/trusty +if ! apt-get install --fix-broken --dry-run >/dev/null 2>&1; then + echo "APT is broken, trying with dpkg" + dpkg --purge $PURGE + apt-get install --fix-broken +fi apt-get $APT_OPTS remove --purge $PURGE apt-get $APT_OPTS autoremove --purge