X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/3196dae8e92407b3aa8e12779a8ed7db998ebdc4..9a2902305b75a6bc5a288fd1b12323c77df09b8c:/debian/apt.auto-removal.sh diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index f615fa677..dc3a1baca 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -19,7 +19,7 @@ eval $(apt-config shell DPKG Dir::bin::dpkg/f) test -n "$DPKG" || DPKG="/usr/bin/dpkg" -list="$(${DPKG} -l | awk '/^[ih][^nc][ ]+(linux|kfreebsd|gnumach)-image-[0-9]+\./ && $2 !~ /-dbg$/ && $2 !~ /-dbgsym$/ { print $2,$3; }' \ +list="$("${DPKG}" -l | awk '/^[ih][^nc][ ]+(linux|kfreebsd|gnumach)-image-[0-9]+\./ && $2 !~ /-dbg$/ && $2 !~ /-dbgsym$/ { print $2,$3; }' \ | sed -e 's#^\(linux\|kfreebsd\|gnumach\)-image-##' -e 's#:[^:]\+ # #')" debverlist="$(echo "$list" | cut -d' ' -f 2 | sort --unique --reverse --version-sort)" @@ -47,13 +47,33 @@ generateconfig() { APT::NeverAutoRemove { EOF - apt-config dump --no-empty --format '%v%n' 'APT::VersionedKernelPackages' | while read package; do + for package in $(apt-config dump --no-empty --format '%v%n' 'APT::VersionedKernelPackages'); do for kernel in $kernels; do echo " \"^${package}-${kernel}$\";" done done echo '};' + if [ "${APT_AUTO_REMOVAL_KERNELS_DEBUG:-true}" = 'true' ]; then + cat < "${config_file}.dpkg-new" -mv "${config_file}.dpkg-new" "$config_file" +generateconfig "$@" > "${config_file}.dpkg-new" +mv -f "${config_file}.dpkg-new" "$config_file" chmod 444 "$config_file"