]> pd.if.org Git - zpackage/blobdiff - zpm-list
add -s option to stat to print file size
[zpackage] / zpm-list
index 471a2809a2e370f2372f7661cb326d1c089232a0..2de524b0e89c0e64c9162970deb1103b020e4b39 100755 (executable)
--- a/zpm-list
+++ b/zpm-list
@@ -15,17 +15,13 @@ while getopts :s:f:vn opt; do
 done
 shift $(( OPTIND - 1))
 
-: ${pkgfile:=$ZPMDB}
+: ${pkgfile:=${ZPMDB:-/var/lib/zpm/local.db}}
 
 if [ -z "$pkgfile" ]; then
        echo "must specify package file"
        exit 1
 fi
 
-if [ -n "$status" ]; then
-       status=$(zpm quote "$status")
-fi
-
 if [ $nameonly -eq 0 ]; then
        cols="pkgid"
 else
@@ -37,6 +33,7 @@ if [ $verbose -eq 1 ]; then
 fi
 
 if [ -n "$status" ]; then
+       status=$(zpm quote "$status")
        where="where status = '$status'"
 fi
 
@@ -44,8 +41,8 @@ pkgid=$1
 
 if [ -n "$pkgid" ]; then
        eval $(zpm parse -E "$pkgid")
-       if [ -n "$package" ]; then
-               package=$(zpm quote "$package")
+       if [ -n "$name" ]; then
+               package=$(zpm quote "$name")
                where="$where and package = '$package'"
        fi
        if [ -n "$version" ]; then
@@ -63,4 +60,3 @@ zpm shell $pkgfile <<EOS
 select $cols from packages_pkgid $where
 ;
 EOS
-