Bug#945269: debian-policy: packages should use tmpfiles.d(5) to create directories below /var
Package: debian-policy
I would like to recommend packages to use tmpfiles.d(5) to manage
creating directories in locations such as /var or /etc instead of
maintainer scripts.
It could also be used to create trivial files below /var that should be
recreated if deleted by accident (such as atd's sequence number which is
currently created by the maintainer script).
This has advantages over maintainer scripts:
- It's declarative instead of imperative.
- Directories/files get recreated automatically if deleted;
previously packages would sometimes just fail if one deleted, for
example, a subdirectory of /var/cache.
- Manipulating ownership of files is prone to race conditions or fun
with hard- and symlinks; many maintainer scripts don't do this fully
correct.
- It brings stateless systems (which start with empty /etc, /var) a bit
closer.
I'm also fine with alternatives such as using `CacheDirectory=`,
`StateDirectory=`, `ConfigurationDirectory=` or `LogsDirectory=` in
.service files where appropriate.
I have no opinion on implementation details so far.
As far as I understand the current GR is unrelated to adopting things
like systemd-tmpfiles.
Ansgar
Reply to: