public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/releases/23.0/
Date: Sat, 23 Mar 2024 19:27:22 +0000 (UTC)	[thread overview]
Message-ID: <1711222031.43f01d356a8fd347a19d7583eab92d01bee35f9f.dilfridge@gentoo> (raw)

commit:     43f01d356a8fd347a19d7583eab92d01bee35f9f
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 23 19:11:09 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Mar 23 19:27:11 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43f01d35

profiles: releases/23.0: Fix bashrc safety guard

The previous version relied on an environment variable, which was
*not* saved in binary packages and also not re-sourced from the
profile. It always became unset, which meant "merged-usr".

With that, not the local profile and the local filesystem were
compared, but "merged-usr" and the local filesystem -- which
obviously fails for any split-usr installation.

Closes: https://bugs.gentoo.org/927631
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 profiles/releases/23.0/profile.bashrc | 43 ++++++++++++++++++++++++++++++++---
 1 file changed, 40 insertions(+), 3 deletions(-)

diff --git a/profiles/releases/23.0/profile.bashrc b/profiles/releases/23.0/profile.bashrc
index 6c178b086158..ae82a4b3216e 100644
--- a/profiles/releases/23.0/profile.bashrc
+++ b/profiles/releases/23.0/profile.bashrc
@@ -1,5 +1,40 @@
-if [[ "${EBUILD_PHASE}" == "setup" ]] && [[ -e "${EROOT%/}/bin" ]] ; then
-	if [[ ! -h "${EROOT%/}/bin" ]] && [[ "${PROFILE_23_USRTYPE}" != "split-usr" ]] ; then
+
+__gentoo_get_disk_splitmerge() {
+	# does /bin exist? important for baselayout
+	if [[ -e "${EROOT%/}/bin" ]] ; then
+		# is /bin a symlink?
+		if [[ -h "${EROOT%/}/bin" ]] ; then
+			echo -n merged
+		else
+			echo -n split
+		fi
+	else
+		echo -n unknown
+	fi
+}
+
+__gentoo_get_profile_splitmerge() {
+	# does /etc/portage/make.profile exist and is a symlink?
+	if [[ -h "${EROOT%/}/etc/portage/make.profile" ]] ; then
+		local linktarget=$(readlink "${EROOT%/}/etc/portage/make.profile")
+
+		# 23.0 profile?
+		if [[ "${linktarget}" == */23.0* ]] ; then
+			if [[ "${linktarget}" == *split-usr* ]] ; then
+				echo -n split
+			else
+				echo -n merged
+			fi
+		else
+			echo -n unknown
+		fi
+	else
+		echo -n unknown
+	fi
+}
+
+if [[ "${EBUILD_PHASE}" == "setup" ]] ; then
+	if [[ $(__gentoo_get_disk_splitmerge) == "split" ]] && [[ $(__gentoo_get_profile_splitmerge) == "merged" ]] ; then
 		eerror ""
 		eerror "Your profile is of type merged-usr, but your directories"
 		eerror "on-disk are of type split-usr."
@@ -8,7 +43,7 @@ if [[ "${EBUILD_PHASE}" == "setup" ]] && [[ -e "${EROOT%/}/bin" ]] ; then
 		eerror ""
 		die "ERROR: 23.0 merged-usr profile, but disk is split-usr"
 	fi
-	if [[ -h "${EROOT%/}/bin" ]] && [[ "${PROFILE_23_USRTYPE}" == "split-usr" ]] ; then
+	if [[ $(__gentoo_get_disk_splitmerge) == "merged" ]] && [[ $(__gentoo_get_profile_splitmerge) == "split" ]] ; then
 		eerror ""
 		eerror "Your profile is of type split-usr, but your directories"
 		eerror "on-disk are of type merged-usr."
@@ -18,3 +53,5 @@ if [[ "${EBUILD_PHASE}" == "setup" ]] && [[ -e "${EROOT%/}/bin" ]] ; then
 		die "ERROR: 23.0 split-usr profile, but disk is merged-usr"
 	fi
 fi
+
+unset -f __gentoo_get_disk_splitmerge __gentoo_get_profile_splitmerge


             reply	other threads:[~2024-03-23 19:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-23 19:27 Andreas K. Hüttel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-04-09 22:34 [gentoo-commits] repo/gentoo:master commit in: profiles/releases/23.0/ Sam James
2024-04-09 21:48 Andreas K. Hüttel
2024-03-23 11:13 Ionen Wolkens
2024-03-07 21:15 Andreas K. Hüttel
2024-03-03 14:40 Andreas K. Hüttel
2024-03-03 12:45 Andreas K. Hüttel
2024-02-29  8:54 Andreas K. Hüttel
2024-02-28 12:11 Ionen Wolkens
2023-12-18 13:56 Andreas K. Hüttel
2022-12-10 14:22 Andreas K. Hüttel
2022-12-05  0:30 Andreas K. Hüttel
2022-12-04 22:48 Andreas K. Hüttel
2022-12-04 22:21 Andreas K. Hüttel
2022-11-30  2:15 Sam James
2022-11-29  0:00 Andreas K. Hüttel
2022-11-22  0:02 Sam James
2022-11-13 18:27 Andreas K. Hüttel
2022-11-12 23:21 Andreas K. Hüttel
2022-11-12 23:05 Andreas K. Hüttel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1711222031.43f01d356a8fd347a19d7583eab92d01bee35f9f.dilfridge@gentoo \
    --to=dilfridge@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox