From 85543cd319569ba3797ee73139351d609dddb65c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 11 Feb 2011 14:19:34 +0100 Subject: [PATCH] xbps-src: only umount bind mounts in the chroot shell fragment. --- xbps-src/shutils/chroot.sh.in | 19 ++++++------------- xbps-src/xbps-src.sh.in | 16 ++-------------- 2 files changed, 8 insertions(+), 27 deletions(-) diff --git a/xbps-src/shutils/chroot.sh.in b/xbps-src/shutils/chroot.sh.in index 2259b3ccf1d..e7649e5fd5c 100644 --- a/xbps-src/shutils/chroot.sh.in +++ b/xbps-src/shutils/chroot.sh.in @@ -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 diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 3646b025c6f..e454366f6b4 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -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