You are not logged in.

#1 2024-08-31 15:14:07

daniel_shub
Member
Registered: 2012-06-21
Posts: 89

When to use systemd tmpfiles?

I asked a question in the unifi package comments (https://aur.archlinux.org/packages/unifi#comment-988765) about systemd tmpfiles. The Unifi package creates a directory (/var/lib/unifi) in both the PKGBUILD and with unifi.tmpfiles. @Scimmia, who generally has good advice suggests that it is fine and it is good to track things in the package and use the systemd tempfiles to set ownership and permissions as needed. That seems reasonable. If that is the case, should all the files created by unifi.tmpfiles (https://aur.archlinux.org/cgit/aur.git/ … es?h=unifi) be created in the PKGBUILD?

I guess the general question is, is there a good resources of when/how to use systemd tmpfiles and when to create the files in the PKGBUILD?

Offline

#2 2024-08-31 21:28:43

seth
Member
Registered: 2012-09-03
Posts: 58,704

Re: When to use systemd tmpfiles?

Scimmia wrote:

Best to track whatever possible in the package.

https://wiki.archlinux.org/title/System … rary_files

systemd-tmpfiles creates, deletes and cleans up volatile and temporary files and directories

The benefit and main purpose of systemd-tmpfiles is that it can ensure the presence of files in tmpfs mounts - eg. going w/ the example in the wiki, installing a directory or file in /run would not really work as /run is a tmpfs mount and the contents gone w/ a reboot.

Everything you want on canonically non-volatile storage, you want to be tracked by pacman, so it can handle the clean--up when the package gets removed.
/var isn't expected to be be volatile (a tmpfs)  so you can and want to add everything in that path w/ pacman, not systemd-tmpfiles

The only reason to consider systemd-tmpfiles here at all is the ownership necessitated by https://aur.archlinux.org/cgit/aur.git/ … rs?h=unifi

Online

Board footer

Powered by FluxBB