3 pkgfile=${ZPMDB:-/var/lib/zpm/db.zpm}
10 while getopts f:qlncC opt; do
12 f) pkgfile="$OPTARG" ;;
22 if [ ! -f $pkgfile ]; then
23 echo cannot find $pkgfile
27 if [ $long -gt 0 ]; then
28 cols="filetype,printf('%.4s', mode) as mode,username,groupname,"
31 if [ $pkgonly -eq 1 ]; then
33 elif [ $quiet -eq 0 ]; then
38 while [ $# -gt 0 ]; do
41 if [ "$pkg" = '--' ]; then
45 pkgid=$(zpm findpkg -f $pkgfile "$pkg")
46 if [ -n "$pkgid" ]; then
47 q=$(zpm quote -q "$pkgid")
50 warn "package $pkg not found, ignoring"
57 q=$(zpm quote -q "$glob")
58 globlist="or path glob $q"
60 globlist=${globlist#'or '}
65 printf '.separator " "\n'
66 printf 'select %s\n' "$cols"
68 if [ $pkgonly -eq 0 ]; then
69 if [ -n "$cols" ]; then
74 printf "when filetype = 'd' then rtrim(path,'/') || '/'\n"
75 printf "when filetype = 'l' then printf('%s -> %s', path, target)\n"
76 printf "else path end as path\n"
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"
86 only) printf "and configuration = 1\n" ;;
87 exclude) printf "and configuration = 0\n" ;;
89 printf 'order by pkgid,path\n'
91 } | zpm shell $pkgfile