]> pd.if.org Git - zpackage/commitdiff
add user and group to addtopackage
authorNathan Wagner <nw@hydaspes.if.org>
Tue, 31 Jul 2018 18:56:42 +0000 (18:56 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Tue, 31 Jul 2018 18:56:42 +0000 (18:56 +0000)
zpm-addtopackage

index aca92eaf8bed8eece96df30d450a22b4a111447d..1b7bff4d3296d34e15cb08544709f98d7646569b 100755 (executable)
@@ -31,7 +31,7 @@ create=0
 # 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:v:r:l:P:S:Cc opt; do
+while getopts :f:v:r:l:P:S:Ccu:g: opt; do
        case $opt in
                f) pkgfile="$OPTARG" ;;
                v) pkgver="$OPTARG" ;;
@@ -42,6 +42,8 @@ while getopts :f:v:r:l:P:S:Cc opt; do
                t) tags="$tags $OPTARG" ;;
                c) tags="$tags configuration" ;;
                C) create=1 ;;
+               u) username="$OPTARG" ;;
+               g) groupname="$OPTARG" ;;
                *) echo 'unknown option' $opt; exit 1 ;;
        esac
 done
@@ -77,8 +79,8 @@ for path in $*; do
        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)
+       : ${username:=$(zpm stat -f '%U' $path)}
+       : ${groupname:=$(zpm stat -f '%G' $path)}
        mode=$(zpm stat -f '%a' $path)
        rpath="$path"