summaryrefslogtreecommitdiff
path: root/debian/apt.auto-removal.sh
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-03-10 17:53:22 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-03-13 13:58:46 +0100
commitb9b0f6222c489db78331cc8be3c093538d22c70b (patch)
tree173f255d53371aad0846c3ccbeec44d321cfe838 /debian/apt.auto-removal.sh
parent52922e2a6795aadcbb8dd11bba14db0f05da34c6 (diff)
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.
Diffstat (limited to 'debian/apt.auto-removal.sh')
-rw-r--r--debian/apt.auto-removal.sh21
1 files changed, 11 insertions, 10 deletions
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 <<EOF
+generateconfig() {
+ cat <<EOF
// File autogenerated by $0, do not edit
APT
{
NeverAutoRemove
{
EOF
-for kernel in $kernels; do
- echo " \"^linux-image-${kernel}$\";" >> "$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 <<EOF
+ apt-config dump --no-empty --format '%v%n' 'APT::VersionedKernelPackages' | while read package; do
+ for kernel in $kernels; do
+ echo " \"^${package}-${kernel}$\";"
+ done
+ done
+ cat <<EOF
};
};
EOF
-mv "$config_file".dpkg-new "$config_file"
+}
+generateconfig > "${config_file}.dpkg-new"
+mv "${config_file}.dpkg-new" "$config_file"