[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Automatic removing of unneeded .deb files?



Here's an alternative way to do it, by scanning the .deb files and
seeing if they're already installed or not.  (It's in bash, but should
be easy to convert to Python etc.):

    #!/bin/bash

    for deb in /var/cache/apt/archives/*.deb; do
	pkg=$(dpkg-deb -f $deb Package)
	if ! dpkg-query -Wf '${Status}' $pkg | grep -q ' installed'; then
	    echo $pkg: not installed
	    # uncomment this to remove it ...
	    # rm $deb
	fi
    done

-- 
Eric Cooper             e c c @ c m u . e d u



Reply to: