commit:     b0b5e39f1247c3cae5c8d4618a20d396cf70937d
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 23 11:03:54 2023 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Sep 23 11:03:54 2023 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=b0b5e39f

scripts/bootstrap-prefix: fix RAP stage3 on python due to init.d script

Portage enforces init.d scripts must have a valid shebang, which means
openrc-run must exist on the system.  For RAP-systems this script is to
be provided by openrc (in contrast to baselayout for non-RAP Prefix
systems), however during bootstrap openrc is not pulled in, and in
reality it never is.  So provide a dummy openrc-run in the RAP path for
stage3 before python or rsync are pulled in, such that Portage's QA
check is happy about their init.d scripts.

Closes: https://bugs.gentoo.org/913856
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index e6a88b8325..b08a497f41 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -2028,6 +2028,18 @@ bootstrap_stage3() {
                grep -q 'esac' "${ROOT}"/usr/bin/rsync && \
                        rm "${ROOT}"/usr/bin/rsync
 
+               # sys-apps/baselayout will install a dummy openrc-run wrapper
+               # for any package that installs an init.d script, like rsync and
+               # python will need openrc-run to exist, else we'll die with a QA
+               # error, bug #858596.  However it only does this for
+               # prefix-guest, so NOT For RAP, which results in bug #913856.
+               if [[ ! -x "${ROOT}"/sbin/openrc-run ]]; then
+                       [[ -e "${ROOT}"/sbin ]] || mkdir -p "${ROOT}"/sbin
+                       echo "We need openrc-run at ${ROOT}/sbin to merge some 
packages." \
+                               > "${ROOT}"/sbin/openrc-run
+                       chmod +x "${ROOT}"/sbin/openrc-run
+               fi
+
                pkgs=(
                        sys-devel/binutils-config
                        sys-libs/zlib
@@ -2139,12 +2151,6 @@ bootstrap_stage3() {
        TIME_T_32_BIT_OK=yes \
        pre_emerge_pkgs "" "${pkgs[@]}" || return 1
 
-       if [[ ! -x "${ROOT}"/sbin/openrc-run ]]; then
-               echo "We need openrc-run at ${ROOT}/sbin to merge rsync." \
-                       > "${ROOT}"/sbin/openrc-run
-               chmod +x "${ROOT}"/sbin/openrc-run
-       fi
-
        pkgs=(
                virtual/os-headers
                sys-devel/gettext
@@ -3141,7 +3147,6 @@ if [[ ${CHOST} == *-linux-* ]] ; then
                [[ -z ${dist} ]] && dist=${ID}
                [[ -z ${dist} ]] && dist=${NAME}
                [[ -z ${rel} ]] && rel=${VERSION_ID}
-
        fi
        [[ -z ${dist} ]] && dist=linux
 

Reply via email to