From: Nathan Wagner Date: Sun, 5 Mar 2017 15:03:14 +0000 (-0600) Subject: improve file handling for addtopackage X-Git-Tag: v0.1.6~138 X-Git-Url: https://pd.if.org/git/?a=commitdiff_plain;h=cc86639ed2cb9237b75ddb603b101929a3ee71d6;p=zpackage improve file handling for addtopackage --- diff --git a/zpm-addtopackage b/zpm-addtopackage index 19db69b..05c3596 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 @@ -39,12 +41,12 @@ else 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 +64,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