From a559a2cba9284a1531fbc402c6fda1c5a51259c1 Mon Sep 17 00:00:00 2001 From: Tean Cunningham Date: Tue, 1 Mar 2022 14:25:39 -0700 Subject: rootfs-postcommands: amend systemd_create_users add user to group check Currently when adding a user to a group ('m' type), the conditional check to only create a user/group if it does not exist always resolves to true. This causes a build exit failure if the user and/or group defined in the sysusers configuration file were already created prior to the execution of systemd_create_users(). This logic has been updated to instead fail silently (consistent with 'u' and 'g' type). Additionally, if a user doesn't exist it will be created without the default group. (From OE-Core rev: 65649be6b2196ab964c69605d0306bfc2481da33) Signed-off-by: Tean Cunningham Signed-off-by: Richard Purdie --- meta/classes/rootfs-postcommands.bbclass | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index cd8986d8a9..b63a5b90d3 100644 --- a/meta/classes/rootfs-postcommands.bbclass +++ b/meta/classes/rootfs-postcommands.bbclass @@ -78,12 +78,8 @@ systemd_create_users () { eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true elif [ "$type" = "m" ]; then group=$id - if [ ! `grep -q "^${group}:" ${IMAGE_ROOTFS}${sysconfdir}/group` ]; then - eval groupadd --root ${IMAGE_ROOTFS} --system $group - fi - if [ ! `grep -q "^${name}:" ${IMAGE_ROOTFS}${sysconfdir}/passwd` ]; then - eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name - fi + eval groupadd --root ${IMAGE_ROOTFS} --system $group || true + eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name --no-user-group || true eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name fi done -- cgit v1.2.3-54-g00ecf