aboutsummaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2011-10-20 21:18:11 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-10-24 14:28:17 +0100
commit82933a1ff921fd0836f03e6f379fd8536cdc0a30 (patch)
treecbf926cc0a99be7d960a911b62d78a9091283fb8 /meta
parent23c5a83e877efe6d86618898dd181bb75f44aa71 (diff)
downloadopenembedded-core-contrib-82933a1ff921fd0836f03e6f379fd8536cdc0a30.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. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/useradd.bbclass8
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
opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1`
remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
while test "x$opts" != "x"; do
- eval $PSEUDO groupadd -f $OPT $opts
+ groupname=`echo "$opts" | awk '{ print $NF }'`
+ group_exists=`grep "^$groupname:" $SYSROOT/etc/group || true`
+ if test "x$group_exists" = "x"; then
+ eval $PSEUDO groupadd $OPT $opts
+ else
+ echo "Note: group $groupname already exists, not re-creating it"
+ fi
if test "x$opts" = "x$remaining"; then
break