Correct way to add a user in a custom package (PKGBUILD)
Hi all :-)
I already created a few *-openrc packages that are currently missing (tftp-hpa-openrc and quassel-core-openrc, simply by stealing the OpenRC init script from Gentoo ;-). Now, I'm working on msmtp-openrc, because I want to migrate a Gentoo machine to Artix which runs msmtpd (btw. can I contribute those packages in some way to support OpenRC on Artix?!).
I did the same, simply took the Gentoo init script and created a package. But when I tried to start the daemon, I noticed that Gentoo runs msmpd with it's own user, and Artix doesn't create one whilst installing msmtp. It seems reasonable to me to run such a service with a dedicated user.
So here's my question: What's the correct way to add a user via a package?
Gentoo pulls two dedicated packages for group and user management when one installs msmpd with the "daemon" use flag set. Those are acct-group/msmtpd, creating /usr/lib/sysusers.d/acct-group-msmtpd.conf with the following content:
g msmtpd 222
and acct-user/msmtpd, creating /usr/lib/sysusers.d/acct-user-msmtpd.conf with:
u msmtpd 222:msmtpd user\ for\ msmtp\ daemon /dev/null -
Does Artix have a similar mechanism? What's the Artix way to create groups and users?
Would I create a file, e.g. /usr/lib/sysusers.d/msmtpd.conf, with
g msmtpd -
u msmtpd -:msmtpd "User for the msmtp daemon" /dev/null -
?
Thanks for all help, I'd like to do this the correct way!