diff options
author | Stephano Cetola <stephano.cetola@linux.intel.com> | 2016-07-14 11:12:40 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-21 07:47:52 +0100 |
commit | d4d60218ec1f8c26ffe966cf6f04cf341934f553 (patch) | |
tree | a847ed1ede6d0c439e1e1dd6c5610a0abe0b71f6 /meta/classes/rootfs-postcommands.bbclass | |
parent | 031c2f6ced917a81b4f39dca371773d0275ddf73 (diff) | |
download | poky-d4d60218ec1f8c26ffe966cf6f04cf341934f553.tar.gz |
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.
(From OE-Core rev: f0a77bee3d092cf79b7e584b943a623eddd6e13d)
Signed-off-by: Stephano Cetola <stephano.cetola@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/rootfs-postcommands.bbclass')
-rw-r--r-- | meta/classes/rootfs-postcommands.bbclass | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass index db8b551533..b38b6a50c5 100644 --- a/meta/classes/rootfs-postcommands.bbclass +++ b/meta/classes/rootfs-postcommands.bbclass | |||
@@ -45,6 +45,15 @@ systemd_create_users () { | |||
45 | [ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id" | 45 | [ "$id" != "-" ] && groupadd_params="$groupadd_params --gid $id" |
46 | groupadd_params="$groupadd_params --system $name" | 46 | groupadd_params="$groupadd_params --system $name" |
47 | eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true | 47 | eval groupadd --root ${IMAGE_ROOTFS} $groupadd_params || true |
48 | elif [ "$type" = "m" ]; then | ||
49 | group=$id | ||
50 | if [ ! `grep -q "^${group}:" ${IMAGE_ROOTFS}${sysconfdir}/group` ]; then | ||
51 | eval groupadd --root ${IMAGE_ROOTFS} --system $group | ||
52 | fi | ||
53 | if [ ! `grep -q "^${name}:" ${IMAGE_ROOTFS}${sysconfdir}/passwd` ]; then | ||
54 | eval useradd --root ${IMAGE_ROOTFS} --shell /sbin/nologin --system $name | ||
55 | fi | ||
56 | eval usermod --root ${IMAGE_ROOTFS} -a -G $group $name | ||
48 | fi | 57 | fi |
49 | done | 58 | done |
50 | done | 59 | done |