1 |
On Sat, 29 Aug 2020 21:53:45 +0200 Michał Górny wrote: |
2 |
> Thanks to David Michael for the initial patch and upstream fixes. |
3 |
> |
4 |
> Signed-off-by: Michał Górny <mgorny@g.o> |
5 |
> --- |
6 |
> eclass/acct-group.eclass | 16 +++++++++++++++- |
7 |
> eclass/acct-user.eclass | 16 +++++++++++++++- |
8 |
> 2 files changed, 30 insertions(+), 2 deletions(-) |
9 |
> |
10 |
> diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass |
11 |
> index 5550e4a2fb10..dc1562974870 100644 |
12 |
> --- a/eclass/acct-group.eclass |
13 |
> +++ b/eclass/acct-group.eclass |
14 |
> @@ -80,7 +80,7 @@ S=${WORKDIR} |
15 |
> |
16 |
> |
17 |
> # << Phase functions >> |
18 |
> -EXPORT_FUNCTIONS pkg_pretend pkg_preinst |
19 |
> +EXPORT_FUNCTIONS pkg_pretend src_install pkg_preinst |
20 |
> |
21 |
> # @FUNCTION: acct-group_pkg_pretend |
22 |
> # @DESCRIPTION: |
23 |
> @@ -116,6 +116,20 @@ acct-group_pkg_pretend() { |
24 |
> fi |
25 |
> } |
26 |
> |
27 |
> +# @FUNCTION: acct-group_src_install |
28 |
> +# @DESCRIPTION: |
29 |
> +# Installs sysusers.d file for the group. |
30 |
> +acct-group_src_install() { |
31 |
> + debug-print-function ${FUNCNAME} "${@}" |
32 |
> + |
33 |
> + insinto /usr/lib/sysusers.d |
34 |
> + newins - ${CATEGORY}-${ACCT_GROUP_NAME}.conf < <( |
35 |
> + printf "g\t%q\t%q\n" \ |
36 |
> + "${ACCT_GROUP_NAME}" \ |
37 |
> + "${ACCT_GROUP_ID/#-*/-}" |
38 |
> + ) |
39 |
> +} |
40 |
> + |
41 |
> # @FUNCTION: acct-group_pkg_preinst |
42 |
> # @DESCRIPTION: |
43 |
> # Creates the group if it does not exist yet. |
44 |
> diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass |
45 |
> index e82f3c56dbbe..f9772c3cb111 100644 |
46 |
> --- a/eclass/acct-user.eclass |
47 |
> +++ b/eclass/acct-user.eclass |
48 |
> @@ -312,7 +312,7 @@ acct-user_pkg_pretend() { |
49 |
> # @FUNCTION: acct-user_src_install |
50 |
> # @DESCRIPTION: |
51 |
> # Installs a keep-file into the user's home directory to ensure it is |
52 |
> -# owned by the package. |
53 |
> +# owned by the package, and sysusers.d file. |
54 |
> acct-user_src_install() { |
55 |
> debug-print-function ${FUNCNAME} "${@}" |
56 |
> |
57 |
> @@ -321,6 +321,20 @@ acct-user_src_install() { |
58 |
> # created yet |
59 |
> keepdir "${ACCT_USER_HOME}" |
60 |
> fi |
61 |
> + |
62 |
> + insinto /usr/lib/sysusers.d |
63 |
> + newins - ${CATEGORY}-${ACCT_USER_NAME}.conf < <( |
64 |
> + printf "u\t%q\t%q\t%q\t%q\t%q\n" \ |
65 |
> + "${ACCT_USER_NAME}" \ |
66 |
> + "${ACCT_USER_ID/#-*/-}:${ACCT_USER_GROUPS[0]}" \ |
67 |
> + "${DESCRIPTION//[:,=]/;}" \ |
68 |
> + "${ACCT_USER_HOME}" \ |
69 |
> + "${ACCT_USER_SHELL/#-*/-}" |
70 |
> + if [[ ${#ACCT_USER_GROUPS[@]} -gt 1 ]]; then |
71 |
> + printf "m\t${ACCT_USER_NAME}\t%q\n" \ |
72 |
> + "${ACCT_USER_GROUPS[@]:1}" |
73 |
> + fi |
74 |
> + ) |
75 |
> } |
76 |
|
77 |
Why these files are installed unconditionally? |
78 |
|
79 |
Of course we have a common "small files" policy that USE flags |
80 |
should not control small files in packages, such rule was designed |
81 |
for common packages where: |
82 |
1) small files are insignificant disk usage compared to a whole |
83 |
package; |
84 |
2) an average package takes significant time to rebuild and mass |
85 |
rebuild will cause problems during USE flip. |
86 |
|
87 |
While both arguments are valid for a common packages which provide |
88 |
real software, this is not true for very special acct-* packages: |
89 |
1) They may (and usually do) have zero size of installed files, |
90 |
this makes sysusers.d stuff an infinite times larger than a |
91 |
whole typical acct-* package (it will still be much larger if one |
92 |
will consider size of new passw/group records). |
93 |
2) acct-* packages are very fast to rebuild, so such price will |
94 |
be small compared to other changes necessary when USE="systemd" is |
95 |
being flipped. |
96 |
|
97 |
So it will be reasonable to add USE="systemd" to acct-* eclasses |
98 |
to control the changes proposed above. |
99 |
|
100 |
Best regards, |
101 |
Andrew Savchenko |