From 8597ee543a7d1d61450542c61512295f9da4fec4 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 10 Sep 2015 10:03:40 +0200 Subject: include debug information in the autoremove-kernels file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Figuring out after the fact what went wrong in the kernel hook is kinda hart, also as the bugreports are usually very lacking on the details front. Collecting the internal variables in the debug output we attach to the generated file might help shine some light on the matter. It's at least not going to hurt… --- debian/apt.auto-removal.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'debian/apt.auto-removal.sh') diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index f615fa677..6af5da987 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -47,13 +47,33 @@ generateconfig() { APT::NeverAutoRemove { EOF - apt-config dump --no-empty --format '%v%n' 'APT::VersionedKernelPackages' | while read package; do + for package in $(apt-config dump --no-empty --format '%v%n' 'APT::VersionedKernelPackages'); do for kernel in $kernels; do echo " \"^${package}-${kernel}$\";" done done echo '};' + if [ "${APT_AUTO_REMOVAL_KERNELS_DEBUG:-true}" = 'true' ]; then + cat < "${config_file}.dpkg-new" -mv "${config_file}.dpkg-new" "$config_file" +generateconfig "$@" > "${config_file}.dpkg-new" +mv -f "${config_file}.dpkg-new" "$config_file" chmod 444 "$config_file" -- cgit v1.2.3