Hello Bill, Thank you for your remarks. Bill Allombert a écrit : > Hello Christophe, > > I am afraid your script does not work accurately: > 1) you do not remove dependencies from package that are not installed > but still in dpkg database (not in 'ok installed' state). > I think the new version (see attachment) answers the issue you point out.
> 2) you do not remove dependency from other OLD packages recursively. > IMHO, it is not desirable (yet). The tool suggests a list of package to remove. However it is the responsability to the administrator to descide to actually remove or not packets. The tool can't make assumptions about such a descision. As a comparison, it is the difference between "deborphan" and "orphaner" tools. You want something like "orphaner", but I propose something like "deborphan" ;-) Regards
#!/bin/sh # # Author: Christophe Lohr <cl...@users.sourceforge.net> # License: GPL # v0.2 - Thu, 07 May 2009 12:51:43 +0200 RECOMMENDS=' ${Recommends}' SUGGESTS=' ${Suggests}' for opt; do case $opt in '-r') RECOMMENDS='' ;; '-s') SUGGESTS='' ;; *) echo "Unknown option $opt" ERROR=true esac done if [ "$ERROR" = true ]; then cat << EOF >&2 Usage: $0 [-r] [-s] -r Also displays packages that are recommended by other -s Also displays packages that are suggested by other EOF exit 1 fi DEPENDS=`tempfile` dpkg-query -W -f="\${Status}:\${Depends}${RECOMMENDS}${SUGGESTS}\n" \ | |grep 'ok installed'|cut -d: -f2 \ | tr ', ' '\012' | sort | uniq > $DEPENDS while read SIZE PACKAGE ; do if ! grep -q "^$PACKAGE\$" $DEPENDS; then echo $SIZE $PACKAGE fi done rm -f $DEPENDS