summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas K. Hüttel <dilfridge@gentoo.org>2024-03-23 20:11:09 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-03-23 20:27:11 +0100
commit43f01d356a8fd347a19d7583eab92d01bee35f9f (patch)
treee7f0ac199c94b25922f6bf4901c56a0871f7168f /profiles
parentmedia-libs/libprojectm: add 4.1.1 (diff)
downloadgentoo-43f01d356a8fd347a19d7583eab92d01bee35f9f.tar.gz
gentoo-43f01d356a8fd347a19d7583eab92d01bee35f9f.tar.bz2
gentoo-43f01d356a8fd347a19d7583eab92d01bee35f9f.zip
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@gentoo.org>
Diffstat (limited to 'profiles')
-rw-r--r--profiles/releases/23.0/profile.bashrc43
1 files 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