public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Ulrich Müller" <ulm@gentoo.org>, "Mike Gilbert" <floppym@gentoo.org>
Subject: Re: [gentoo-dev] [PATCH v2] acct-user.eclass: Warn when the user is removed from a group
Date: Wed, 08 Nov 2023 06:52:34 +0000	[thread overview]
Message-ID: <87zfzolosn.fsf@gentoo.org> (raw)
In-Reply-To: <20231023204145.27236-2-ulm@gentoo.org>


Ulrich Müller <ulm@gentoo.org> writes:

> Acked-by: Mike Gilbert <floppym@gentoo.org>
> Signed-off-by: Ulrich Müller <ulm@gentoo.org>
> ---
> v2: Add explanation and documentation reference to warning message

lgtm

>
>  eclass/acct-user.eclass | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
>
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
> index f658aa0eabc3..c9d335c4e558 100644
> --- a/eclass/acct-user.eclass
> +++ b/eclass/acct-user.eclass
> @@ -431,6 +431,20 @@ acct-user_pkg_postinst() {
>  		opts+=( --prefix "${ROOT}" )
>  	fi
>  
> +	local g old_groups del_groups=""
> +	old_groups=$(egetgroups "${ACCT_USER_NAME}")
> +	for g in ${old_groups//,/ }; do
> +		has "${g}" "${groups[@]}" || del_groups+="${del_groups:+, }${g}"
> +	done
> +	if [[ -n ${del_groups} ]]; then
> +		ewarn "Removing user ${ACCT_USER_NAME} from group(s): ${del_groups}"
> +		ewarn "To retain the user's group membership in the local system"
> +		ewarn "config, override with ACCT_USER_${ACCT_USER_NAME^^}_GROUPS"
> +		ewarn "or ACCT_USER_${ACCT_USER_NAME^^}_GROUPS_ADD in make.conf."
> +		ewarn "Documentation reference:"
> +		ewarn "https://wiki.gentoo.org/wiki/Practical_guide_to_the_GLEP_81_migration#Override_user_groups"
> +	fi
> +
>  	elog "Updating user ${ACCT_USER_NAME}"
>  	# usermod outputs a warning if unlocking the account would result in an
>  	# empty password. Hide stderr in a text file and display it if usermod fails.



      reply	other threads:[~2023-11-08  6:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 20:41 [gentoo-dev] [PATCH v2] acct-user.eclass: Warn when the user is removed from a group Ulrich Müller
2023-11-08  6:52 ` Sam James [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfzolosn.fsf@gentoo.org \
    --to=sam@gentoo.org \
    --cc=floppym@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=ulm@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox