summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/useradd-staticids.bbclass36
1 files changed, 16 insertions, 20 deletions
diff --git a/meta/classes/useradd-staticids.bbclass b/meta/classes/useradd-staticids.bbclass
index 0e855e91c7..df4902ee9a 100644
--- a/meta/classes/useradd-staticids.bbclass
+++ b/meta/classes/useradd-staticids.bbclass
@@ -110,30 +110,26 @@ def update_useradd_static_config(d):
110 uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid 110 uaargs.groupname = uaargs.LOGIN if user_group else uaargs.gid
111 uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname 111 uaargs.groupid = field[3] or uaargs.gid or uaargs.groupname
112 112
113 if not uaargs.gid or uaargs.gid != uaargs.groupid: 113 if uaargs.groupid and uaargs.gid != uaargs.groupid:
114 if (uaargs.groupid and uaargs.groupid.isdigit()) and (uaargs.groupname and uaargs.groupname.isdigit()) and (uaargs.groupid != uaargs.groupname): 114 newgroup = None
115 if not uaargs.groupid.isdigit():
116 # We don't have a group number, so we have to add a name
117 bb.debug(1, "Adding group %s!" % uaargs.groupid)
118 newgroup = "%s %s" % (' --system' if uaargs.system else '', uaargs.groupid)
119 elif uaargs.groupname and not uaargs.groupname.isdigit():
120 # We have a group name and a group number to assign it to
121 bb.debug(1, "Adding group %s (gid %s)!" % (uaargs.groupname, uaargs.groupid))
122 newgroup = "-g %s %s" % (uaargs.groupid, uaargs.groupname)
123 else:
115 # We want to add a group, but we don't know it's name... so we can't add the group... 124 # We want to add a group, but we don't know it's name... so we can't add the group...
116 # We have to assume the group has previously been added or we'll fail on the adduser... 125 # We have to assume the group has previously been added or we'll fail on the adduser...
117 # Note: specifying the actual gid is very rare in OE, usually the group name is specified. 126 # Note: specifying the actual gid is very rare in OE, usually the group name is specified.
118 bb.warn("%s: Changing gid for login %s from (%s) to (%s), verify configuration files!" % (d.getVar('PN', True), uaargs.LOGIN, uaargs.groupname, uaargs.gid)) 127 bb.warn("%s: Changing gid for login %s to %s, verify configuration files!" % (d.getVar('PN', True), uaargs.LOGIN, uaargs.groupid))
119 elif (uaargs.groupid and not uaargs.groupid.isdigit()) and uaargs.groupid == uaargs.groupname: 128
120 # We don't have a number, so we have to add a name 129 uaargs.gid = uaargs.groupid
121 bb.debug(1, "Adding group %s!" % (uaargs.groupname)) 130 uaargs.user_group = None
122 uaargs.gid = uaargs.groupid 131 if newgroup:
123 uaargs.user_group = None
124 groupadd = d.getVar("GROUPADD_PARAM_%s" % pkg, True)
125 newgroup = "%s %s" % (' --system' if uaargs.system else '', uaargs.groupname)
126 if groupadd:
127 d.setVar("GROUPADD_PARAM_%s" % pkg, "%s ; %s" % (groupadd, newgroup))
128 else:
129 d.setVar("GROUPADD_PARAM_%s" % pkg, newgroup)
130 elif uaargs.groupname and (uaargs.groupid and uaargs.groupid.isdigit()):
131 # We have a group name and a group number to assign it to
132 bb.debug(1, "Adding group %s gid (%s)!" % (uaargs.groupname, uaargs.groupid))
133 uaargs.gid = uaargs.groupid
134 uaargs.user_group = None
135 groupadd = d.getVar("GROUPADD_PARAM_%s" % pkg, True) 132 groupadd = d.getVar("GROUPADD_PARAM_%s" % pkg, True)
136 newgroup = "-g %s %s" % (uaargs.gid, uaargs.groupname)
137 if groupadd: 133 if groupadd:
138 d.setVar("GROUPADD_PARAM_%s" % pkg, "%s ; %s" % (groupadd, newgroup)) 134 d.setVar("GROUPADD_PARAM_%s" % pkg, "%s ; %s" % (groupadd, newgroup))
139 else: 135 else: