diff options
author | Tean Cunningham <tean.cunningham@digi.com> | 2022-03-01 14:25:39 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-03-02 18:43:25 +0000 |
commit | a559a2cba9284a1531fbc402c6fda1c5a51259c1 (patch) | |
tree | e610a4abc12d26451c2ea6bafd5c5dabb9c226dd | |
parent | 82f24d21978456476f631812e73033d23a7eac64 (diff) | |
download | poky-a559a2cba9284a1531fbc402c6fda1c5a51259c1.tar.gz |
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 <tean.cunningham@digi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/rootfs-postcommands.bbclass | 8 |
1 files 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 () { | |||
78 | eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true | 78 | eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true |
79 | elif [ "$type" = "m" ]; then | 79 | elif [ "$type" = "m" ]; then |
80 | group=$id | 80 | group=$id |
81 | if [ ! `grep -q "^${group}:" ${IMAGE_ROOTFS}${sysconfdir}/group` ]; then | 81 | eval groupadd --root ${IMAGE_ROOTFS} --system $group || true |
82 | eval groupadd --root ${IMAGE_ROOTFS} --system $group | 82 | eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name --no-user-group || true |
83 | fi | ||
84 | if [ ! `grep -q "^${name}:" ${IMAGE_ROOTFS}${sysconfdir}/passwd` ]; then | ||
85 | eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name | ||
86 | fi | ||
87 | eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name | 83 | eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name |
88 | fi | 84 | fi |
89 | done | 85 | done |