summaryrefslogtreecommitdiffstats
path: root/debian/apt.auto-removal.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
commite0c5d5bce70177b20afa2deee4c62e368a8b9c43 (patch)
treede36eff10a26ee736e19b557f531d03847487856 /debian/apt.auto-removal.sh
parentAdding upstream version 2.2.4. (diff)
downloadapt-e0c5d5bce70177b20afa2deee4c62e368a8b9c43.tar.xz
apt-e0c5d5bce70177b20afa2deee4c62e368a8b9c43.zip
Adding debian version 2.2.4.debian/2.2.4debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/apt.auto-removal.sh')
-rw-r--r--debian/apt.auto-removal.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh
new file mode 100644
index 0000000..eef550a
--- /dev/null
+++ b/debian/apt.auto-removal.sh
@@ -0,0 +1,16 @@
+#!/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"