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 8A130158089 for ; Wed, 8 Nov 2023 07:39:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CA3122BC018; Wed, 8 Nov 2023 07:39:58 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 B03BD2BC018 for ; Wed, 8 Nov 2023 07:39:58 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id ECFE2335D2E for ; Wed, 8 Nov 2023 07:39:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 4D9C6ABD for ; Wed, 8 Nov 2023 07:39:56 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1699429184.9756ed4ebc19571b30cb985b2151c811373edf35.ulm@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/acct-user.eclass X-VCS-Directories: eclass/ X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 9756ed4ebc19571b30cb985b2151c811373edf35 X-VCS-Branch: master Date: Wed, 8 Nov 2023 07:39:56 +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: 1da29fa8-cc55-4e36-a50b-fae9dc80b0b2 X-Archives-Hash: 52b670de9e603d166a94dcc2efbe3439 commit: 9756ed4ebc19571b30cb985b2151c811373edf35 Author: Ulrich Müller gentoo org> AuthorDate: Mon Oct 23 19:56:05 2023 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Wed Nov 8 07:39:44 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9756ed4e acct-user.eclass: Warn when the user is removed from a group Acked-by: Mike Gilbert gentoo.org> Signed-off-by: Ulrich Müller gentoo.org> eclass/acct-user.eclass | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index f658aa0eabc3..66a4d6667888 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -431,6 +431,22 @@ 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 + local override_name=${ACCT_USER_NAME^^} + override_name=${override_name//-/_} + 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_${override_name}_GROUPS or" + ewarn "ACCT_USER_${override_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.