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

index 5c23bdeb889a25e9d37fb2a34fec3bb31b9a66ba..589cb84adc3e9acd90fc7fba90293e5f2bbfe93a 100755 (executable)
@@ -53,18 +53,31 @@ pkgroot=/
 
 chroot=1
 
-while getopts :R:CNXf:d:Dt:T: opt; do
+for cf in /etc/zpmrc ~/.zpmrc ./.zpmrc; do
+       test -r $cf && . $cf
+done
+
+while getopts :R:CNXf:d:Dt:T:u:g: opt; do
        case $opt in
                R) pkgroot="$OPTARG" ;;
                C) chroot=0 ;;
                f) pkgfile="$OPTARG" ;;
+               u) user="$OPTARG" ;;
+               g) group="$OPTARG" ;;
+               d) ZPMDB="$OPTARG" ;;
        esac
 done
 
 shift $((OPTIND - 1))
 
+: ${ZPMDB:=/var/lib/zpm/db.zpm}
+
+export ZPMDB
+
 die() {
-       echo $* 1>&2
+       printf 'zpm-install:' 1>&2
+       printf ' %s' $* 1>&2
+       printf '\n' 1>&2
        exit 1
 }
 
@@ -104,6 +117,8 @@ installpkg() (
        package="$1"
 )
 
+zpm merge $pkgfile
+
 for pkg in $pkglist; do
        # TODO find scripts marked as pre-install
        # TODO if this is an upgrade, run pre-upgrade
@@ -111,7 +126,6 @@ for pkg in $pkglist; do
        # TODO get total size of install so we can do a progress bar
 
        # add package info to local package db
-       # zpm merge -L -f $pkgfile $pkg
        # check for conflicts
        # mark package in localdb as installing
        # zpm setmark installing $pkg
@@ -121,7 +135,7 @@ for pkg in $pkglist; do
        filecount=$(pathlist | wc -l)
        echo $filecount files
        #pathlist
-       pathlist | xargs zpm ipkgfile -R "$pkgroot" -f $pkgfile -- $pkg
+       pathlist | xargs zpm ipkgfile ${user+-u $user} ${group+-g $group} -R "$pkgroot" -f $pkgfile -- $pkg
 
        # TODO find scripts marked as post-install
        # TODO if this is an upgrade, run post-upgrade