summaryrefslogtreecommitdiffstats
path: root/debian/apt.auto-removal.sh
diff options
context:
space:
mode:
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"