xbps-src: only umount bind mounts in the chroot shell fragment.

This commit is contained in:
Juan RP 2011-02-11 14:19:34 +01:00
parent 97ed70429b
commit 85543cd319
2 changed files with 8 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008-2010 Juan Romero Pardines.
# Copyright (c) 2008-2011 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -27,8 +27,7 @@
# Script to install packages into a sandbox in masterdir.
# Actually this needs the xbps-base-chroot package installed.
#
trap "echo && chroot_handler_interrupted $?" INT QUIT TERM
trap "_umount && return $?" 0 INT QUIT TERM
[ -n "$base_chroot" ] && return 0
@ -230,14 +229,11 @@ _mount()
return $?
}
chroot_handler_interrupted()
_umount()
{
local rv="$1"
if [ -f ${XBPS_MASTERDIR}/.xbps_chroot_working ]; then
rm -f ${XBPS_MASTERDIR}/.xbps_chroot_working
fi
return $rv
MASTERDIR="${XBPS_MASTERDIR}" ${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
return $?
}
xbps_chroot_handler()
@ -274,8 +270,6 @@ 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 || \
@ -289,7 +283,6 @@ xbps_chroot_handler()
rv=$?
fi
rm -f ${XBPS_MASTERDIR}/.xbps_chroot_working
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR.\n"
return $rv

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) 2008-2010 Juan Romero Pardines.
# Copyright (c) 2008-2011 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -23,6 +23,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#-
: ${XBPS_CONFIG_FILE:=@@XBPS_INSTALL_ETCDIR@@/xbps-src.conf}
: ${progname:=$(basename $0)}
@ -33,19 +34,6 @@
: ${xbps_machine:=$(uname -m)}
: ${XBPS_UTILS_REQVER:=20100511}
trap '_MASTERDIR=${XBPS_MASTERDIR} sighandler_exit $?' 0 INT QUIT
sighandler_exit()
{
# Always unmount in case we failed before!
if [ -z "$in_chroot" ]; then
cd ${_MASTERDIR} && \
env MASTERDIR="${_MASTERDIR}" \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
fi
exit $1
}
check_reqhost_utils()
{
[ -n "$in_chroot" ] && return 0