From f369a2244b7ab681661e2ac9fa1b5b9b9ea4860f Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Sun, 30 Sep 2018 12:15:05 +0000 Subject: [PATCH] add option to zpm-add to not absorb file content With -N file contents of regular files will not be added to the database, only the metadata will be added to packagefiles. This allows a file to be marked as "owned" by a package, without actually importing the contents. --- zpm-add | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/zpm-add b/zpm-add index 1d68800..91c7b18 100755 --- a/zpm-add +++ b/zpm-add @@ -32,12 +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 # TODO -l follow symlinks, -L follow symlinks, adding all, links and targets -while getopts :f:vr:l:P:S:cu:g: opt; do +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"); ;; @@ -149,9 +151,13 @@ for path in $*; do 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'" ;; -- 2.40.0