]> pd.if.org Git - zpackage/blobdiff - zpm-contents
add zpm-contents script
[zpackage] / zpm-contents
diff --git a/zpm-contents b/zpm-contents
new file mode 100755 (executable)
index 0000000..0d1a027
--- /dev/null
@@ -0,0 +1,32 @@
+#!/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