xbps-src: always try to unmount via xbps-src-chroot-helper before exiting.

This commit is contained in:
Juan RP 2010-05-14 14:48:55 +02:00
parent 0d4d02dd91
commit a599311f15
3 changed files with 16 additions and 10 deletions

View file

@ -98,8 +98,9 @@ umount_chroot_fs()
done
# Remove created dirs
[ -f ${XBPS_MASTERDIR}/.xbps_mount_bind_done ] && continue
[ -d ${XBPS_MASTERDIR}/xbps ] && rmdir ${XBPS_MASTERDIR}/xbps
if [ ! -f ${XBPS_MASTERDIR}/.xbps_mount_bind_done ]; then
[ -d ${XBPS_MASTERDIR}/xbps ] && rmdir ${XBPS_MASTERDIR}/xbps
fi
}
if [ $# -ne 1 ]; then

View file

@ -28,10 +28,6 @@
# Actually this needs the xbps-base-chroot package installed.
#
# Umount stuff if SIGINT or SIGQUIT was caught
trap "MASTERDIR=${XBPS_MASTERDIR} ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount && exit $?" INT QUIT
[ -n "$base_chroot" ] && return 0
if [ "${chroot_cmd}" = "chroot" ]; then
@ -277,8 +273,7 @@ xbps_chroot_handler()
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" || \
rv=$? && _umount && return $rv
"cd /xbps/srcpkgs/$pkg && xbps-src $action" || return $?
fi
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."

View file

@ -23,8 +23,6 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
trap "echo && exit 1" INT QUIT
: ${XBPS_CONFIG_FILE:=@@XBPS_INSTALL_ETCDIR@@/xbps-src.conf}
: ${progname:=$(basename $0)}
@ -35,6 +33,18 @@ trap "echo && exit 1" INT QUIT
: ${xbps_machine:=$(uname -m)}
: ${XBPS_UTILS_REQVER:=20100511}
trap 'sighandler_exit $?' 0 INT QUIT
sighandler_exit()
{
# Always unmount in case, we failed before!
if [ -z "$in_chroot" ]; then
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
fi
[ -n "$1" ] && exit $1
exit $?
}
usage()
{
cat << _EOF