From fc0e2fbaf7051e42be1a6449a5a004fb3e665d45 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Sun, 28 Oct 2018 12:29:24 +0000 Subject: [PATCH] add -m option to add to set file mode --- zpm-add | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zpm-add b/zpm-add index cfce783..68c986d 100755 --- a/zpm-add +++ b/zpm-add @@ -34,6 +34,7 @@ tags= isconfig=0 addcontent=1 complete=0 +mode= # 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 @@ -48,6 +49,7 @@ while getopts :f:vr:l:P:S:cu:g:NC opt; do c) isconfig=1 ;; u) username="$OPTARG" ;; g) groupname="$OPTARG" ;; + m) mode="$OPTARG" ;; v) verbose=$((verbose + 1)) ;; C) complete=1 ;; *) echo 'unknown option' $OPTARG; exit 1 ;; @@ -118,7 +120,10 @@ for path in $*; do mtime=$(zpm stat -f '%y' $path) uid=$(zpm stat -f '%u' $path) gid=$(zpm stat -f '%g' $path) - mode=$(zpm stat -f '%a' $path) + + if [ -z "$mode" ]; then + mode=$(zpm stat -f '%a' $path) + fi # only stat the file for the user and group name if not set on the # command line -- 2.40.0