X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-add;h=91c7b189610834679c3af386b7449d9a3a696e4d;hb=ada8405d470a7b13eba173bcacfd660e13dfed0d;hp=5d84d543e294323aa73305bcbaf9b958648e31ca;hpb=c0c274bfcf9710c279c8438e55f33ebeed3a3f9b;p=zpackage diff --git a/zpm-add b/zpm-add index 5d84d54..91c7b18 100755 --- a/zpm-add +++ b/zpm-add @@ -32,11 +32,14 @@ cleanpath() { verbose=0 tags= isconfig=0 +addcontent=1 # option for "multipackage" just to let the system know that's what you meant # option to take filenames from stdin # parse package, version, release from file if not given -while getopts :f:vr:l:P:S:cu:g: opt; do +# TODO -l follow symlinks, -L follow symlinks, adding all, links and targets +while getopts :f:vr:l:P:S:cu:g:N opt; do case $opt in + N) addcontent=0 ;; f) pkgfile="$OPTARG" ;; P) prefix="$OPTARG" ;; S) strip=$(cleanpath "$OPTARG"); ;; @@ -70,7 +73,7 @@ if [ -z "$release" ]; then if [ -z "$pkgfile" ]; then die "cannot determine package file" else - pkgstr=$(zpm findpkg $pkgfile $pkgid) + pkgstr=$(zpm findpkg -f $pkgfile $pkgid) if [ -z "$pkgstr" ]; then die "unable to find package id for $pkgid in $pkgfile" fi @@ -142,15 +145,19 @@ for path in $*; do rpath="$prefix/$rpath" fi - filetype=$(zpm stat -f '%t' "$path") + filetype=$(zpm stat -l -f '%t' "$path") hash='NULL' target='NULL' case "$filetype" in regular) filetype=r - hash=$(zpm addfile $pkgfile "$path") - if [ $? -ne 0 ]; then - die "zpm addfile failed ($?): $pkgfile $path" + if [ $addcontent -eq 1 ]; then + hash=$(zpm addfile $pkgfile "$path") + if [ $? -ne 0 ]; then + die "zpm addfile failed ($?): $pkgfile $path" + fi + else + hash=$(zpm hash "$path") fi hash="'$hash'" ;; @@ -175,5 +182,8 @@ commit; EOS #printf "%s %s%s\n" $path $rpath ${target:+" -> $target"} -printf "%s\n" $path +if [ $verbose -gt 0 ]; then + printf "%s\n" $path +fi + done