#!/bin/sh # # Author: Christophe Lohr # License: GPL # v0.3 - Fri, 08 May 2009 15:21:46 +0200 RECOMMENDS=' ${Recommends}' SUGGESTS=' ${Suggests}' EXCLUDE_LIST="" EXCLUDE_DEPS=cat while test $# -gt 0 ; do case $1 in '-r') RECOMMENDS='' shift ;; '-s') SUGGESTS='' shift ;; '-e') shift EXCLUDE_LIST=$1 EXCLUDE_DEPS="grep -v" for PKG in $1; do EXCLUDE_DEPS="$EXCLUDE_DEPS -e ^$PKG:" done shift ;; *) echo "Unknown option $1" ERROR=true esac done # Note: # "EXCLUDE_DEPS" is used to filter out dependencies clamed by these packets # "EXCLUDE_LIST" is added to the final list of packets to ignore if [ "$ERROR" = true ]; then cat << EOF >&2 Usage: $0 [-r] [-s] [-e " [ ...]" ] -r Also displays packages that are recommended by other -s Also displays packages that are suggested by other -e List of packets to exclude (a quoted list of package names separated by blanks) i.e. work as these packets were not installed on the system EOF exit 1 fi DEPENDS=`tempfile` dpkg-query -W -f="\${Package}:\${Status}:\${Depends}${RECOMMENDS}${SUGGESTS}\n" \ | $EXCLUDE_DEPS | grep 'ok installed:' | cut -d: -f3 \ | sed -e "1i$EXCLUDE_LIST" | tr ', ' '\012' | sort | uniq > $DEPENDS while read SIZE PACKAGE ; do if ! grep -q "^$PACKAGE\$" $DEPENDS; then echo $SIZE $PACKAGE fi done rm -f $DEPENDS