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 7E442158086 for ; Thu, 28 Oct 2021 11:46:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CA392E096C; Thu, 28 Oct 2021 11:46:02 +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 59C50E096C for ; Thu, 28 Oct 2021 11:46:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 5E62B3436B8 for ; Thu, 28 Oct 2021 11:46:01 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id F2A11144 for ; Thu, 28 Oct 2021 11:45:59 +0000 (UTC) From: "Guilherme Amadio" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Guilherme Amadio" Message-ID: <1635420162.d39c38ea123c5eaea7f06c1cde0a47ec4d58807d.amadio@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: amadio X-VCS-Committer-Name: Guilherme Amadio X-VCS-Revision: d39c38ea123c5eaea7f06c1cde0a47ec4d58807d X-VCS-Branch: master Date: Thu, 28 Oct 2021 11:45:59 +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: 21992a66-7cf7-4e9f-993b-990e0100b246 X-Archives-Hash: 00ecf1f6b52ee6dda7a7470d193d389d commit: d39c38ea123c5eaea7f06c1cde0a47ec4d58807d Author: Guilherme Amadio gentoo org> AuthorDate: Thu Oct 28 11:22:42 2021 +0000 Commit: Guilherme Amadio gentoo org> CommitDate: Thu Oct 28 11:22:42 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d39c38ea bootstrap-prefix.sh: fix RAP bootstrap with non-local user, bug 766417 When the bootstrapping user is handled by Kerberos and is not local to the host, the libc from prefix doesn't know how to convert usernames to user ids, which ends up confusing portage. Using getent from the host to add the bootstrapping user to ${EPREFIX}/etc/passwd works around this issue. Closes: https://bugs.gentoo.org/766417 Signed-off-by: Guilherme Amadio gentoo.org> scripts/bootstrap-prefix.sh | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index ec489f1f26..0e21c83953 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -344,10 +344,24 @@ bootstrap_setup() { fi if is-rap ; then - [[ -f ${ROOT}/etc/passwd ]] || getent passwd > "${ROOT}"/etc/passwd || \ - ln -sf {,"${ROOT}"}/etc/passwd - [[ -f ${ROOT}/etc/group ]] || getent group > "${ROOT}"/etc/group || \ - ln -sf {,"${ROOT}"}/etc/group + if [[ ! -f ${ROOT}/etc/passwd ]]; then + if grep -q $(id -un) /etc/passwd; then + ln -sf {,"${ROOT}"}/etc/passwd + else + getent passwd > "${ROOT}"/etc/passwd + # add user if it's not in /etc/passwd, bug 766417 + getent passwd $(id -un) >> "${ROOT}"/etc/passwd + fi + fi + if [[ ! -f ${ROOT}/etc/group ]]; then + if grep -q $(id -gn) /etc/group; then + ln -sf {,"${ROOT}"}/etc/group + else + getent group > "${ROOT}"/etc/group + # add group if it's not in /etc/group, bug 766417 + getent group $(id -gn) >> "${ROOT}"/etc/group + fi + fi [[ -f ${ROOT}/etc/resolv.conf ]] || ln -s {,"${ROOT}"}/etc/resolv.conf [[ -f ${ROOT}/etc/hosts ]] || cp {,"${ROOT}"}/etc/hosts local profile_linux=default/linux/ARCH/17.0/prefix/$(profile-kernel)