From c011a2749b3f5901eb17474edff5c3b547d4eec1 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 18 Nov 2011 14:05:51 +0100 Subject: [PATCH] xbps-src: use XBPS_LIBEXECDIR and XBPS_SHAREDIR in all scripts that need substs. --- xbps-src/libexec/chroot-helper.sh.in | 4 ++-- xbps-src/libexec/doinst-helper.sh.in | 12 +----------- xbps-src/shutils/chroot.sh.in | 10 ++++++---- xbps-src/shutils/pkgtarget_funcs.sh.in | 9 ++------- xbps-src/xbps-src.sh.in | 2 ++ 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/xbps-src/libexec/chroot-helper.sh.in b/xbps-src/libexec/chroot-helper.sh.in index 93476ddee93..a3b2f3551d0 100644 --- a/xbps-src/libexec/chroot-helper.sh.in +++ b/xbps-src/libexec/chroot-helper.sh.in @@ -55,7 +55,7 @@ mount_chroot_fs() continue fi [ ! -d ${blah} ] && echo "failed." && continue - @@XBPS_INSTALL_LIBEXECDIR@@/capmount \ + ${XBPS_LIBEXECDIR}/capmount \ ${dowrite} ${blah} ${MASTERDIR}/${f} \ 2>/dev/null if [ $? -eq 0 ]; then @@ -85,7 +85,7 @@ umount_chroot_fs() echo ${cnt} > ${MASTERDIR}/.${fs}_mount_bind_done else echo -n "=> Unmounting ${fs} from chroot... " - @@XBPS_INSTALL_LIBEXECDIR@@/capumount \ + ${XBPS_LIBEXECDIR}/capumount \ ${MASTERDIR} ${fs} 2>/dev/null if [ $? -eq 0 ]; then rm -f ${MASTERDIR}/.${fs}_mount_bind_done diff --git a/xbps-src/libexec/doinst-helper.sh.in b/xbps-src/libexec/doinst-helper.sh.in index c99859abd2b..742b5f930e4 100644 --- a/xbps-src/libexec/doinst-helper.sh.in +++ b/xbps-src/libexec/doinst-helper.sh.in @@ -28,23 +28,13 @@ PKG_TMPLNAME="$1" if [ -n "${CONFIG_FILE}" -a -r "${CONFIG_FILE}" ]; then . ${CONFIG_FILE} -else - if [ -n "$IN_CHROOT" ]; then - . /usr/local/etc/xbps-src.conf - else - . @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf - fi fi if [ -n "${MASTERDIR}" ]; then export XBPS_MASTERDIR="${MASTERDIR}" fi -if [ -n "$IN_CHROOT" ]; then - . /usr/local/share/xbps-src/shutils/init_funcs.sh -else - . @@XBPS_INSTALL_SHAREDIR@@/shutils/init_funcs.sh -fi +. ${XBPS_SHAREDIR}/shutils/init_funcs.sh set_defvars diff --git a/xbps-src/shutils/chroot.sh.in b/xbps-src/shutils/chroot.sh.in index 1731b90b3e6..7e21315f8f2 100644 --- a/xbps-src/shutils/chroot.sh.in +++ b/xbps-src/shutils/chroot.sh.in @@ -26,16 +26,18 @@ _mount() { MASTERDIR="${XBPS_MASTERDIR}" DISTRIBUTIONDIR="${XBPS_DISTRIBUTIONDIR}" \ - HOSTDIR="${XBPS_HOSTDIR}" ${SUDO_CMD} \ - @@XBPS_INSTALL_LIBEXECDIR@@/chroot-helper mount + HOSTDIR="${XBPS_HOSTDIR}" XBPS_ETCDIR="${XBPS_ETCDIR}" \ + XBPS_SHAREDIR="${XBPS_SHAREDIR}" ${SUDO_CMD} \ + ${XBPS_LIBEXECDIR}/chroot-helper mount return $? } _umount() { MASTERDIR="${XBPS_MASTERDIR}" DISTRIBUTIONDIR="${XBPS_DISTRIBUTIONDIR}" \ - HOSTDIR="${XBPS_HOSTDIR}" ${SUDO_CMD} \ - @@XBPS_INSTALL_LIBEXECDIR@@/chroot-helper umount + HOSTDIR="${XBPS_HOSTDIR}" XBPS_ETCDIR="${XBPS_ETCDIR}" \ + XBPS_SHAREDIR="${XBPS_SHAREDIR}" ${SUDO_CMD} \ + ${XBPS_LIBEXECDIR}/chroot-helper umount return $? } diff --git a/xbps-src/shutils/pkgtarget_funcs.sh.in b/xbps-src/shutils/pkgtarget_funcs.sh.in index da0e7492e10..f28bd1bcd5f 100644 --- a/xbps-src/shutils/pkgtarget_funcs.sh.in +++ b/xbps-src/shutils/pkgtarget_funcs.sh.in @@ -129,19 +129,14 @@ install_pkg() fi fi - if [ -n "$IN_CHROOT" ]; then - DOINST_HELPER=/usr/local/libexec/doinst-helper - else - DOINST_HELPER=@@XBPS_INSTALL_LIBEXECDIR@@/doinst-helper - fi - # Install pkg into destdir. env XBPS_MACHINE=${XBPS_MACHINE} wrksrc=${wrksrc} \ MASTERDIR="${XBPS_MASTERDIR}" \ BOOTSTRAP_PKG_REBUILD=$BOOTSTRAP_PKG_REBUILD \ CONFIG_FILE=${XBPS_CONFIG_FILE} \ ${FAKEROOT_CMD} ${FAKEROOT_CMD_ARGS} \ - ${DOINST_HELPER} ${curpkgn} || return $? + ${XBPS_LIBEXECDIR}/doinst-helper ${curpkgn} \ + || return $? # Strip binaries/libraries. strip_files diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index a5c60cd703e..6205c59b3f0 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -28,9 +28,11 @@ readonly XBPS_SRC_BUILD_VERSION=20111118 if [ -n "$IN_CHROOT" ]; then export XBPS_ETCDIR=/usr/local/etc/xbps export XBPS_SHAREDIR=/usr/local/share/xbps-src + export XBPS_LIBEXECDIR=/usr/local/libexec else export XBPS_ETCDIR=@@XBPS_INSTALL_ETCDIR@@ export XBPS_SHAREDIR=@@XBPS_INSTALL_SHAREDIR@@ + export XBPS_LIBEXECDIR=@@XBPS_INSTALL_LIBEXECDIR@@ fi XBPS_CONFIG_FILE=${XBPS_ETCDIR}/xbps-src.conf