diff options
author | Michał Górny <mgorny@gentoo.org> | 2019-12-13 17:32:09 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2020-09-05 23:02:05 +0200 |
commit | 0d096cb68e86dd5faa7da8cf68a18e4e29bc9081 (patch) | |
tree | 0d07e99f087e206e4d36e22687731db2dab77622 /eclass | |
parent | dev-python/setuptools: Bump to 50.3.0 (diff) | |
download | gentoo-0d096cb68e86dd5faa7da8cf68a18e4e29bc9081.tar.gz gentoo-0d096cb68e86dd5faa7da8cf68a18e4e29bc9081.tar.bz2 gentoo-0d096cb68e86dd5faa7da8cf68a18e4e29bc9081.zip |
acct-*.eclass: Create sysusers.d files
Thanks to David Michael for the initial patch and upstream fixes.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/acct-group.eclass | 18 | ||||
-rw-r--r-- | eclass/acct-user.eclass | 18 |
2 files changed, 32 insertions, 4 deletions
diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass index 5550e4a2fb10..19a378e0b061 100644 --- a/eclass/acct-group.eclass +++ b/eclass/acct-group.eclass @@ -1,4 +1,4 @@ -# Copyright 2019 Gentoo Authors +# Copyright 2019-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: acct-group.eclass @@ -80,7 +80,7 @@ S=${WORKDIR} # << Phase functions >> -EXPORT_FUNCTIONS pkg_pretend pkg_preinst +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst # @FUNCTION: acct-group_pkg_pretend # @DESCRIPTION: @@ -116,6 +116,20 @@ acct-group_pkg_pretend() { fi } +# @FUNCTION: acct-group_src_install +# @DESCRIPTION: +# Installs sysusers.d file for the group. +acct-group_src_install() { + debug-print-function ${FUNCNAME} "${@}" + + insinto /usr/lib/sysusers.d + newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <( + printf "g\t%q\t%q\n" \ + "${ACCT_GROUP_NAME}" \ + "${ACCT_GROUP_ID/#-*/-}" + ) +} + # @FUNCTION: acct-group_pkg_preinst # @DESCRIPTION: # Creates the group if it does not exist yet. diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass index e82f3c56dbbe..56a4e83e8bfc 100644 --- a/eclass/acct-user.eclass +++ b/eclass/acct-user.eclass @@ -1,4 +1,4 @@ -# Copyright 2019 Gentoo Authors +# Copyright 2019-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: acct-user.eclass @@ -312,7 +312,7 @@ acct-user_pkg_pretend() { # @FUNCTION: acct-user_src_install # @DESCRIPTION: # Installs a keep-file into the user's home directory to ensure it is -# owned by the package. +# owned by the package, and sysusers.d file. acct-user_src_install() { debug-print-function ${FUNCNAME} "${@}" @@ -321,6 +321,20 @@ acct-user_src_install() { # created yet keepdir "${ACCT_USER_HOME}" fi + + insinto /usr/lib/sysusers.d + newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <( + printf "u\t%q\t%q\t%q\t%q\t%q\n" \ + "${ACCT_USER_NAME}" \ + "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \ + "${DESCRIPTION//[:,=]/;}" \ + "${ACCT_USER_HOME}" \ + "${ACCT_USER_SHELL/#-*/-}" + if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then + printf "m\t${ACCT_USER_NAME}\t%q\n" \ + "${ACCT_USER_GROUPS[@]:1}" + fi + ) } # @FUNCTION: acct-user_pkg_preinst |