diff options
author | Mariano Lopez <mariano.lopez@linux.intel.com> | 2016-07-25 13:31:25 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-01 11:47:10 +0100 |
commit | be68ef5129b787978a0e540eb58427b32bd67ce3 (patch) | |
tree | dd733adc3b3b47ba0a3991ba39322d2ad7391607 /meta/classes/useradd.bbclass | |
parent | aa2d94542336f359a1205520e844c1bcff53712b (diff) | |
download | poky-be68ef5129b787978a0e540eb58427b32bd67ce3.tar.gz |
useradd.bbclass: Fix delete user/group when more than one item
Currently when a recipe adds more than one user/group, the
cleansstate task will delete only the first user/group. This
will solve this behavior and delete all users/groups.
[YOCTO #9943]
(From OE-Core rev: da191d5c139a6b400d1b8fe246912b081dd18176)
Signed-off-by: Mariano Lopez <mariano.lopez@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/useradd.bbclass')
-rw-r--r-- | meta/classes/useradd.bbclass | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass index 28dd341bf7..8d51fb5a45 100644 --- a/meta/classes/useradd.bbclass +++ b/meta/classes/useradd.bbclass | |||
@@ -137,15 +137,21 @@ if test "x${STAGING_DIR_TARGET}" != "x"; then | |||
137 | GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}" | 137 | GROUPADD_PARAM="${@get_all_cmd_params(d, 'groupadd')}" |
138 | USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}" | 138 | USERADD_PARAM="${@get_all_cmd_params(d, 'useradd')}" |
139 | 139 | ||
140 | if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then | 140 | user=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | awk '{ print $NF }'` |
141 | user=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | awk '{ print $NF }'` | 141 | remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2- -s | sed -e 's#[ \t]*$##'` |
142 | while test "x$user" != "x"; do | ||
142 | perform_userdel "${STAGING_DIR_TARGET}" "$OPT $user" | 143 | perform_userdel "${STAGING_DIR_TARGET}" "$OPT $user" |
143 | fi | 144 | user=`echo "$remaining" | cut -d ';' -f 1 | awk '{ print $NF }'` |
144 | 145 | remaining=`echo "$remaining" | cut -d ';' -f 2- -s | sed -e 's#[ \t]*$##'` | |
145 | if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then | 146 | done |
146 | group=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | awk '{ print $NF }'` | 147 | |
147 | perform_groupdel "${STAGING_DIR_TARGET}" "$OPT $group" | 148 | user=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | awk '{ print $NF }'` |
148 | fi | 149 | remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2- -s | sed -e 's#[ \t]*$##'` |
150 | while test "x$user" != "x"; do | ||
151 | perform_groupdel "${STAGING_DIR_TARGET}" "$OPT $user" | ||
152 | user=`echo "$remaining" | cut -d ';' -f 1 | awk '{ print $NF }'` | ||
153 | remaining=`echo "$remaining" | cut -d ';' -f 2- -s | sed -e 's#[ \t]*$##'` | ||
154 | done | ||
149 | 155 | ||
150 | fi | 156 | fi |
151 | fi | 157 | fi |