I'd like to see support for systemd's "sysusers.d" [1] in user.eclass. This would allow straightforward user creation in stateless systems [2] which are built using Gentoo/binpkgs. This would basically just mean, that 'enew{user,group}' would drop a per-package file into /usr/lib/sysusers.d/, e.g. /usr/lib/sysusers.d/www-servers_apache-2.4.12.conf: u apache 81 "Apache httpd" /var/www [1] http://www.freedesktop.org/software/systemd/man/sysusers.d.html [2] http://0pointer.net/blog/projects/stateless.html
That's an interesting idea. The first question that comes to mind would be how to handle the id assignment. We seem to have a few options. From the manual: > For u and g the numeric 32bit UID or GID of the user/group. Do not use IDs 65535 or 4294967295, as they have special placeholder meanings. Specify "-" for automatic UID/GID allocation for the user or group. Alternatively, specify an absolute path in the file system. In this case the UID/GID is read from the path's owner/group. This is useful to create users whose UID/GID match the owners of pre-existing files (such as SUID or SGID binaries). In summary: - Specify a number for a static uid/gid. - Specify a hyphen for a random uid/gid. - Specify a path to grab the uid/gid from an existing file.
I think this is done? commit 0d096cb68e86dd5faa7da8cf68a18e4e29bc9081 Author: Michał Górny <mgorny@gentoo.org> Date: Fri Dec 13 17:32:09 2019 +0100 acct-*.eclass: Create sysusers.d files Thanks to David Michael for the initial patch and upstream fixes. Signed-off-by: Michał Górny <mgorny@gentoo.org>