diff -ruN portage-prefix-2.1.14.orig/bin/ebuild.sh portage-prefix-2.1.14/bin/ebuild.sh --- portage-prefix-2.1.14.orig/bin/ebuild.sh 2006-07-13 11:09:51.000000000 +0200 +++ portage-prefix-2.1.14/bin/ebuild.sh 2006-07-13 11:09:51.000000000 +0200 @@ -815,14 +815,14 @@ } dyn_setup() { - [ "$(type -t pre_pkg_setup)" == "function" ] && pre_pkg_setup - pkg_setup - [ "$(type -t post_pkg_setup)" == "function" ] && post_pkg_setup + [ "$(type -t pre_pkg_setup)" == "function" ] && call-interactive pre_pkg_setup + call-interactive pkg_setup + [ "$(type -t post_pkg_setup)" == "function" ] && call-interactive post_pkg_setup } dyn_unpack() { trap "abort_unpack" SIGINT SIGQUIT - [ "$(type -t pre_src_unpack)" == "function" ] && pre_src_unpack + [ "$(type -t pre_src_unpack)" == "function" ] && call-interactive pre_src_unpack local newstuff="no" if [ -e "${WORKDIR}" ]; then local x @@ -849,7 +849,7 @@ if [ -e "${WORKDIR}" ]; then if [ "$newstuff" == "no" ]; then echo ">>> WORKDIR is up-to-date, keeping..." - [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack + [ "$(type -t post_src_unpack)" == "function" ] && call-interactive post_src_unpack return 0 fi fi @@ -859,12 +859,12 @@ fi cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`" echo ">>> Unpacking source..." - src_unpack + call-interactive src_unpack touch "${PORTAGE_BUILDDIR}/.unpacked" || die "IO Failure -- Failed 'touch .unpacked' in ${PORTAGE_BUILDDIR}" echo ">>> Source unpacked." cd "${PORTAGE_BUILDDIR}" - [ "$(type -t post_src_unpack)" == "function" ] && post_src_unpack + [ "$(type -t post_src_unpack)" == "function" ] && call-interactive post_src_unpack trap SIGINT SIGQUIT } @@ -1029,7 +1029,7 @@ dyn_compile() { trap "abort_compile" SIGINT SIGQUIT - [ "$(type -t pre_src_compile)" == "function" ] && pre_src_compile + [ "$(type -t pre_src_compile)" == "function" ] && call-interactive pre_src_compile [ "${CFLAGS-unset}" != "unset" ] && export CFLAGS [ "${CXXFLAGS-unset}" != "unset" ] && export CXXFLAGS @@ -1071,7 +1071,7 @@ echo ">>> It appears that ${PN} is already compiled; skipping." echo ">>> (clean to force compilation)" trap SIGINT SIGQUIT - [ "$(type -t post_src_compile)" == "function" ] && post_src_compile + [ "$(type -t post_src_compile)" == "function" ] && call-interactive post_src_compile return fi if [ -d "${S}" ]; then @@ -1085,7 +1085,7 @@ #our libtool to create problematic .la files export PWORKDIR="$WORKDIR" echo ">>> Compiling source in ${srcdir} ..." - src_compile + call-interactive src_compile echo ">>> Source compiled." #|| abort_compile "fail" cd "${PORTAGE_BUILDDIR}" @@ -1113,16 +1113,16 @@ touch DEBUGBUILD fi - [ "$(type -t post_src_compile)" == "function" ] && post_src_compile + [ "$(type -t post_src_compile)" == "function" ] && call-interactive post_src_compile trap SIGINT SIGQUIT } dyn_test() { - [ "$(type -t pre_src_test)" == "function" ] && pre_src_test + [ "$(type -t pre_src_test)" == "function" ] && call-interactive pre_src_test if [ "${PORTAGE_BUILDDIR}/.tested" -nt "${WORKDIR}" ]; then echo ">>> It appears that ${PN} has already been tested; skipping." - [ "$(type -t post_src_test)" == "function" ] && post_src_test + [ "$(type -t post_src_test)" == "function" ] && call-interactive post_src_test return fi trap "abort_test" SIGINT SIGQUIT @@ -1135,19 +1135,19 @@ elif ! hasq test $FEATURES; then echo ">>> Test phase [not enabled]: ${CATEGORY}/${PF}" else - src_test + call-interactive src_test fi cd "${PORTAGE_BUILDDIR}" touch .tested || die "Failed to 'touch .tested' in ${PORTAGE_BUILDDIR}" - [ "$(type -t post_src_test)" == "function" ] && post_src_test + [ "$(type -t post_src_test)" == "function" ] && call-interactive post_src_test trap SIGINT SIGQUIT } dyn_install() { [ -z "$PORTAGE_BUILDDIR" ] && die "${FUNCNAME}: PORTAGE_BUILDDIR is unset" trap "abort_install" SIGINT SIGQUIT - [ "$(type -t pre_src_install)" == "function" ] && pre_src_install + [ "$(type -t pre_src_install)" == "function" ] && call-interactive pre_src_install rm -rf "${PORTAGE_BUILDDIR}/image" mkdir "${PORTAGE_BUILDDIR}/image" if [ -d "${S}" ]; then @@ -1161,12 +1161,12 @@ #some packages uses an alternative to $S to build in, cause #our libtool to create problematic .la files export PWORKDIR="$WORKDIR" - src_install + call-interactive src_install touch "${PORTAGE_BUILDDIR}/.installed" echo ">>> Completed installing ${PF} into ${D}" echo cd ${PORTAGE_BUILDDIR} - [ "$(type -t post_src_install)" == "function" ] && post_src_install + [ "$(type -t post_src_install)" == "function" ] && call-interactive post_src_install trap SIGINT SIGQUIT } @@ -1176,12 +1176,29 @@ return 1 fi - [ "$(type -t pre_pkg_preinst)" == "function" ] && pre_pkg_preinst + [ "$(type -t pre_pkg_preinst)" == "function" ] && call-interactive pre_pkg_preinst declare -r D=${IMAGE} - pkg_preinst + call-interactive pkg_preinst - [ "$(type -t post_pkg_preinst)" == "function" ] && post_pkg_preinst + [ "$(type -t post_pkg_preinst)" == "function" ] && call-interactive post_pkg_preinst +} + +call-interactive() { + if ! hasq interactive ${FEATURES}; then + $1 + return $? + fi + + ( echo 'unset ENV' + set + export -p + shopt -p + echo "export PS1='INTERACTIVE ${PN} $1 \$ '" + echo 'unset ENV' + ) >> ${T}/interactive-environment + export PS1="INTERACTIVE ${PN} $1 \$ " + ${BASH} --rcfile ${T}/interactive-environment -s || die } dyn_help() { @@ -1662,21 +1679,21 @@ for myarg in $*; do case $myarg in nofetch) - pkg_nofetch + call-interactive pkg_nofetch exit 1 ;; prerm|postrm|postinst|config) export SANDBOX_ON="0" if [ "$PORTAGE_DEBUG" != "1" ]; then - [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg} - pkg_${myarg} - [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg} + [ "$(type -t pre_pkg_${myarg})" == "function" ] && call-interactive pre_pkg_${myarg} + call-interactive pkg_${myarg} + [ "$(type -t post_pkg_${myarg})" == "function" ] && call-interactive post_pkg_${myarg} #Allow non-zero return codes since they can be caused by && else set -x - [ "$(type -t pre_pkg_${myarg})" == "function" ] && pre_pkg_${myarg} - pkg_${myarg} - [ "$(type -t post_pkg_${myarg})" == "function" ] && post_pkg_${myarg} + [ "$(type -t pre_pkg_${myarg})" == "function" ] && call-interactive pre_pkg_${myarg} + call-interactive pkg_${myarg} + [ "$(type -t post_pkg_${myarg})" == "function" ] && call-interactive post_pkg_${myarg} #Allow non-zero return codes since they can be caused by && set +x fi