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>
This commit is contained in:
parent
eb94ba9052
commit
afc60481c7
|
@ -37,7 +37,13 @@ if test "x$GROUPADD_PARAM" != "x"; then
|
||||||
opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1`
|
opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1`
|
||||||
remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
|
remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
|
||||||
while test "x$opts" != "x"; do
|
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
|
if test "x$opts" = "x$remaining"; then
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue