3 pkgfile=${ZPMDB:-/var/lib/zpm/db.zpm}
9 while getopts f:qln opt; do
11 f) pkgfile="$OPTARG" ;;
19 if [ ! -f $pkgfile ]; then
20 echo cannot find $pkgfile
24 if [ $long -gt 0 ]; then
25 cols="filetype,printf('%3.3s', mode) as mode,username,groupname,"
28 if [ $pkgonly -eq 1 ]; then
30 elif [ $quiet -eq 0 ]; then
35 while [ $# -gt 0 ]; do
38 if [ "$pkg" = '--' ]; then
42 pkgid=$(zpm findpkg -f $pkgfile "$pkg")
43 if [ -n "$pkgid" ]; then
44 q=$(zpm quote -q "$pkgid")
47 warn "package $pkg not found, ignoring"
54 q=$(zpm quote -q "$glob")
55 globlist="or path glob $q"
57 globlist=${globlist#'or '}
62 printf '.separator " "\n'
63 printf 'select %s\n' "$cols"
65 if [ $pkgonly -eq 0 ]; then
66 if [ -n "$cols" ]; then
71 case when filetype = 'd' then
72 rtrim(path,'/') || '/'
78 printf 'from packagefiles_pkgid\nwhere true\n'
79 if [ -n "$globlist" ]; then
80 printf "and (%s)\n" "$globlist"
82 if [ -n "$pkglist" ]; then
83 printf "and pkgid in (%s)\n" "$pkglist"
85 printf 'order by pkgid,path\n'
87 } | zpm shell $pkgfile