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-10 16:39:50 +0000 |
commit | 2d924cb91f254df06c4f4e4ee03f7998b1286544 (patch) | |
tree | f1803bbd73f4cbfd80501687b3b669aa696700e6 | |
parent | 53f3bf5b78585edded8f0784e04ab0a0357de5f4 (diff) | |
download | poky-2d924cb91f254df06c4f4e4ee03f7998b1286544.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: 5f53e232f92011e131abff6128fa25812c3744ac)
Signed-off-by: Tean Cunningham <tean.cunningham@digi.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 65649be6b2196ab964c69605d0306bfc2481da33)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.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 74035c30b7..0452fe4b27 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 |