diff --git a/xbps-src/libexec/xbps-src-chroot-helper.sh.in b/xbps-src/libexec/xbps-src-chroot-helper.sh.in index 261bb48d5a..2e592b221a 100644 --- a/xbps-src/libexec/xbps-src-chroot-helper.sh.in +++ b/xbps-src/libexec/xbps-src-chroot-helper.sh.in @@ -60,7 +60,8 @@ mount_chroot_fs() echo 1 > ${XBPS_MASTERDIR}/.${f}_mount_bind_done echo "done." else - echo "failed." + echo "FAILED!!!!!" + exit 1 fi else cnt=$(cat ${XBPS_MASTERDIR}/.${f}_mount_bind_done) @@ -74,6 +75,10 @@ umount_chroot_fs() { local fs dir cnt + if [ -f ${XBPS_MASTERDIR}/.xbps_chroot_working ]; then + return 0 + fi + for fs in ${REQFS}; do [ ! -f ${XBPS_MASTERDIR}/.${fs}_mount_bind_done ] && continue cnt=$(cat ${XBPS_MASTERDIR}/.${fs}_mount_bind_done) @@ -88,7 +93,7 @@ umount_chroot_fs() rm -f ${XBPS_MASTERDIR}/.${fs}_mount_bind_done echo "done." else - echo "failed." + echo "FAILED!!!" fi fi unset fs diff --git a/xbps-src/shutils/chroot.sh.in b/xbps-src/shutils/chroot.sh.in index 04fe7beb4c..c0e1332168 100644 --- a/xbps-src/shutils/chroot.sh.in +++ b/xbps-src/shutils/chroot.sh.in @@ -224,9 +224,7 @@ _mount() xbps_chroot_handler() { - local action="$1" - local pkg="$2" - local norm_builddir="$3" + local action="$1" pkg="$2" norm_builddir="$3" rv=0 local path="/tools/bin:/usr/local/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin" [ -z "$action" -o -z "$pkg" ] && return 1 @@ -258,18 +256,21 @@ xbps_chroot_handler() "cd /xbps/xbps-src && make IN_CHROOT=1 install clean" \ 2>&1 >/dev/null || return $? + touch -f ${XBPS_MASTERDIR}/.xbps_chroot_working + if [ "$action" = "chroot" ]; then env in_chroot=yes IN_CHROOT=1 LANG=C PATH=$path \ - ${chroot_cmd} $XBPS_MASTERDIR /bin/sh || return $? + ${chroot_cmd} $XBPS_MASTERDIR /bin/sh || rv=$? else [ "$norm_builddir" = "yes" ] && \ action="-C $action" env in_chroot=yes LANG=C PATH=$path _ORIGINPKG="$pkg" \ ${chroot_cmd} $XBPS_MASTERDIR sh -c \ - "cd /xbps/srcpkgs/$pkg && xbps-src $action" || return $? + "cd /xbps/srcpkgs/$pkg && xbps-src $action" || rv=$? fi + rm -f ${XBPS_MASTERDIR}/.xbps_chroot_working msg_normal "Exiting from the chroot on $XBPS_MASTERDIR." - return $? + return $rv }