X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-addtopackage;h=1964b77589e29f6cf58778cb3b8e24fdc4a57cc0;hb=d11b147990e969dc101bb34e744380199028a90f;hp=19db69baf815782966b84c7239aa1b17f5317489;hpb=0449ff362882dcd399c7d65ec8a40f8f0763b3ca;p=zpackage diff --git a/zpm-addtopackage b/zpm-addtopackage index 19db69b..1964b77 100755 --- a/zpm-addtopackage +++ b/zpm-addtopackage @@ -1,7 +1,5 @@ #!/bin/sh -package=${1:-$ZPMPACKAGE} -shift pkgver=${ZPMPKGVER:-1.0} pkgrel=${ZPMPKGREL:-1} @@ -20,8 +18,14 @@ while getopts :f:v:r:d:a:u:l:p:b:P: opt; do p) packager="$OPTARG" ;; b) builddate="$OPTARG" ;; P) prefix="$OPTARG" ;; + t) tags="$OPTARG" ;; + c) tags="$tags +configuration" ;; esac done +shift $((OPTIND - 1)) + +package="$1" +shift set -e if [ -z "$pkgfile" ]; then @@ -31,20 +35,16 @@ fi if [ ! -f $pkgfile ]; then zpm newpackage $package || exit 1 else - appid=$(sqlite3 $pkgfile 'pragma application_id;' | ( echo obase = 16; cat - ) | bc) - if [ "$appid" != "5A504442" ]; then - echo $pkgfile does not appear to be a zpm package file - exit 1 - fi + zpm test -v $pkgfile fi for path in $*; do - mtime=$(zpm stat -t '%y' $path) - uid=$(zpm stat -t '%u' $path) - gid=$(zpm stat -t '%g' $path) - username=$(zpm stat -t '%U' $path) - groupname=$(zpm stat -t '%G' $path) - mode=$(zpm stat -t '%a' $path) + mtime=$(zpm stat -f '%y' $path) + uid=$(zpm stat -f '%u' $path) + gid=$(zpm stat -f '%g' $path) + username=$(zpm stat -f '%U' $path) + groupname=$(zpm stat -f '%G' $path) + mode=$(zpm stat -f '%a' $path) # strip off leading slashes rpath=$(echo "$path" | sed -e 's|^/*||') @@ -62,35 +62,34 @@ for path in $*; do rpath="$prefix/$rpath" fi - if [ -f "$path" ]; then - - hash=$(zpm addfile $pkgfile $path) - -#if [ -z "$hash" ]; then continue; fi + filetype=$(zpm stat -f '%t' "$path") + hash='NULL' + target='NULL' + case "$filetype" in + regular) + filetype=d + hash=$(zpm addfile $pkgfile "$path") + hash="'$hash'" + filetype=r + ;; + directory) + filetype=d + ;; + symlink) + filetype=l + target=$(readlink $path) + target="'$target'" + ;; + esac -# TODO mtime, mode -sqlite3 $pkgfile < $target"} printf "%s\n" $path done