summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorAndré Draszik <adraszik@tycoint.com>2017-10-06 13:12:59 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-05 22:39:48 +0000
commit7ca04fef1b324b7fc6e8c5bbddcd41617cc5e5c6 (patch)
tree124bdafffa0279e25b026cd3a0537c415b162fc0 /meta/classes
parent8c3ea68812ba057fe95daf1f340d542727509b42 (diff)
downloadpoky-7ca04fef1b324b7fc6e8c5bbddcd41617cc5e5c6.tar.gz
useradd-staticids: don't create username-group if gid is specified
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. (From OE-Core rev: b1843e60ebe534243b49f3685540fa5ea49d5f35) Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit fc3a86ae68919cec72c1a8ae0f9ba1f98ae13f0d) Signed-off-by: André Draszik <adraszik@tycoint.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/useradd-staticids.bbclass10
1 files changed, 7 insertions, 3 deletions
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index 2d282c0d71..6ebf7600f6 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -141,9 +141,13 @@ def update_useradd_static_config(d):
141 # So if the implicit username-group creation is on, then the implicit groupname (LOGIN) 141 # So if the implicit username-group creation is on, then the implicit groupname (LOGIN)
142 # is used, and we disable the user_group option. 142 # is used, and we disable the user_group option.
143 # 143 #
144 user_group = uaargs.user_group is None or uaargs.user_group is True 144 if uaargs.gid:
145 uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid 145 uaargs.groupname = uaargs.gid
146 uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname 146 elif uaargs.user_group is not False:
147 uaargs.groupname = uaargs.LOGIN
148 else:
149 uaargs.groupname = 'users'
150 uaargs.groupid = field[3] or uaargs.groupname
147 151
148 if uaargs.groupid and uaargs.gid != uaargs.groupid: 152 if uaargs.groupid and uaargs.gid != uaargs.groupid:
149 newgroup = None 153 newgroup = None