]> code.ossystems Code Review - openembedded-core.git/commit
useradd_base: keep group if it still has users
authorIoan-Adrian Ratiu <adrian.ratiu@ni.com>
Mon, 23 Jan 2017 18:09:23 +0000 (20:09 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 26 Jan 2017 10:41:10 +0000 (10:41 +0000)
commitbba1f02cb6d80279c6fed34bb18f010aa921fc1e
treef4170b495a7f7f06ebc59fb031d4be8e5ce32db4
parent946c4558f6c2726d0f12e48974568188a4ffef0d
useradd_base: keep group if it still has users

perform_groupdel() tries to delete a group irrespective if other
users have it as their primary group, thus the call to groupdel will
fail with the following error error:

groupdel: cannot remove the primary group of user '<user>'

Add a check to perform_groupdel() to determine if there are other
users and keep the group, printing a warning. This is called right
after a user is deleted to delete it's group. If the last user is
deleted, only then the group is also deleted.

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/useradd_base.bbclass