[PATCH 1/5] user-info.eclass: egetent: support shadow database
Mike Gilbert <[email protected]> Fri, 31 Jul 2026 14:05:59 -0400
| Newsgroups | gmane.linux.gentoo.devel |
|---|---|
| Message-ID | <[email protected]> |
This will be used by acct-user.eclass. Signed-off-by: Mike Gilbert <[email protected]> --- eclass/user-info.eclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass index 3e2bdecfe047..ceef6638cecf 100644 --- a/eclass/user-info.eclass +++ b/eclass/user-info.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2025 Gentoo Authors +# Copyright 1999-2026 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: user-info.eclass @@ -22,7 +22,7 @@ esac # Small wrapper for getent (Linux), nidump (< Mac OS X 10.5), # dscl (Mac OS X 10.5), and pw (FreeBSD) used in enewuser()/enewgroup(). # -# Supported databases: group passwd +# Supported databases: group passwd shadow # Warning: This function can be used only in pkg_* phases when ROOT is valid. egetent() { local db=$1 key=$2 @@ -30,7 +30,7 @@ egetent() { [[ $# -ge 3 ]] && die "usage: egetent <database> <key>" case ${db} in - passwd|group) ;; + group|passwd|shadow) ;; *) die "sorry, database '${db}' not yet supported; file a bug" ;; esac @@ -63,7 +63,7 @@ egetent() { type -p nscd >/dev/null && nscd -i "${db}" 2>/dev/null getent "${db}" "${key}" else - if [[ ${key} =~ ^[[:digit:]]+$ ]]; then + if [[ ${db} != shadow && ${key} =~ ^[[:digit:]]+$ ]]; then grep -E "^([^:]*:){2}${key}:" "${ROOT}/etc/${db}" else grep "^${key}:" "${ROOT}/etc/${db}" -- 2.55.0