pkgfile=${ZPMDB:-/var/lib/zpm/db.zpm}
-while getopts f: opt; do
+pathglob=0
+
+while getopts f:g opt; do
case $opt in
f) pkgfile="$OPTARG" ;;
+ g) pathglob=1 ;;
esac
done
shift $((OPTIND - 1))
+if [ $pathglob -eq 1 ]; then
+ pathop='glob'
+else
+ pathop='='
+fi
+
set -e
if [ ! -f $pkgfile ]; then
fi
if [ $field = delete ]; then
- printf "delete from packagefiles_pkgid where pkgid = '%s' and path = '%s';\n" "$pkgid" "$path"
+ printf "delete from packagefiles_pkgid where pkgid = '%s' and path $pathop '%s';\n" "$pkgid" "$path"
else
vfield=$(zpm quote "$field")
field=$(zpm quote -i "$field")
if [ $show -eq 1 ]; then
- printf "select %s from packagefiles_pkgid where pkgid = '%s' and path='$path';\n" "$field" "$pkgid"
+ printf "select %s from packagefiles_pkgid where pkgid = '%s' and path $pathop '$path';\n" "$field" "$pkgid"
continue
fi
value=$(zpm quote -q "$value")
fi
- printf "update packagefiles_pkgid set %s = %s where pkgid = '$pkgid' and path='$path';\n" $field $value
+ printf "update packagefiles_pkgid set %s = %s where pkgid = '$pkgid' and path $pathop '$path';\n" $field $value
fi
done