+#!/bin/sh
+
+pkgfile=${ZPMDB:-/var/lib/zpm/db.zpm}
+
+while getopts f: opt; do
+ case $opt in
+ f) pkgfile="$OPTARG" ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+set -e
+
+if [ ! -f $pkgfile ]; then
+ echo cannot find $pkgfile
+ exit 1
+fi
+
+
+for pkg in "$@"; do
+ pkgid=$(zpm findpkg $pkgfile $pkg)
+
+ zpm shell $pkgfile <<EOS
+.separator "\t"
+select package, version, release,
+path || case when hash is null then '/' else '' end
+from packagefiles
+where printf('%s-%s-%s', package,version,release) = '$pkgid'
+;
+EOS
+
+done