All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Kjellerstedt <pkj@axis.com>
To: <openembedded-core@lists.openembedded.org>
Subject: [PATCH 2/2] useradd.bbclass: Look for usermod when using GROUPMEMS_PARAM
Date: Wed, 19 Aug 2026 19:24:56 +0200	[thread overview]
Message-ID: <20260819172456.2843283-2-pkj@axis.com> (raw)
In-Reply-To: <20260819172456.2843283-1-pkj@axis.com>

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
 


      reply	other threads:[~2026-08-19 17:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260819172456.2843283-2-pkj@axis.com \
    --to=pkj@axis.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.