diff options
Diffstat (limited to 'eclass/acct-user.eclass')
-rw-r--r-- | eclass/acct-user.eclass | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index 66a4d6667888..9eab1f4c4ae6 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -1,4 +1,4 @@ -# Copyright 2019-2023 Gentoo Authors +# Copyright 2019-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: acct-user.eclass @@ -58,12 +58,12 @@ inherit user-info # << Eclass variables >> # @ECLASS_VARIABLE: ACCT_USER_NAME -# @INTERNAL # @DESCRIPTION: -# The name of the user. This is forced to ${PN} and the policy prohibits -# it from being changed. +# The name of the user. This is forced to ${PN} and the policy +# prohibits it from being changed. The variable is left writable for +# use in overlays; package naming restrictions would prohibit some +# otherwise-valid usernames. ACCT_USER_NAME=${PN} -readonly ACCT_USER_NAME # @ECLASS_VARIABLE: ACCT_USER_ID # @REQUIRED @@ -231,8 +231,9 @@ acct-user_pkg_pretend() { [[ ${ACCT_USER_ID} -ge -1 ]] || die "Ebuild error: ACCT_USER_ID=${ACCT_USER_ID} invalid!" local user_id=${ACCT_USER_ID} - # check for the override - local override_name=${ACCT_USER_NAME^^} + # check for the override, use PN in case this is an overlay and + # ACCT_USER_NAME is not PN and not valid in a bash variable name + local override_name=${PN^^} local override_var=ACCT_USER_${override_name//-/_}_ID if [[ -n ${!override_var} ]]; then user_id=${!override_var} @@ -274,8 +275,9 @@ acct-user_src_install() { # serialize for override support local ACCT_USER_GROUPS=${ACCT_USER_GROUPS[*]} - # support make.conf overrides - local override_name=${ACCT_USER_NAME^^} + # support make.conf overrides, use PN in case this is an overlay and + # ACCT_USER_NAME is not PN and not valid in a bash variable name + local override_name=${PN^^} override_name=${override_name//-/_} local var for var in ACCT_USER_{ID,COMMENT,SHELL,HOME{,_OWNER,_PERMS},GROUPS}; do @@ -437,7 +439,7 @@ acct-user_pkg_postinst() { has "${g}" "${groups[@]}" || del_groups+="${del_groups:+, }${g}" done if [[ -n ${del_groups} ]]; then - local override_name=${ACCT_USER_NAME^^} + local override_name=${PN^^} 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" |