3 # zpm-list [-s status] [-vn] [ -f pkgfile ] [pkgid ...]
9 while getopts :s:f:vnIF: opt; do
11 f) pkgfile="$OPTARG" ;;
12 s) status="$OPTARG" ;;
13 I) status=installed ;;
17 F) filter="$OPTARG" ;;
20 shift $(( OPTIND - 1))
22 : ${pkgfile:=${ZPMDB:-/var/lib/zpm/local.db}}
24 if [ -z "$pkgfile" ]; then
25 echo "must specify package file"
29 if [ $nameonly -eq 0 ]; then
35 if [ $verbose -eq 1 ]; then
36 cols="$cols,coalesce(status,'-')"
39 if [ -n "$status" ]; then
40 status=$(zpm quote "$status")
41 where="and status = '$status'"
44 if [ -n "$filter" ]; then
45 where="$where and ($filter)"
50 if [ -n "$pkgid" ]; then
51 eval $(zpm parse -E "$pkgid")
52 if [ -n "$name" ]; then
53 package=$(zpm quote "$name")
54 where="$where and package = '$package'"
56 if [ -n "$version" ]; then
57 version=$(zpm quote "$version")
58 where="$where and version = '$version'"
60 if [ -n "$release" ]; then
61 release=$(zpm quote "$release")
62 where="$where and release = '$release'"
66 zpm shell $pkgfile <<EOS
68 select $cols from packages_pkgid where true $where
73 echo "select $cols from packages_pkgid where true $where" 1>&2