From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 0D49315ACFB for ; Tue, 25 Apr 2023 15:25:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 2CCC2E09B0; Tue, 25 Apr 2023 15:25:24 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0DE94E09B0 for ; Tue, 25 Apr 2023 15:25:24 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 06C5F340ED8 for ; Tue, 25 Apr 2023 15:25:23 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 935F98AC for ; Tue, 25 Apr 2023 15:25:21 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1682436232.7904f41ac9e76200eb9bae57a9dbcdd60aaa828f.grobian@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: scripts/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: scripts/bootstrap-prefix.sh X-VCS-Directories: scripts/ X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 7904f41ac9e76200eb9bae57a9dbcdd60aaa828f X-VCS-Branch: master Date: Tue, 25 Apr 2023 15:25:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 927abbfb-efbf-4a36-8f76-a7208935ec6f X-Archives-Hash: 5a8a3f32da8d1fbfd25770dcbb583211 commit: 7904f41ac9e76200eb9bae57a9dbcdd60aaa828f Author: Andrey Aleksandrov hey com> AuthorDate: Tue Apr 25 15:23:52 2023 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Tue Apr 25 15:23:52 2023 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7904f41a scripts/bootstrap-prefix: set env stuff when running individual stages Crucial settings like PATH setup are necessary when the individual stages 1, 2, 3, etc are run, so borrow them from the interactive model that tries to figure them all out. Signed-off-by: Fabian Groffen gentoo.org> scripts/bootstrap-prefix.sh | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 84b0df01a3..272523f17b 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -2969,7 +2969,8 @@ EOF done export PATH="$EPREFIX/usr/bin:$EPREFIX/bin:$EPREFIX/tmp/usr/bin:$EPREFIX/tmp/bin:$EPREFIX/tmp/usr/local/bin:${PATH}" - cat << EOF + if [[ -z ${PARTIAL_BOOTSTRAP} ]]; then + cat << EOF OK! I'm going to give it a try, this is what I have collected sofar: EPREFIX=${EPREFIX} @@ -2983,14 +2984,15 @@ Prefix. In short, I'm going to run stage1, stage2, stage3, followed by emerge -e system. If any of these stages fail, both you and me are in deep trouble. So let's hope that doesn't happen. EOF - echo - [[ ${TODO} == 'noninteractive' ]] && ans="" || - read -p "Type here what you want to wish me [luck] " ans - if [[ -n ${ans} && ${ans} != "luck" ]] ; then - echo "Huh? You're not serious, are you?" - sleep 3 - fi - echo + echo + [[ ${TODO} == 'noninteractive' ]] && ans="" || + read -p "Type here what you want to wish me [luck] " ans + if [[ -n ${ans} && ${ans} != "luck" ]] ; then + echo "Huh? You're not serious, are you?" + sleep 3 + fi + echo + fi if [[ -d ${HOST_GENTOO_EROOT} ]]; then if ! [[ -x ${EPREFIX}/tmp/usr/lib/portage/bin/emerge ]] && ! ${BASH} ${BASH_SOURCE[0]} "${EPREFIX}" stage_host_gentoo ; then @@ -3014,6 +3016,19 @@ EOF ROOT="${EPREFIX}" set_helper_vars + if [[ -n ${PARTIAL_BOOTSTRAP} ]]; then + cat << EOF + +OK! All necessary tools and ENV variables were installed: + EPREFIX=${EPREFIX} + CHOST=${CHOST} + PATH=${PATH} + MAKEOPTS=${MAKEOPTS} +Now I'm going to run an you asked me to. +EOF + return 0; + fi + if ! [[ -e ${EPREFIX}/.stage1-finished ]] && ! bootstrap_stage1_log ; then # stage 1 fail cat << EOF @@ -3391,6 +3406,17 @@ if [[ -n ${PKG_CONFIG_PATH} ]] ; then fi einfo "ready to bootstrap ${TODO}" + +# part of bootstrap_interactive should be executed before any bootstrap_${TODO} +# to properly setup environment variables and guarantee that bootstrap_${TODO} +# executes inside a prefix +if [[ ${TODO} != "noninteractive" && $(type -t bootstrap_${TODO} == "function") ]]; then + PARTIAL_BOOTSTRAP=true + TODO='noninteractive' bootstrap_interactive || exit 1 + bootstrap_${TODO} || exit 1 + exit 0 +fi + # bootstrap_interactive proceeds with guessed defaults when TODO=noninteractive bootstrap_${TODO#non} || exit 1