[aur-general] Create user
Hey, An application I'm thinking about packaging for AUR requires its own user to run. Is it ok to be/How would I go about creating a "user" that will be created on the installer's system when they install the package? Thanks, Yash
On 5/21/20 10:29 PM, karx via aur-general wrote:
Hey,
An application I'm thinking about packaging for AUR requires its own user to run. Is it ok to be/How would I go about creating a "user" that will be created on the installer's system when they install the package?
Use sysusers.d(5) to install a description of the user you need. systemd comes with a pacman hook to create users based on sysusers.d dropins (and for non-systemd distros using e.g. OpenRC, there are reimplementations like opensysusers, because this is generally portable and beneficial to use). You can usually specify the "-" placeholder instead of a reserved, hardocded uid, and have one automatically assigned. This is preferable whenever possible. You can check the output of $ pkgfile -vr '/usr/lib/sysusers.d/.*\.conf' to see which packages in the repositories use sysusers.d files, and see how they are using it for inspiration. (Or see which packages on your system provide files in /usr/lib/sysusers.d/) -- Eli Schwartz Bug Wrangler and Trusted User
On May 22, 2020 2:29:52 AM UTC, karx via aur-general <aur-general@archlinux.org> wrote:
Hey,
An application I'm thinking about packaging for AUR requires its own user to run. Is it ok to be/How would I go about creating a "user" that will be created on the installer's system when they install the package?
Thanks, Yash
I looked up an official package I know creates a user (postgresql) and it seems to provide this file[1] and install it in the PKGBUILD[2] with the following line (line 208) :
install -Dm 644 ${pkgname}.sysusers "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
[1]: https://git.archlinux.org/svntogit/packages.git/tree/trunk/postgresql.sysuse... [2]: https://git.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packag...
An application I'm thinking about packaging for AUR requires its own user to run. Is it ok to be/How would I go about creating a "user" that will be created on the installer's system when they install the package?
See if you can make it work with DynamicUser=yes. Most of the applications are fine working as such. https://www.freedesktop.org/software/systemd/man/systemd.exec.html#DynamicUs... http://0pointer.net/blog/dynamic-users-with-systemd.html -- damjan
participants (4)
-
Damjan Georgievski
-
Eli Schwartz
-
karx
-
Kusoneko