summaryrefslogtreecommitdiff
path: root/debian
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2022-04-06 13:51:08 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2022-04-07 13:19:52 +0200
commit824651ded0bcf8603e9b508860b8fe5a68fc53ff (patch)
treeea9b042a2d16cfc6723851faf87c119d03d9b78f /debian
parent023c270e27e09cad9f35908caeb933fb23f8bd79 (diff)
Only protect two kernels, not last installed one
The kernel autoremoval algorithm was written to accomodate for Ubuntu's boot partition sizing, which was written to accomodate 3 kernels - 2 installed ones + a new one being unpacked. It seems that when the algorithm was designed, it was overlooked that it actually kept 3 kernels. LP: #1968154
Diffstat (limited to 'debian')
-rw-r--r--debian/apt.auto-removal.sh16
-rw-r--r--debian/apt.maintscript1
-rwxr-xr-xdebian/apt.postinst5
-rwxr-xr-xdebian/rules1
4 files changed, 6 insertions, 17 deletions
diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh
deleted file mode 100644
index eef550a53..000000000
--- a/debian/apt.auto-removal.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-set -e
-
-eval $(apt-config shell APT_CONF_D Dir::Etc::parts/d)
-test -n "${APT_CONF_D}" || APT_CONF_D="/etc/apt/apt.conf.d"
-config_file="${APT_CONF_D}/01autoremove-kernels"
-
-generateconfig() {
- cat <<EOF
-// DO NOT EDIT! File autogenerated by $0
-APT::LastInstalledKernel "$1";
-EOF
-}
-generateconfig "$@" > "${config_file}.dpkg-new"
-mv -f "${config_file}.dpkg-new" "$config_file"
-chmod 444 "$config_file"
diff --git a/debian/apt.maintscript b/debian/apt.maintscript
index 296f83bd5..f37a9e27a 100644
--- a/debian/apt.maintscript
+++ b/debian/apt.maintscript
@@ -1,3 +1,4 @@
rm_conffile /etc/apt/apt.conf.d/20changelog 1.2.4~
# we use a systemd timer unit now
rm_conffile /etc/cron.daily/apt 1.2.10~
+rm_conffile /etc/kernel/postinst.d/apt-auto-removal 2.4.5~
diff --git a/debian/apt.postinst b/debian/apt.postinst
index 837b46b7b..8a623f2fd 100755
--- a/debian/apt.postinst
+++ b/debian/apt.postinst
@@ -7,4 +7,9 @@ if [ "$1" = 'configure' ]; then
--no-create-home --quiet _apt || true
fi
+if [ "$1" = "configure" ] && [ -n "$2" ] && dpkg --compare-versions -- "$2" le-nl "2.4.5~"; then
+ rm -f /etc/apt/apt.conf.d/01autoremove-kernels
+fi
+
+
#DEBHELPER#
diff --git a/debian/rules b/debian/rules
index 7997739fa..8a110f7a1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -29,7 +29,6 @@ override_dh_install-arch:
dh_install -papt -Xmethods/curl -Xmethods/curl+https -Xmethods/curl+http
dh_install --remaining
install -m 644 debian/apt.conf.autoremove debian/apt/etc/apt/apt.conf.d/01autoremove
- install -m 755 debian/apt.auto-removal.sh debian/apt/etc/kernel/postinst.d/apt-auto-removal
override_dh_gencontrol:
dh_gencontrol -- -Vapt:keyring="$(shell ./vendor/getinfo keyring-package)"