diff --git a/common/xbps-src/shutils/chroot.sh b/common/xbps-src/shutils/chroot.sh index 63e004315c..8bd18ce835 100644 --- a/common/xbps-src/shutils/chroot.sh +++ b/common/xbps-src/shutils/chroot.sh @@ -164,7 +164,7 @@ chroot_handler() { local action="$1" pkg="$2" rv=0 arg= _envargs= _chargs= if [ -n "$IN_CHROOT" -o -z "$CHROOT_READY" ]; then - return 0 + return 1 fi # Debian uses /run/shm instead... if [ -d /run/shm ]; then diff --git a/xbps-src b/xbps-src index 65262b66fa..5f2fe3cad9 100755 --- a/xbps-src +++ b/xbps-src @@ -534,57 +534,38 @@ case "$XBPS_TARGET" in install_bbootstrap ;; bootstrap-update) - if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then - chroot_handler ${XBPS_TARGET} dummy - else - pkgver=xbps-src - remove_pkg_autodeps - ${XBPS_INSTALL_CMD} -yu - fi + chroot_handler ${XBPS_TARGET} || remove_pkg_autodeps + ${XBPS_INSTALL_CMD} -yu ;; chroot) chroot_handler chroot dummy ;; clean) if [ -z "$XBPS_TARGET_PKG" ]; then - if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then - chroot_handler remove-autodeps - else - pkgver=xbps-src - remove_pkg_autodeps - fi + chroot_handler remove-autodeps || remove_pkg_autodeps msg_normal "xbps-src: cleaning up masterdir...\n" rm -rf $XBPS_MASTERDIR/builddir $XBPS_MASTERDIR/destdir else read_pkg - if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then - chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || exit $? - else + chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || { remove_pkg_wrksrc $wrksrc remove_pkg_statedir if declare -f do_clean >/dev/null; then run_func do_clean fi - fi - remove_pkg $XBPS_CROSS_BUILD + remove_pkg $XBPS_CROSS_BUILD + } fi ;; remove-autodeps) - if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then - chroot_handler remove-autodeps - else - pkgver=xbps-src - remove_pkg_autodeps - fi + chroot_handler $XBPS_TARGET || remove_pkg_autodeps ;; fetch|extract|build|configure|install|pkg) BEGIN_INSTALL=1 read_pkg - if [ -n "$CHROOT_READY" -a -z "$IN_CHROOT" ]; then - chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG - else + chroot_handler $XBPS_TARGET $XBPS_TARGET_PKG || { install_pkg $XBPS_TARGET $XBPS_CROSS_BUILD - fi + } ;; remove|remove-destdir) read_pkg