diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2011-10-20 21:18:11 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-30 16:38:04 +0000 |
| commit | afc60481c76f35647e566f008f2291d0bf94f530 (patch) | |
| tree | a0b908f9683014c0def0d610f9499b8407a07f5e /meta/classes | |
| parent | eb94ba90522cb1b3a87d9d14704dcc2d1e8e6cf0 (diff) | |
| download | poky-afc60481c76f35647e566f008f2291d0bf94f530.tar.gz | |
useradd.bbclass: check if a group already exists manually
The use of groupadd -f makes much more difficult to figure when a
group is not add. This was the case of the class not working for our
usage and this being caused by the lack of '/etc/group' file but
unnoticed as groupadd wasn't failing according.
(From OE-Core rev: 82933a1ff921fd0836f03e6f379fd8536cdc0a30)
(From OE-Core rev: e3e8f15176107fa26248e878af548835692d3068)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
| -rw-r--r-- | meta/classes/useradd.bbclass | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass index 1e03a04a8c..fb70b3e679 100644 --- a/meta/classes/useradd.bbclass +++ b/meta/classes/useradd.bbclass | |||
| @@ -37,7 +37,13 @@ if test "x$GROUPADD_PARAM" != "x"; then | |||
| 37 | opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1` | 37 | opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1` |
| 38 | remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-` | 38 | remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-` |
| 39 | while test "x$opts" != "x"; do | 39 | while test "x$opts" != "x"; do |
| 40 | eval $PSEUDO groupadd -f $OPT $opts | 40 | groupname=`echo "$opts" | awk '{ print $NF }'` |
| 41 | group_exists=`grep "^$groupname:" $SYSROOT/etc/group || true` | ||
| 42 | if test "x$group_exists" = "x"; then | ||
| 43 | eval $PSEUDO groupadd $OPT $opts | ||
| 44 | else | ||
| 45 | echo "Note: group $groupname already exists, not re-creating it" | ||
| 46 | fi | ||
| 41 | 47 | ||
| 42 | if test "x$opts" = "x$remaining"; then | 48 | if test "x$opts" = "x$remaining"; then |
| 43 | break | 49 | break |
