X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=zpm-install;h=29d8c5d2fc270f0299bc5ecfcbbd46b280c405e1;hb=22da8d52b3a8a7556b81c3e921d5c4555b76b799;hp=d0f2f32cf48bf64d8451753503641051e0f75ca2;hpb=214fd7d30098cb9dad0fb2a7b522b262512d3892;p=zpackage diff --git a/zpm-install b/zpm-install index d0f2f32..29d8c5d 100755 --- a/zpm-install +++ b/zpm-install @@ -1,5 +1,9 @@ #!/bin/sh +warn() { + echo $* 1>&2 +} + die() { echo $* 1>&2 exit 1 @@ -84,7 +88,7 @@ package=$(zpm quote "$name") pkgver=$(zpm quote "$version") pkgrel=$(zpm quote "$release") -if [ -z "$rootdir" ]; then +if [ -n "$rootdir" ]; then : rootdir=${rootdir%%/} fi @@ -93,6 +97,9 @@ if [ -z "$localdb" ]; then fi if [ ! -f "$localdb" ]; then + if [ -n "$rootdir" ] && [ ! -d $rootdir ]; then + mkdir $rootdir || die "can't create $rootdir: $!" + fi for d in /var /var/lib /var/lib/zpm; do test -d $rootdir/$d || mkdir $rootdir/$d || die "can't create $rootdir/$d/: $!" done @@ -213,7 +220,9 @@ for pkgstr in "$@"; do fi if [ $(id -u) -eq 0 ]; then - if [ -f $rootdir/sbin/ldconfig ]; then + if [ ! -d $rootdir/etc ]; then + warn "no etc directory in $rootdir, skipping ldconfig" + elif [ -f $rootdir/sbin/ldconfig ]; then $rootdir/sbin/ldconfig -r ${rootdir:-/} elif [ -f /sbin/ldconfig ]; then /sbin/ldconfig -r ${rootdir:-/}