3 # zpm-list [-s status] [-vn] [ -f pkgfile ] [pkgid ...]
9 while getopts :s:f:vnI opt; do
11 f) pkgfile="$OPTARG" ;;
12 s) status="$OPTARG" ;;
13 I) status=installed ;;
19 shift $(( OPTIND - 1))
21 : ${pkgfile:=${ZPMDB:-/var/lib/zpm/local.db}}
23 if [ -z "$pkgfile" ]; then
24 echo "must specify package file"
28 if [ $nameonly -eq 0 ]; then
34 if [ $verbose -eq 1 ]; then
35 cols="$cols,coalesce(status,'-')"
38 if [ -n "$status" ]; then
39 status=$(zpm quote "$status")
40 where="and status = '$status'"
45 if [ -n "$pkgid" ]; then
46 eval $(zpm parse -E "$pkgid")
47 if [ -n "$name" ]; then
48 package=$(zpm quote "$name")
49 where="$where and package = '$package'"
51 if [ -n "$version" ]; then
52 version=$(zpm quote "$version")
53 where="$where and version = '$version'"
55 if [ -n "$release" ]; then
56 release=$(zpm quote "$release")
57 where="$where and release = '$release'"
61 zpm shell $pkgfile <<EOS
63 select $cols from packages_pkgid where true $where
68 echo "select $cols from packages_pkgid where true $where" 1>&2