diff options
Diffstat (limited to 'debian/apt.auto-removal.sh')
-rw-r--r-- | debian/apt.auto-removal.sh | 21 |
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" |