Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v2 6/9] acct-{group,user}.eclass: WIP eclasses to maintain users/groups
Date: Thu, 06 Jun 2019 04:56:26
Message-Id: a22811c2f978346ed5bd4706ddff6af2de579fb4.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH v2 6/9] acct-{group,user}.eclass: WIP eclasses to maintain users/groups by Ulrich Mueller
1 On Wed, 2019-06-05 at 13:46 +0200, Ulrich Mueller wrote:
2 > > > > > > On Wed, 05 Jun 2019, Michał Górny wrote:
3 > > +# @FUNCTION: acct-group_pkg_pretend
4 > > +# @DESCRIPTION:
5 > > +# Performs sanity checks for correct eclass usage, and early-checks
6 > > +# whether requested GID can be enforced.
7 > > +acct-group_pkg_pretend() {
8 > > + debug-print-function ${FUNCNAME} "${@}"
9 > > +
10 > > + # verify ACCT_GROUP_ID
11 > > + [[ -n ${ACCT_GROUP_ID} ]] || die "Ebuild error: ACCT_GROUP_ID must be set!"
12 > > + [[ ${ACCT_GROUP_ID} -ge 0 ]] || die "Ebuild errors: ACCT_GROUP_ID=${ACCT_GROUP_ID} invalid!"
13 >
14 > Add a sanity check for [[ ${CATEGORY} == acct-group ]] too?
15
16 Done. I've actually went for adding it in global scope since CATEGORY
17 is reliably available there already.
18
19 >
20 > > +
21 > > + # check for ACCT_GROUP_ID collisions early
22 > > + if [[ -n ${ACCT_GROUP_ENFORCE_ID} ]]; then
23 > > + local grp=$(egetent group "${ACCT_GROUP_ID}")
24 > > + if [[ -n ${grp} ]]; then
25 > > + eerror "The required GID is already taken by another group."
26 > > + eerror " GID: ${ACCT_GROUP_ID} (needed for ${PN})"
27 > > + eerror " current group: ${grp}"
28 > > + die "GID ${ACCT_GROUP_ID} taken already"
29 > > + fi
30 > > + fi
31 > > +}
32 > > [...]
33 > > +# @FUNCTION: acct-user_pkg_pretend
34 >
35 > And a similar check for acct-user here.
36 >
37 > Ulrich
38
39 --
40 Best regards,
41 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature