Acked-by: Mike Gilbert <flop...@gentoo.org> Signed-off-by: Ulrich Müller <u...@gentoo.org> --- eclass/acct-user.eclass | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index f658aa0eabc3..67fdf509b3b1 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -431,6 +431,14 @@ 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 + [[ -n ${del_groups} ]] && + ewarn "Removing user ${ACCT_USER_NAME} from group(s): ${del_groups}" + 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. -- 2.42.0