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