Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] Revert "useradd.bbclass: drop groupmems from sysroot setup"
@ 2026-08-19 17:24 Peter Kjellerstedt
  2026-08-19 17:24 ` [PATCH 2/2] useradd.bbclass: Look for usermod when using GROUPMEMS_PARAM Peter Kjellerstedt
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Kjellerstedt @ 2026-08-19 17:24 UTC (permalink / raw)
  To: openembedded-core

This reverts commit de0bf5771644edbe317ee9ad89cca4bc8836cf12.

As long as support for GROUPMEMS_PARAM remains, this code is needed.
The lack of the groupmems command is handled in the next commit instead.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/classes/useradd.bbclass | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index aafd996fae..c9f24bf7f3 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -131,6 +131,10 @@ usermod_sysroot() {
 	common_useradd_sysroot usermod
 }
 
+groupmems_sysroot() {
+	common_useradd_sysroot groupmems
+}
+
 common_useradd_sysroot() {
 	# Pseudo may (do_prepare_recipe_sysroot) or may not (do_populate_sysroot_setscene) be running
 	# at this point so we're explicit about the environment so pseudo can load if
@@ -164,6 +168,7 @@ common_useradd_sysroot() {
 		groupadd) GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}";;
 		useradd) USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}";;
 		usermod) USERMOD_PARAM="${@get_all_cmd_params(d, 'usermod')}";;
+		groupmems) GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}";;
 	esac
 
 	# Tell the system to use the environment vars
@@ -179,7 +184,7 @@ common_useradd_sysroot() {
 EXTRA_STAGING_FIXMES += "PSEUDO_SYSROOT PSEUDO_LOCALSTATEDIR LOGFIFO"
 
 python useradd_sysroot_sstate() {
-    for cmd, sort_prefix in [("groupadd", "01"), ("useradd", "02"), ("usermod", "03")]:
+    for cmd, sort_prefix in [("groupadd", "01"), ("useradd", "02"), ("usermod", "03"), ("groupmems", "04")]:
         scriptfile = None
         task = d.getVar("BB_CURRENTTASK")
         if task == "package_setscene":


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] useradd.bbclass: Look for usermod when using GROUPMEMS_PARAM
  2026-08-19 17:24 [PATCH 1/2] Revert "useradd.bbclass: drop groupmems from sysroot setup" Peter Kjellerstedt
@ 2026-08-19 17:24 ` Peter Kjellerstedt
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2026-08-19 17:24 UTC (permalink / raw)
  To: openembedded-core

Since support for GROUPMEMS_PARAM is implemented using the usermod
command, look for it rather than groupmems when verifying that the
command exists.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 meta/classes/useradd.bbclass | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index c9f24bf7f3..4a07394a56 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -155,22 +155,28 @@ common_useradd_sysroot() {
 		exit 0
 	fi
 
-	# It is also possible we may be in a recipe which doesn't have useradd dependencies and hence the
-	# useradd/groupadd tools are unavailable. If there is no dependency, we assume we don't want to
-	# create users in the sysroot
-	if ! command -v "$1"; then
-		bbwarn "The $1 command could not be found!"
-		exit 0
-	fi
+	cmd=$1
 
 	# Add groups and users defined for all recipe packages
 	case "$1" in
 		groupadd) GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}";;
 		useradd) USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}";;
 		usermod) USERMOD_PARAM="${@get_all_cmd_params(d, 'usermod')}";;
-		groupmems) GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}";;
+		groupmems)
+			GROUPMEMS_PARAM="${@get_all_cmd_params(d, 'groupmems')}"
+			# groupmems is emulated using usermod
+			cmd=usermod
+			;;
 	esac
 
+	# It is also possible we may be in a recipe which doesn't have useradd dependencies and hence the
+	# useradd/groupadd tools are unavailable. If there is no dependency, we assume we don't want to
+	# create users in the sysroot
+	if ! command -v "$cmd"; then
+		bbwarn "The $cmd command could not be found!"
+		exit 0
+	fi
+
 	# Tell the system to use the environment vars
 	UA_SYSROOT=1
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-19 17:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-19 17:24 [PATCH 1/2] Revert "useradd.bbclass: drop groupmems from sysroot setup" Peter Kjellerstedt
2026-08-19 17:24 ` [PATCH 2/2] useradd.bbclass: Look for usermod when using GROUPMEMS_PARAM Peter Kjellerstedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox