Commit Graph

11 Commits

Author SHA1 Message Date
Jörg Thalheim ff12a7954c treewide: more portable bash shebangs
As in 2a5fcfae02
and in 3e67e5c992
using /usr/bin/env allows bash to be looked up in PATH
rather than being hard-coded.

As with the previous changes the same arguments apply
- distributions have scripts to rewrite shebangs on installation and
  they know what locations to rely on.
- For tests/compilation we should rather rely on the user to have setup
  there PATH correctly.

In particular this makes testing from git easier on NixOS where do not provide
/bin/bash to improve compose-ability.
2020-03-05 17:27:07 +01:00
David Michael 649916d356 sysusers: support creating users with a specific primary group
This extends the "uid:gid" syntax for "u" lines so that a group
name can be given instead of a GID.  This requires that the group
is either queued for creation by sysusers, or it is already defined
on the system.

Closes #14340
2020-02-02 16:53:22 +01:00
dann frazier 37b9966e25 test: Synchronize journal before reading from it
There's a race condition in the sysuser test where it may try to read
entries from the journal before they are available. Fix it by adding a
`journalctl --sync` call.

BugLink: https://bugs.launchpad.net/bugs/1776654
2020-01-28 15:11:58 +01:00
Michael Biebl 6db904625d meson: make nologin path build time configurable
Some distros install nologin as /usr/sbin/nologin, others as
/sbin/nologin.
Since we can't really on merged-usr everywhere (where the path wouldn't
matter), make the path build time configurable via -Dnologin-path=.

Closes #13028
2019-07-18 12:46:35 +02:00
Zbigniew Jędrzejewski-Szmek cc5549ca12 scripts: use 4 space indentation
We had all kinds of indentation: 2 sp, 3 sp, 4 sp, 8 sp, and mixed.
4 sp was the most common, in particular the majority of scripts under test/
used that. Let's standarize on 4 sp, because many commandlines are long and
there's a lot of nesting, and with 8sp indentation less stuff fits. 4 sp
also seems to be the default indentation, so this will make it less likely
that people will mess up if they don't load the editor config. (I think people
often use vi, and vi has no support to load project-wide configuration
automatically. We distribute a .vimrc file, but it is not loaded by default,
and even the instructions in it seem to discourage its use for security
reasons.)

Also remove the few vim config lines that were left. We should either have them
on all files, or none.

Also remove some strange stuff like '#!/bin/env bash', yikes.
2019-04-12 08:30:31 +02:00
Yu Watanabe 0013fac248 test: do not use global variable to pass error 2018-10-09 19:11:21 +09:00
Franck Bui 97e34e945c test: add a sysusers test with NIS entries 2018-03-17 14:18:26 +01:00
Zbigniew Jędrzejewski-Szmek 4e9fe38dc0 test/TEST-21-SYSUSERS: add tests for new functionality 2018-02-02 10:40:24 +01:00
Michael Vogt b9ee05c266 sysusers: allow force reusing existing user/group IDs (#8037)
On Debian/Ubuntu systems the default passwd/group files use a
slightly strange mapping. E.g. in passwd:
```
man6:12::/var/cache/man:/sbin/nologin
```
and in group:
```
disk6:
man12:
```

This is not supported in systemd-sysusers right now because
sysusers will not re-use an existing uid/gid in its normal
mode of operation. Unfortunately this reuse is needed to
replicate the default Debian/Ubuntu users/groups.

This commit enforces reuse when the "uid:gid" syntax is used
to fix this.

I also added a test that replicates the Debian base-passwd
passwd/group file to ensure things are ok.
2018-02-01 13:47:50 +09:00
Michael Vogt 28e7fad73f sysusers: ensure GID in uid:gid syntax exists
Ensure that the GID already exists or is created when the new
"uid:gid" syntax is used. This ensures the behaviour is always
predictable.
2018-01-25 17:43:08 +01:00
Michael Vogt 1e589ed264 test: add TEST-21-SYSUSERS test
This test tests the systemd-sysuser binary via the --root=$TESTDIR
option and ensures that for the given inputs the expected passwd
and group files will be generated.
2018-01-25 12:51:00 +01:00