Skip to contentSkip to conversation

useradd-staticids: Fix groupadd

PATCH New David Vincent 1 participant 1 message Jan 23, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 useradd-staticids: Fix groupadd

When a group name is duplicated between USERADD_PARAM and GROUPADD_PARAM, this class tries to add it twice which results in failure of the groupadd command.

---
 meta/classes/useradd-staticids.bbclass | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/classes/useradd-staticids.bbclass +3 -1
index f7f6057ac3..a309b8873d 100644
@@ -165,7 +165,9 @@ def update_useradd_static_config(d):
                 if newgroup and is_pkg:
                     groupadd = d.getVar("GROUPADD_PARAM_%s" % pkg)
                     if groupadd:
-                        d.setVar("GROUPADD_PARAM_%s" % pkg, "%s; %s" % (groupadd, newgroup))
+                        # Only add the group if not already specified
+                        if not uaargs.groupname in groupadd:
+                            d.setVar("GROUPADD_PARAM_%s" % pkg, "%s; %s" % (groupadd, newgroup))
                     else:
                         d.setVar("GROUPADD_PARAM_%s" % pkg, newgroup)
 
Signature · 1 line
2.11.0