new topic: quick and dirty rpm related tools

Kimiko Koopman <[email protected]> Sat, 17 Aug 2002 10:37:56 +0200
Newsgroups gmane.linux.redhat.rpm.grab
Message-ID <20020817083755.GA9352@brokenmoon>
This little script searches for installed leaf packages and lists them
alphabetically:

#!/bin/zsh
pattern=${1:-*}
packages=`rpm -qa | sort`
foreach package (${(s:
:)packages})
  if [[ ${package/${~pattern}/x} == x ]] {
    response=`rpm --test -e $package 2>&1`
    if [[ $response == '' ]] {
      echo $package
    } else {
#      echo $package is needed.
    }
  }
end

You can give it a globbing pattern to limit the search to matching packages.
For example, ckrpm x\* will search only packages with a name starting with 'x'.
It uses rpm -e to avoid parsing the often lengthy output of rpm -q --requires
and rpm -q --provides.

Kimiko