X-Git-Url: https://pd.if.org/git/?p=zpackage;a=blobdiff_plain;f=zpm-pathmod;h=90c29c1d750ef9051e361c87f1d87bb977375c5a;hp=0a699fd827428b4d46c6121c4072bc61f1ea89a6;hb=77544f57c8617cf232cdf21e02924ae03d4da685;hpb=2d5fa477f3f74705a7c8657166cd1424b5b17544 diff --git a/zpm-pathmod b/zpm-pathmod index 0a699fd..90c29c1 100755 --- a/zpm-pathmod +++ b/zpm-pathmod @@ -24,13 +24,22 @@ die() { 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 @@ -94,7 +103,7 @@ while [ $# -gt 0 ]; do 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") @@ -107,7 +116,7 @@ while [ $# -gt 0 ]; do 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 @@ -117,7 +126,7 @@ while [ $# -gt 0 ]; do 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