On Sat, Aug 05, 2023 at 10:56:19PM +0200, Fabio Valentini wrote:
> I have a draft sysusers.d config file here:
> https://github.com/decathorpe/ntpd-rs-rpms/blob/main/ntpd-rs/ntpd-rs.sysusers
> 
> This looks similar to existing files in /usr/lib/sysusers.d/, but the
> %sysusers_create_compat scriptlet fails to parse this file (apparently
> it doesn't recognise the first line as a comment??) ...

This seems to work here.
$ rpmspec --define '_sourcedir .' --define '_builddir .' -P *.spec | rg -A6 -w 
%pre
%pre

# generated from ntpd-rs.sysusers
getent group 'ntpd-rs' >/dev/null || groupadd -r 'ntpd-rs' || :
getent passwd 'ntpd-rs' >/dev/null || \
    useradd -r -g 'ntpd-rs' -d '/var/lib/ntpd-rs' -s '/sbin/nologin' -c 
'ntpd-rs system user' 'ntpd-rs' || : 

> The package needs to create /var/lib/ntpd-rs with mode 700 and have it
> owned by the ntpd-rs user, so if I understand correctly, just dropping
> in the sysusers.d config file is not enough, since the user won't be
> available during the RPM transaction to own this directory. Instead I
> would need to invoke the sysusers_crate macro in the package?

As Dominik wrote in the other reply, a tmpfiles.d drop-in would be be
the best solution for files in /var/lib.

Zbyszek
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to