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
}
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
# 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
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