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

Bug#580939: remove all archives except of currently installed packages



Yes, similar to clean and autoclean, there should be a function to remove all
archives except of currently installed packages.

Here is what I cobbled together to do it by hand.

$ cat Makefile
S=/var/lib/dpkg/status
death:/tmp/deathlist;set -e; cd /var/cache/apt/archives; df .;xargs rm < $?; df .
/tmp/installed:$S;apt-show-versions|sed 's!/.*!!' > $@
/tmp/archives:;ls /var/cache/apt/archives|perl -pwle 's/_.*/ $$_/' |sort > $@
/tmp/deathlist:/tmp/archives /tmp/installed
	join -v 1 $?|perl -anwle 'for($$F[1]){print if defined}' > $@

Of course I ran it just after an autoclean with APT::Clean-Installed
true... to make the join have no double matches...



Reply to: