[oe-commits] [openembedded-core] 10/15: systemd: allow add users to groups in rootfs postprocess
git at git.openembedded.org
git at git.openembedded.org
Wed Jul 20 10:14:48 UTC 2016
rpurdie pushed a commit to branch master-next
in repository openembedded-core.
commit a306e1dc6cde40c9cca51d6147ed87e0b46315eb
Author: Stephano Cetola <stephano.cetola at linux.intel.com>
AuthorDate: Thu Jul 14 11:12:40 2016 -0700
systemd: allow add users to groups in rootfs postprocess
Currently the functionality checks for the "u" and "g" flags to create users and
groups, but not the "m" flag to add users to groups. This change first checks to
be sure that the users and groups are created, creates them if necessary, then
adds the user to the group.
Signed-off-by: Stephano Cetola <stephano.cetola at linux.intel.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
meta/classes/rootfs-postcommands.bbclass | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index db8b551..b38b6a5 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -45,6 +45,15 @@ systemd_create_users () {
[ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id"
groupadd_params="$groupadd_params --system $name"
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 usermod --root ${IMAGE_ROOTFS} -a -G $group $name
fi
done
done
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list