stages/users: support new users w/ duplicate uids

When adding a new user with a uid that already exists, the "-o",
option needs to be added. Always do so when the uid is specified.
A use case for this is e.g. an installer iso with a `install`
user that has 0 (like root) for its uid (and gid).
This commit is contained in:
Christian Kellner 2020-06-02 17:22:04 +02:00
parent 04d3c0fc17
commit 3f14ace5c1

View file

@ -83,7 +83,7 @@ def getpwnam(root, name):
def useradd(root, name, uid=None, gid=None, groups=None, description=None, home=None, shell=None, password=None):
arguments = []
if uid is not None:
arguments += ["--uid", str(uid)]
arguments += ["--uid", str(uid), "-o"]
if gid is not None:
arguments += ["--gid", str(gid)]
if groups: