1 |
commit: 0d096cb68e86dd5faa7da8cf68a18e4e29bc9081 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 13 16:32:09 2019 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Sep 5 21:02:05 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0d096cb6 |
7 |
|
8 |
acct-*.eclass: Create sysusers.d files |
9 |
|
10 |
Thanks to David Michael for the initial patch and upstream fixes. |
11 |
|
12 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
13 |
|
14 |
eclass/acct-group.eclass | 18 ++++++++++++++++-- |
15 |
eclass/acct-user.eclass | 18 ++++++++++++++++-- |
16 |
2 files changed, 32 insertions(+), 4 deletions(-) |
17 |
|
18 |
diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass |
19 |
index 5550e4a2fb1..19a378e0b06 100644 |
20 |
--- a/eclass/acct-group.eclass |
21 |
+++ b/eclass/acct-group.eclass |
22 |
@@ -1,4 +1,4 @@ |
23 |
-# Copyright 2019 Gentoo Authors |
24 |
+# Copyright 2019-2020 Gentoo Authors |
25 |
# Distributed under the terms of the GNU General Public License v2 |
26 |
|
27 |
# @ECLASS: acct-group.eclass |
28 |
@@ -80,7 +80,7 @@ S=${WORKDIR} |
29 |
|
30 |
|
31 |
# << Phase functions >> |
32 |
-EXPORT_FUNCTIONS pkg_pretend pkg_preinst |
33 |
+EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst |
34 |
|
35 |
# @FUNCTION: acct-group_pkg_pretend |
36 |
# @DESCRIPTION: |
37 |
@@ -116,6 +116,20 @@ acct-group_pkg_pretend() { |
38 |
fi |
39 |
} |
40 |
|
41 |
+# @FUNCTION: acct-group_src_install |
42 |
+# @DESCRIPTION: |
43 |
+# Installs sysusers.d file for the group. |
44 |
+acct-group_src_install() { |
45 |
+ debug-print-function ${FUNCNAME} "${@}" |
46 |
+ |
47 |
+ insinto /usr/lib/sysusers.d |
48 |
+ newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <( |
49 |
+ printf "g\t%q\t%q\n" \ |
50 |
+ "${ACCT_GROUP_NAME}" \ |
51 |
+ "${ACCT_GROUP_ID/#-*/-}" |
52 |
+ ) |
53 |
+} |
54 |
+ |
55 |
# @FUNCTION: acct-group_pkg_preinst |
56 |
# @DESCRIPTION: |
57 |
# Creates the group if it does not exist yet. |
58 |
|
59 |
diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
60 |
index e82f3c56dbb..56a4e83e8bf 100644 |
61 |
--- a/eclass/acct-user.eclass |
62 |
+++ b/eclass/acct-user.eclass |
63 |
@@ -1,4 +1,4 @@ |
64 |
-# Copyright 2019 Gentoo Authors |
65 |
+# Copyright 2019-2020 Gentoo Authors |
66 |
# Distributed under the terms of the GNU General Public License v2 |
67 |
|
68 |
# @ECLASS: acct-user.eclass |
69 |
@@ -312,7 +312,7 @@ acct-user_pkg_pretend() { |
70 |
# @FUNCTION: acct-user_src_install |
71 |
# @DESCRIPTION: |
72 |
# Installs a keep-file into the user's home directory to ensure it is |
73 |
-# owned by the package. |
74 |
+# owned by the package, and sysusers.d file. |
75 |
acct-user_src_install() { |
76 |
debug-print-function ${FUNCNAME} "${@}" |
77 |
|
78 |
@@ -321,6 +321,20 @@ acct-user_src_install() { |
79 |
# created yet |
80 |
keepdir "${ACCT_USER_HOME}" |
81 |
fi |
82 |
+ |
83 |
+ insinto /usr/lib/sysusers.d |
84 |
+ newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <( |
85 |
+ printf "u\t%q\t%q\t%q\t%q\t%q\n" \ |
86 |
+ "${ACCT_USER_NAME}" \ |
87 |
+ "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \ |
88 |
+ "${DESCRIPTION//[:,=]/;}" \ |
89 |
+ "${ACCT_USER_HOME}" \ |
90 |
+ "${ACCT_USER_SHELL/#-*/-}" |
91 |
+ if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then |
92 |
+ printf "m\t${ACCT_USER_NAME}\t%q\n" \ |
93 |
+ "${ACCT_USER_GROUPS[@]:1}" |
94 |
+ fi |
95 |
+ ) |
96 |
} |
97 |
|
98 |
# @FUNCTION: acct-user_pkg_preinst |