X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-addtopackage;h=cccd12de666d3ce2c0574207583f2120401448db;hb=9daff10c7cf0cf1b983fca4a90065611ad0d3bf9;hp=f096ea2eaef6c6eb2c2b0a2ec20c8d2c2720e0f2;hpb=cd99bcfaa954c059bbae5fcaf89117fb493d91c7;p=zpackage diff --git a/zpm-addtopackage b/zpm-addtopackage index f096ea2..cccd12d 100755 --- a/zpm-addtopackage +++ b/zpm-addtopackage @@ -20,6 +20,8 @@ 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 @@ -31,20 +33,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=$(stat -c '%Y' $path) - uid=$(stat -c '%u' $path) - gid=$(stat -c '%g' $path) - username=$(stat -c '%U' $path) - groupname=$(stat -c '%G' $path) - mode=$(stat -c '%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 +60,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