* [PATCH] useradd-staticids: don't create username-group if gid is specified
@ 2017-09-04 9:37 André Draszik
2017-09-04 10:22 ` Peter Kjellerstedt
2017-09-22 9:00 ` [PATCH v2] " André Draszik
0 siblings, 2 replies; 9+ messages in thread
From: André Draszik @ 2017-09-04 9:37 UTC (permalink / raw)
To: openembedded-core
From: André Draszik <adraszik@tycoint.com>
Adding distcc to an image, and having staticids enabled,
doesn't work as it causes a a superfluous 'distcc' group
being added using a conflicting GID, thus failing the
build:
| ERROR: distcc-3.2-r0 do_prepare_recipe_sysroot: distcc: groupadd command did not succeed.
Compared to other recipes, the distcc recipe only
specifies --gid for the primary group, and doesn't specify
--no-user-group, but when --gid is given, it doesn't make
sense to create a matching username-group in addition,
even if --no-user-group was not specified, and 'useradd'
actually complains if --gid and --user-group are given
both.
If only --gid is given, the current code in here
effectively behaves as if --user-group was specified,
taking the group-id of the username-group from the
--gid parameter. This causes the error above, as we try
to add a new group (distcc) with an existing group-id
(nogroup).
This is contrary to the comment in this file just above,
contrary to what useradd can do, contrary to behaviour
without the useradd-staticids bbclass, and non-intuitive.
Change the code such that a username-group is only created
if actually requested, of if a primary group using --gid
was *not* specified.
Signed-off-by: André Draszik <adraszik@tycoint.com>
---
meta/classes/useradd-staticids.bbclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index ce4ac62ab5..1b61a8bf9b 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -102,7 +102,7 @@ def update_useradd_static_config(d):
# So if the implicit username-group creation is on, then the implicit groupname (LOGIN)
# is used, and we disable the user_group option.
#
- user_group = uaargs.user_group is None or uaargs.user_group is True
+ user_group = uaargs.gid is None or uaargs.user_group is True
uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid
uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname
--
2.14.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-04 9:37 [PATCH] useradd-staticids: don't create username-group if gid is specified André Draszik
@ 2017-09-04 10:22 ` Peter Kjellerstedt
2017-09-05 7:40 ` André Draszik
2017-09-22 9:00 ` [PATCH v2] " André Draszik
1 sibling, 1 reply; 9+ messages in thread
From: Peter Kjellerstedt @ 2017-09-04 10:22 UTC (permalink / raw)
To: André Draszik, openembedded-core
> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org
> [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf Of
> André Draszik
> Sent: den 4 september 2017 11:37
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH] useradd-staticids: don't create username-
> group if gid is specified
>
> From: André Draszik <adraszik@tycoint.com>
>
> Adding distcc to an image, and having staticids enabled,
> doesn't work as it causes a a superfluous 'distcc' group
> being added using a conflicting GID, thus failing the
> build:
> | ERROR: distcc-3.2-r0 do_prepare_recipe_sysroot: distcc: groupadd command did not succeed.
>
> Compared to other recipes, the distcc recipe only
> specifies --gid for the primary group, and doesn't specify
> --no-user-group, but when --gid is given, it doesn't make
> sense to create a matching username-group in addition,
> even if --no-user-group was not specified, and 'useradd'
> actually complains if --gid and --user-group are given
> both.
>
> If only --gid is given, the current code in here
> effectively behaves as if --user-group was specified,
> taking the group-id of the username-group from the
> --gid parameter. This causes the error above, as we try
> to add a new group (distcc) with an existing group-id
> (nogroup).
>
> This is contrary to the comment in this file just above,
> contrary to what useradd can do, contrary to behaviour
> without the useradd-staticids bbclass, and non-intuitive.
>
> Change the code such that a username-group is only created
> if actually requested, of if a primary group using --gid
> was *not* specified.
>
> Signed-off-by: André Draszik <adraszik@tycoint.com>
> ---
> meta/classes/useradd-staticids.bbclass | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
> index ce4ac62ab5..1b61a8bf9b 100644
> --- a/meta/classes/useradd-staticids.bbclass
> +++ b/meta/classes/useradd-staticids.bbclass
> @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> # So if the implicit username-group creation is on, then the implicit groupname (LOGIN)
> # is used, and we disable the user_group option.
> #
> - user_group = uaargs.user_group is None or uaargs.user_group is True
> + user_group = uaargs.gid is None or uaargs.user_group is True
Hmm, I believe that should be:
user_group = uaargs.gid is None and uaargs.user_group is None or uaargs.user_group is True
I.e., if neither --gid nor --user-group is specified, then it should
treat it as if --user-group was specified.
> uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid
> uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname
>
> --
> 2.14.1
//Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-04 10:22 ` Peter Kjellerstedt
@ 2017-09-05 7:40 ` André Draszik
2017-09-20 9:28 ` André Draszik
0 siblings, 1 reply; 9+ messages in thread
From: André Draszik @ 2017-09-05 7:40 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core
On Mon, 2017-09-04 at 10:22 +0000, Peter Kjellerstedt wrote:
> >
[...]
> > diff --git a/meta/classes/useradd-staticids.bbclass
> > b/meta/classes/useradd-staticids.bbclass
> > index ce4ac62ab5..1b61a8bf9b 100644
> > --- a/meta/classes/useradd-staticids.bbclass
> > +++ b/meta/classes/useradd-staticids.bbclass
> > @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> > # So if the implicit username-group creation is on, then
> > the implicit groupname (LOGIN)
> > # is used, and we disable the user_group option.
> > #
> > - user_group = uaargs.user_group is None or uaargs.user_group
> > is True
> > + user_group = uaargs.gid is None or uaargs.user_group is
> > True
>
> Hmm, I believe that should be:
>
> user_group = uaargs.gid is None and uaargs.user_group is None
> or uaargs.user_group is True
>
> I.e., if neither --gid nor --user-group is specified, then it should
> treat it as if --user-group was specified.
Hm, isn't this still the same as
user_group = uaargs.gid is None or uaargs.user_group is True
? If neither --gid nor --user-group is specified, then gid is None, so it
will do what you want already. IOW, unless the group name (gid) is
specified, a username-group is being created.
Cheers,
Andre'
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-05 7:40 ` André Draszik
@ 2017-09-20 9:28 ` André Draszik
2017-09-20 13:43 ` Burton, Ross
2017-09-20 14:20 ` Peter Kjellerstedt
0 siblings, 2 replies; 9+ messages in thread
From: André Draszik @ 2017-09-20 9:28 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core
ping
On Tue, 2017-09-05 at 08:40 +0100, André Draszik wrote:
> On Mon, 2017-09-04 at 10:22 +0000, Peter Kjellerstedt wrote:
> > >
>
> [...]
> > > diff --git a/meta/classes/useradd-staticids.bbclass
> > > b/meta/classes/useradd-staticids.bbclass
> > > index ce4ac62ab5..1b61a8bf9b 100644
> > > --- a/meta/classes/useradd-staticids.bbclass
> > > +++ b/meta/classes/useradd-staticids.bbclass
> > > @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> > > # So if the implicit username-group creation is on, then
> > > the implicit groupname (LOGIN)
> > > # is used, and we disable the user_group option.
> > > #
> > > - user_group = uaargs.user_group is None or
> > > uaargs.user_group
> > > is True
> > > + user_group = uaargs.gid is None or uaargs.user_group is
> > > True
> >
> > Hmm, I believe that should be:
> >
> > user_group = uaargs.gid is None and uaargs.user_group is
> > None
> > or uaargs.user_group is True
> >
> > I.e., if neither --gid nor --user-group is specified, then it should
> > treat it as if --user-group was specified.
>
> Hm, isn't this still the same as
>
> user_group = uaargs.gid is None or uaargs.user_group is True
>
> ? If neither --gid nor --user-group is specified, then gid is None, so it
> will do what you want already. IOW, unless the group name (gid) is
> specified, a username-group is being created.
>
>
> Cheers,
> Andre'
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-20 9:28 ` André Draszik
@ 2017-09-20 13:43 ` Burton, Ross
2017-09-20 14:20 ` Peter Kjellerstedt
1 sibling, 0 replies; 9+ messages in thread
From: Burton, Ross @ 2017-09-20 13:43 UTC (permalink / raw)
To: André Draszik; +Cc: Peter Kjellerstedt, openembedded-core
[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]
Sorry, in mut now.
Ross
On 20 September 2017 at 10:28, André Draszik <git@andred.net> wrote:
> ping
>
> On Tue, 2017-09-05 at 08:40 +0100, André Draszik wrote:
> > On Mon, 2017-09-04 at 10:22 +0000, Peter Kjellerstedt wrote:
> > > >
> >
> > [...]
> > > > diff --git a/meta/classes/useradd-staticids.bbclass
> > > > b/meta/classes/useradd-staticids.bbclass
> > > > index ce4ac62ab5..1b61a8bf9b 100644
> > > > --- a/meta/classes/useradd-staticids.bbclass
> > > > +++ b/meta/classes/useradd-staticids.bbclass
> > > > @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> > > > # So if the implicit username-group creation is on, then
> > > > the implicit groupname (LOGIN)
> > > > # is used, and we disable the user_group option.
> > > > #
> > > > - user_group = uaargs.user_group is None or
> > > > uaargs.user_group
> > > > is True
> > > > + user_group = uaargs.gid is None or uaargs.user_group is
> > > > True
> > >
> > > Hmm, I believe that should be:
> > >
> > > user_group = uaargs.gid is None and uaargs.user_group is
> > > None
> > > or uaargs.user_group is True
> > >
> > > I.e., if neither --gid nor --user-group is specified, then it should
> > > treat it as if --user-group was specified.
> >
> > Hm, isn't this still the same as
> >
> > user_group = uaargs.gid is None or uaargs.user_group is True
> >
> > ? If neither --gid nor --user-group is specified, then gid is None, so it
> > will do what you want already. IOW, unless the group name (gid) is
> > specified, a username-group is being created.
> >
> >
> > Cheers,
> > Andre'
> >
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
[-- Attachment #2: Type: text/html, Size: 2888 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-20 9:28 ` André Draszik
2017-09-20 13:43 ` Burton, Ross
@ 2017-09-20 14:20 ` Peter Kjellerstedt
2017-09-21 8:23 ` André Draszik
1 sibling, 1 reply; 9+ messages in thread
From: Peter Kjellerstedt @ 2017-09-20 14:20 UTC (permalink / raw)
To: André Draszik, openembedded-core
> -----Original Message-----
> From: André Draszik [mailto:git@andred.net]
> Sent: den 20 september 2017 11:29
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH] useradd-staticids: don't create
> username-group if gid is specified
>
> ping
Sorry, I forgot to reply to this.
> On Tue, 2017-09-05 at 08:40 +0100, André Draszik wrote:
> > On Mon, 2017-09-04 at 10:22 +0000, Peter Kjellerstedt wrote:
> > > >
> >
> > [...]
> > > > diff --git a/meta/classes/useradd-staticids.bbclass
> > > > b/meta/classes/useradd-staticids.bbclass
> > > > index ce4ac62ab5..1b61a8bf9b 100644
> > > > --- a/meta/classes/useradd-staticids.bbclass
> > > > +++ b/meta/classes/useradd-staticids.bbclass
> > > > @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> > > > # So if the implicit username-group creation is on, then the implicit groupname (LOGIN)
> > > > # is used, and we disable the user_group option.
> > > > #
> > > > - user_group = uaargs.user_group is None or uaargs.user_group is True
> > > > + user_group = uaargs.gid is None or uaargs.user_group is True
> > >
> > > Hmm, I believe that should be:
> > >
> > > user_group = uaargs.gid is None and uaargs.user_group is None or uaargs.user_group is True
> > >
> > > I.e., if neither --gid nor --user-group is specified, then it should
> > > treat it as if --user-group was specified.
> >
> > Hm, isn't this still the same as
> >
> > user_group = uaargs.gid is None or uaargs.user_group is True
No, because uaargs.user_group may be False if --no-user-group is
specified (which I of course should have mentioned in my previous
reply). With your version, you would still get a user group even
if --no-user-group is specified.
> > ? If neither --gid nor --user-group is specified, then gid is None, so it
> > will do what you want already. IOW, unless the group name (gid) is
> > specified, a username-group is being created.
> >
> >
> > Cheers,
> > Andre'
//Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-20 14:20 ` Peter Kjellerstedt
@ 2017-09-21 8:23 ` André Draszik
2017-09-21 13:02 ` Peter Kjellerstedt
0 siblings, 1 reply; 9+ messages in thread
From: André Draszik @ 2017-09-21 8:23 UTC (permalink / raw)
To: Peter Kjellerstedt, openembedded-core
On Wed, 2017-09-20 at 14:20 +0000, Peter Kjellerstedt wrote:
> > -----Original Message-----
> > From: André Draszik [mailto:git@andred.net]
> > Sent: den 20 september 2017 11:29
> > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> > core@lists.openembedded.org
> > Subject: Re: [OE-core] [PATCH] useradd-staticids: don't create
> > username-group if gid is specified
> >
> > ping
>
> Sorry, I forgot to reply to this.
>
> > On Tue, 2017-09-05 at 08:40 +0100, André Draszik wrote:
> > > On Mon, 2017-09-04 at 10:22 +0000, Peter Kjellerstedt wrote:
> > > > >
> > >
> > > [...]
> > > > > diff --git a/meta/classes/useradd-staticids.bbclass
> > > > > b/meta/classes/useradd-staticids.bbclass
> > > > > index ce4ac62ab5..1b61a8bf9b 100644
> > > > > --- a/meta/classes/useradd-staticids.bbclass
> > > > > +++ b/meta/classes/useradd-staticids.bbclass
> > > > > @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> > > > > # So if the implicit username-group creation is on,
> > > > > then the implicit groupname (LOGIN)
> > > > > # is used, and we disable the user_group option.
> > > > > #
> > > > > - user_group = uaargs.user_group is None or
> > > > > uaargs.user_group is True
> > > > > + user_group = uaargs.gid is None or uaargs.user_group
> > > > > is True
> > > >
> > > > Hmm, I believe that should be:
> > > >
> > > > user_group = uaargs.gid is None and uaargs.user_group is
> > > > None or uaargs.user_group is True
> > > >
> > > > I.e., if neither --gid nor --user-group is specified, then it should
> > > > treat it as if --user-group was specified.
> > >
> > > Hm, isn't this still the same as
> > >
> > > user_group = uaargs.gid is None or uaargs.user_group is True
>
> No, because uaargs.user_group may be False if --no-user-group is
> specified (which I of course should have mentioned in my previous
> reply). With your version, you would still get a user group even
> if --no-user-group is specified.
OK, this is how useradd behaves:
useradd --system --home /dev/null --no-create-home --no-user-group distcc
-> will add the new user to the group 'users' (as per GROUP from /etc/default/useradd)
useradd --system --home /dev/null --no-create-home --gid foo --user-group distcc
-> --gid and --user-group together conflict
useradd --system --home /dev/null --no-create-home --user-group distcc
useradd --system --home /dev/null --no-create-home distcc
-> in both cases distcc user and group are created
Sp, what about this instead:
if uaargs.gid:
uaargs.groupname = uaargs.gid
uaargs.groupid = field[3] or uaargs.gid
elif uaargs.user_group is not False:
uaargs.groupname = uaargs.LOGIN
uaargs.groupid = field[3] or uaargs.LOGIN
else:
uaargs.groupname = 'users'
uaargs.groupid = field[3] or 'users'
Cheers,
Andre'
> > > ? If neither --gid nor --user-group is specified, then gid is None, so
> > > it
> > > will do what you want already. IOW, unless the group name (gid) is
> > > specified, a username-group is being created.
> > >
> > >
> > > Cheers,
> > > Andre'
>
> //Peter
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] useradd-staticids: don't create username-group if gid is specified
2017-09-21 8:23 ` André Draszik
@ 2017-09-21 13:02 ` Peter Kjellerstedt
0 siblings, 0 replies; 9+ messages in thread
From: Peter Kjellerstedt @ 2017-09-21 13:02 UTC (permalink / raw)
To: André Draszik, openembedded-core
> -----Original Message-----
> From: André Draszik [mailto:git@andred.net]
> Sent: den 21 september 2017 10:24
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> core@lists.openembedded.org
> Subject: Re: [OE-core] [PATCH] useradd-staticids: don't create
> username-group if gid is specified
>
> On Wed, 2017-09-20 at 14:20 +0000, Peter Kjellerstedt wrote:
> > > -----Original Message-----
> > > From: André Draszik [mailto:git@andred.net]
> > > Sent: den 20 september 2017 11:29
> > > To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; openembedded-
> > > core@lists.openembedded.org
> > > Subject: Re: [OE-core] [PATCH] useradd-staticids: don't create
> > > username-group if gid is specified
> > >
> > > ping
> >
> > Sorry, I forgot to reply to this.
> >
> > > On Tue, 2017-09-05 at 08:40 +0100, André Draszik wrote:
> > > > On Mon, 2017-09-04 at 10:22 +0000, Peter Kjellerstedt wrote:
> > > > > >
> > > >
> > > > [...]
> > > > > > diff --git a/meta/classes/useradd-staticids.bbclass
> > > > > > b/meta/classes/useradd-staticids.bbclass
> > > > > > index ce4ac62ab5..1b61a8bf9b 100644
> > > > > > --- a/meta/classes/useradd-staticids.bbclass
> > > > > > +++ b/meta/classes/useradd-staticids.bbclass
> > > > > > @@ -102,7 +102,7 @@ def update_useradd_static_config(d):
> > > > > > # So if the implicit username-group creation is
> on,
> > > > > > then the implicit groupname (LOGIN)
> > > > > > # is used, and we disable the user_group option.
> > > > > > #
> > > > > > - user_group = uaargs.user_group is None or
> > > > > > uaargs.user_group is True
> > > > > > + user_group = uaargs.gid is None or
> uaargs.user_group
> > > > > > is True
> > > > >
> > > > > Hmm, I believe that should be:
> > > > >
> > > > > user_group = uaargs.gid is None and
> uaargs.user_group is
> > > > > None or uaargs.user_group is True
> > > > >
> > > > > I.e., if neither --gid nor --user-group is specified, then it
> should
> > > > > treat it as if --user-group was specified.
> > > >
> > > > Hm, isn't this still the same as
> > > >
> > > > user_group = uaargs.gid is None or uaargs.user_group is True
> >
> > No, because uaargs.user_group may be False if --no-user-group is
> > specified (which I of course should have mentioned in my previous
> > reply). With your version, you would still get a user group even
> > if --no-user-group is specified.
>
> OK, this is how useradd behaves:
>
> useradd --system --home /dev/null --no-create-home --no-user-group
> distcc
> -> will add the new user to the group 'users' (as per GROUP from
> /etc/default/useradd)
>
> useradd --system --home /dev/null --no-create-home --gid foo --user-
> group distcc
> -> --gid and --user-group together conflict
>
> useradd --system --home /dev/null --no-create-home --user-group distcc
> useradd --system --home /dev/null --no-create-home distcc
> -> in both cases distcc user and group are created
>
>
> Sp, what about this instead:
>
> if uaargs.gid:
> uaargs.groupname = uaargs.gid
> uaargs.groupid = field[3] or uaargs.gid
> elif uaargs.user_group is not False:
> uaargs.groupname = uaargs.LOGIN
> uaargs.groupid = field[3] or uaargs.LOGIN
> else:
> uaargs.groupname = 'users'
> uaargs.groupid = field[3] or 'users'
Looks correct. However, you can simplify it to:
if uaargs.gid:
uaargs.groupname = uaargs.gid
elif uaargs.user_group is not False:
uaargs.groupname = uaargs.LOGIN
else:
uaargs.groupname = 'users'
uaargs.groupid = field[3] or uaargs.groupname
> Cheers,
> Andre'
>
> > > > ? If neither --gid nor --user-group is specified, then gid is
> None, so
> > > > it
> > > > will do what you want already. IOW, unless the group name (gid)
> is
> > > > specified, a username-group is being created.
> > > >
> > > >
> > > > Cheers,
> > > > Andre'
> >
> > //Peter
//Peter
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] useradd-staticids: don't create username-group if gid is specified
2017-09-04 9:37 [PATCH] useradd-staticids: don't create username-group if gid is specified André Draszik
2017-09-04 10:22 ` Peter Kjellerstedt
@ 2017-09-22 9:00 ` André Draszik
1 sibling, 0 replies; 9+ messages in thread
From: André Draszik @ 2017-09-22 9:00 UTC (permalink / raw)
To: openembedded-core
From: André Draszik <adraszik@tycoint.com>
Adding distcc to an image, and having staticids enabled,
doesn't work as it causes a a superfluous 'distcc' group
being added using a conflicting GID, thus failing the
build:
| ERROR: distcc-3.2-r0 do_prepare_recipe_sysroot: distcc: groupadd command did not succeed.
Compared to other recipes, the distcc recipe only
specifies --gid for the primary group, and doesn't specify
--no-user-group, but when --gid is given, it doesn't make
sense to create a matching username-group in addition,
even if --no-user-group was not specified, and 'useradd'
actually complains if --gid and --user-group are given
both.
If only --gid is given, the current code in here
effectively behaves as if --user-group was specified,
taking the group-id of the username-group from the
--gid parameter. This causes the error above, as we try
to add a new group (distcc) with an existing group-id
(nogroup).
This is contrary to the comment in this file just above,
contrary to what useradd can do, contrary to behaviour
without the useradd-staticids bbclass, and non-intuitive.
Change the code such that a username-group is only created
- if a primary group using --gid was not specified, or
- if --no-user-group was not specified
To be in line with useradd, if gid is not given, and
--no-user-group is given, we add the user to the group
'users', which mimics useradd's behaviour.
Signed-off-by: André Draszik <adraszik@tycoint.com>
---
v2: bring this even more in line with useradd
---
meta/classes/useradd-staticids.bbclass | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index ce4ac62ab5..eb8e59e67a 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -102,9 +102,13 @@ def update_useradd_static_config(d):
# So if the implicit username-group creation is on, then the implicit groupname (LOGIN)
# is used, and we disable the user_group option.
#
- user_group = uaargs.user_group is None or uaargs.user_group is True
- uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid
- uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname
+ if uaargs.gid:
+ uaargs.groupname = uaargs.gid
+ elif uaargs.user_group is not False:
+ uaargs.groupname = uaargs.LOGIN
+ else:
+ uaargs.groupname = 'users'
+ uaargs.groupid = field[3] or uaargs.groupname
if uaargs.groupid and uaargs.gid != uaargs.groupid:
newgroup = None
--
2.14.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-09-22 9:00 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-04 9:37 [PATCH] useradd-staticids: don't create username-group if gid is specified André Draszik
2017-09-04 10:22 ` Peter Kjellerstedt
2017-09-05 7:40 ` André Draszik
2017-09-20 9:28 ` André Draszik
2017-09-20 13:43 ` Burton, Ross
2017-09-20 14:20 ` Peter Kjellerstedt
2017-09-21 8:23 ` André Draszik
2017-09-21 13:02 ` Peter Kjellerstedt
2017-09-22 9:00 ` [PATCH v2] " André Draszik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.