Ten minute script to get useful Solaris pkg info

I grew bored with the default Solaris package management tools.

bash-2.05$ cat pkghelp
#!/bin/sh
# Script to yank stuff out of Solaris
# Copyright 2004, Jason Boxman.
# Released under the GNU GPL.
set +x
case $1 in
        search)
        pkginfo -d /var/sadm/pkg/ -i | grep $2
        ;;
        info)
        pkginfo -x $2
        ;;
        contents)
        if [ -f $2 ] ; then
                pkgtrans -i $2 /tmp $3
                cat /tmp/$3/pkgmap
                rm -rf /tmp/$3
        else
                grep $2 /var/sadm/install/contents
        fi
        ;;
        *)
        echo
        echo "`basename $0`:"
        echo
        echo "search string"
        echo "info SUNWpkg"
        echo "contents [string|filename SUNWpkg]"
        echo
        ;;
esac