From b9b0f6222c489db78331cc8be3c093538d22c70b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 17:53:22 +0100 Subject: use a configurable list of versioned kernel packages With APT::VersionedKernelPackages users have the option of adding packages like pre-build out-of-tree modules to the list of automatically protected from being autoremoved. --- debian/apt.auto-removal.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'debian/apt.auto-removal.sh') diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index d105f440a..9c4a4157d 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -72,22 +72,23 @@ $previous_version EOF ) -cat > "$config_file".dpkg-new <> "$config_file".dpkg-new - echo " \"^linux-image-extra-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-signed-image-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-backports-modules-.*-${kernel}$\";" >> "$config_file".dpkg-new - echo " \"^linux-headers-${kernel}$\";" >> "$config_file".dpkg-new -done -cat >> "$config_file".dpkg-new < "${config_file}.dpkg-new" +mv "${config_file}.dpkg-new" "$config_file" -- cgit v1.2.3 From 33677a0cddd552f96963eac6dc74d8ffe9c1f2f6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 20:57:07 +0100 Subject: support kfreebsd and hurd in the kernel hook kfreebsd as well as hurd kernel packages call the postinst script as well so we just need to enable the correct parsing for installed packages and disable the "protect every version" hammer for them. --- debian/apt.auto-removal.sh | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'debian/apt.auto-removal.sh') diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index 9c4a4157d..ab8201898 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -1,5 +1,4 @@ #!/bin/sh - set -e # Author: Steve Langasek @@ -42,7 +41,7 @@ version_test_gt () return "$?" } -list=$(${DPKG} -l 'linux-image-[0-9]*'|awk '/^ii/ && $2 !~ /-dbg$/ { print $2 }' | sed -e's/linux-image-//') +list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]*/ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')" latest_version="" previous_version="" @@ -74,21 +73,16 @@ EOF generateconfig() { cat < "${config_file}.dpkg-new" mv "${config_file}.dpkg-new" "$config_file" -- cgit v1.2.3 From 7ce1ac857d914f98069078b1ea70995e7b6cf764 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 10 Mar 2014 21:31:35 +0100 Subject: ensure that a dot is a dot in the hook As we deal with regex matchers here the dots are treated as wildcards if we don't take care of escaping them. Not very likely that this could be a real-world problem, but just to be sure. --- debian/apt.auto-removal.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'debian/apt.auto-removal.sh') diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index ab8201898..0c5158658 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -63,13 +63,10 @@ then previous_version= fi -kernels=$(sort -u < Date: Fri, 21 Mar 2014 11:47:56 +0100 Subject: only consider versioned kernel packages in autoremove Metapackages like "linux-image-amd64" are otherwise matched by our extraction as well, which later on can't be successfully compared via dpkg --compare-versions as the 'amd64' bit isn't a version number. (Luckily none of our architectures starts with a digit.) This was broken by me in 0.9.16 as I moved a shell-glob matcher to a regex-based one which has slightly different semantics regarding '*'. Closes: 741962 --- debian/apt.auto-removal.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian/apt.auto-removal.sh') diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index 0c5158658..c00416127 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -41,7 +41,7 @@ version_test_gt () return "$?" } -list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]*/ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')" +list="$(${DPKG} -l | awk '/^ii[ ]+(linux|kfreebsd|gnumach)-image-[0-9]/ && $2 !~ /-dbg$/ { print $2 }' | sed -e 's#\(linux\|kfreebsd\|gnumach\)-image-##')" latest_version="" previous_version="" -- cgit v1.2.3