Using systemd-tmpfiles for provisionning directories and files outside of /usr
Idea: Relying on systemd-tmpfiles to ensure needed directories and file in /var (and potentially /etc) exists, rather than putting them directly in Archlinux packages
Summary
Replacing /var directories creation in our PKGBUILDs with tmpfiles.d configuration. Replacing /etc directories and file creation in our PKGBUILDs with tmpfiles.d configuration and /usr/share/factory
Motivations
- Automatic creation of /var as a subvolume on btrfs (or other FS providing subvolume when tmpfiles.d get support for them, eg, bcachefs) => automatically exclude /var from root snapshots when using snapper or similar tools
- Easier usage of systemd-mkfs and related tools to make your own headless installer.
- Implementing ideas from https://0pointer.net/blog/projects/stateless.html
Specification
- List packages in [core] shipping /var
- Replace those with tmpfiles.d/*.conf files
- Add a namcap check/warning to warn when a packages contains /var
- Do 1 & 2 for [extra]
- List packages in [core] shipping /etc
- Replace those with tmpfiles.d/*.conf + /usr/share/factory
- Add a namcap check/warning to warn when a packages contains /var
- Do 6 for [extra]
Potentials difficulties
It's vastly easier if this is supported in the upstream software shipped, and not all of them might be willing to take patches for that. Automating the replacement of directories in /var looks possible, but moving stuff in packages from /etc to /usr/share/factory is surely less obvious.
Drawbacks
- For /etc specifically, I'm not sure how pacdiff files could work if that functionality is kept. Today if the package provided file was modified was modified, and we modified our own (pacman.conf for adding a local repository or enabling some repos for instances) you get a .pacdiff and the chances to merge the changes. => I don't see a way with the proposed scheme here.
Unresolved questions
- Upstream software which existing packaging tools put stuff in /var | /etc, does not work with simple automation in a generic way, and don't want to take patches for supporting this scheme.
Refs / Existing discussions
I'm not an Archlinux Dev or Packager or TU, so that would need support from one before becoming a proper RFC.
@xexaxo if you're still interested !