diff options
author | Mike Gilbert <floppym@gentoo.org> | 2022-10-17 14:51:41 -0400 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-10-19 15:30:04 +0200 |
commit | 140f92c2b8a15e7e5c28a343a8b289b3d766e143 (patch) | |
tree | 8bc969fed356af94966d1fab7fbd9be2480dcad5 /eclass/acct-user.eclass | |
parent | acct-group.eclass: inline groupadd (diff) | |
download | gentoo-140f92c2b8a15e7e5c28a343a8b289b3d766e143.tar.gz gentoo-140f92c2b8a15e7e5c28a343a8b289b3d766e143.tar.bz2 gentoo-140f92c2b8a15e7e5c28a343a8b289b3d766e143.zip |
acct-user.eclass: support user override of comment
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/acct-user.eclass')
-rw-r--r-- | eclass/acct-user.eclass | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index c87b27f3ccaa..f48e5a105a46 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -93,6 +93,13 @@ readonly ACCT_USER_NAME # to an already existing user. : ${ACCT_USER_NO_MODIFY:=} +# @ECLASS_VARIABLE: ACCT_USER_COMMENT +# @DEFAULT_UNSET +# @DESCRIPTION: +# The comment to use for the user. If not specified, the package +# DESCRIPTION will be used. This can be overridden in make.conf through +# ACCT_USER_<UPPERCASE_USERNAME>_COMMENT variable. + # @ECLASS_VARIABLE: ACCT_USER_SHELL # @DESCRIPTION: # The shell to use for the user. If not specified, a 'nologin' variant @@ -373,6 +380,10 @@ acct-user_pkg_pretend() { acct-user_src_install() { debug-print-function ${FUNCNAME} "${@}" + # Replace reserved characters in comment + : ${ACCT_USER_COMMENT:=${DESCRIPTION}} + ACCT_USER_COMMENT=${ACCT_USER_COMMENT//[:,=]/;} + # serialize for override support local ACCT_USER_GROUPS=${ACCT_USER_GROUPS[*]} @@ -380,7 +391,7 @@ acct-user_src_install() { local override_name=${ACCT_USER_NAME^^} override_name=${override_name//-/_} local var - for var in ACCT_USER_{ID,SHELL,HOME{,_OWNER,_PERMS},GROUPS}; do + for var in ACCT_USER_{ID,COMMENT,SHELL,HOME{,_OWNER,_PERMS},GROUPS}; do local var_name=ACCT_USER_${override_name}_${var#ACCT_USER_} if [[ -n ${!var_name} ]]; then ewarn "${var_name}=${!var_name} override in effect, support will not be provided." @@ -409,7 +420,7 @@ acct-user_src_install() { printf "u\t%q\t%q\t%q\t%q\t%q\n" \ "${ACCT_USER_NAME}" \ "${_ACCT_USER_ID/#-*/-}:${groups[0]}" \ - "${DESCRIPTION//[:,=]/;}" \ + "${_ACCT_USER_COMMENT}" \ "${_ACCT_USER_HOME}" \ "${_ACCT_USER_SHELL/#-*/-}" if [[ ${#groups[@]} -gt 1 ]]; then @@ -487,7 +498,7 @@ acct-user_pkg_postinst() { esetshell "${ACCT_USER_NAME}" "${_ACCT_USER_SHELL}" esetgroups "${ACCT_USER_NAME}" "${_ACCT_USER_GROUPS// /,}" # comment field can not contain colons - esetcomment "${ACCT_USER_NAME}" "${DESCRIPTION//[:,=]/;}" + esetcomment "${ACCT_USER_NAME}" "${_ACCT_USER_COMMENT}" eunlockuser "${ACCT_USER_NAME}" } |