]> git.saurik.com Git - apt.git/blobdiff - debian/apt.auto-removal.sh
The entire concept of PendingError() is flawed :/.
[apt.git] / debian / apt.auto-removal.sh
index 6af5da9879f6795430254440b8a28261024f1eb4..df9048cd61a9470a477ed7c119a625f4a1beef8d 100644 (file)
@@ -18,15 +18,14 @@ config_file="${APT_CONF_D}/01autoremove-kernels"
 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)"
 
 if [ -n "$1" ]; then
        installed_version="$(echo "$list" | awk "\$1 == \"$1\" { print \$2;exit; }")"
 fi
-unamer="$(uname -r)"
+unamer="$(uname -r | tr '[A-Z]' '[a-z]')"
 if [ -n "$unamer" ]; then
        running_version="$(echo "$list" | awk "\$1 == \"$unamer\" { print \$2;exit; }")"
 fi
@@ -39,7 +38,7 @@ $running_version
 $previous_version" | sort -u | sed -e '/^$/ d')"
 kernels="$( (echo "$1
 $unamer"; for deb in $debkernels; do echo "$list" | awk "\$2 == \"$deb\" { print \$1; }"; done; ) \
-   | sed -e 's#\.#\\.#g' -e '/^$/ d' | sort -u)"
+   | sed -e 's#\([\.\+]\)#\\\1#g' -e '/^$/ d' | sort -u)"
 
 generateconfig() {
        cat <<EOF