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) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 50FE2158041 for ; Sat, 23 Mar 2024 19:27:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9661DE2A04; Sat, 23 Mar 2024 19:27:25 +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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6DF84E2A04 for ; Sat, 23 Mar 2024 19:27:25 +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) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 579D134133B for ; Sat, 23 Mar 2024 19:27:24 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id B0739156A for ; Sat, 23 Mar 2024 19:27:22 +0000 (UTC) From: "Andreas K. Hüttel" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Andreas K. Hüttel" Message-ID: <1711222031.43f01d356a8fd347a19d7583eab92d01bee35f9f.dilfridge@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: profiles/releases/23.0/ X-VCS-Repository: repo/gentoo X-VCS-Files: profiles/releases/23.0/profile.bashrc X-VCS-Directories: profiles/releases/23.0/ X-VCS-Committer: dilfridge X-VCS-Committer-Name: Andreas K. Hüttel X-VCS-Revision: 43f01d356a8fd347a19d7583eab92d01bee35f9f X-VCS-Branch: master Date: Sat, 23 Mar 2024 19:27:22 +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: e8dbcfc0-0bf0-4ec3-b430-5854aa0246ee X-Archives-Hash: 5fa45159fa5912a3e1f000803b33564d commit: 43f01d356a8fd347a19d7583eab92d01bee35f9f Author: Andreas K. Hüttel gentoo org> AuthorDate: Sat Mar 23 19:11:09 2024 +0000 Commit: Andreas K. Hüttel gentoo 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 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