1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

test: use useradd instead of adduser

`adduser` is in certain cases a standalone package which provides a
better user experience. In other cases it's just a symlink to `useradd`.
And some distributions don't have `adduser` at all, like Arch Linux.
Let's use the `useradd` binary instead, which should provide the same
functionality everywhere.
This commit is contained in:
Frantisek Sumsal 2019-07-30 14:27:44 +02:00
parent 4c858c6fd5
commit 2de705cd1c

View File

@ -66,7 +66,8 @@ def setUpModule():
# create static systemd-network user for networkd-test-router.service (it
# needs to do some stuff as root and can't start as user; but networkd
# still insists on the user)
subprocess.call(['adduser', '--system', '--no-create-home', 'systemd-network'])
if subprocess.call(['getent', 'passwd', 'systemd-network']) != 0:
subprocess.call(['useradd', '--system', '--no-create-home', 'systemd-network'])
for d in ['/etc/systemd/network', '/run/systemd/network',
'/run/systemd/netif', '/run/systemd/resolve']: