On Tue, 06 Jun 2023 13:07:37 +0100 Luca Boccassi <bl...@debian.org> wrote: > Sounds like a good plan to me.
Updated as suggested. -- Kind regards, Luca Boccassi
From 20a655663c17914699e72e48a74daca03fd42a22 Mon Sep 17 00:00:00 2001 From: Luca Boccassi <bl...@debian.org> Date: Tue, 9 May 2023 01:38:13 +0100 Subject: [PATCH] Define tmpfiles.d interface and usage --- policy/ch-files.rst | 37 +++++++++++++++++++++++++++++++++ policy/ch-maintainerscripts.rst | 6 ++++++ 2 files changed, 43 insertions(+) diff --git a/policy/ch-files.rst b/policy/ch-files.rst index b34c183..30ce013 100644 --- a/policy/ch-files.rst +++ b/policy/ch-files.rst @@ -722,6 +722,43 @@ The name of the files and directories installed by binary packages outside the system PATH must be encoded in UTF-8 and should be restricted to ASCII when it is possible to do so. +.. _s-tmpfiles.d: + +tmpfiles.d +---------- + +Packages might need additional files or directories to implement their +functionality. Directories that are located under ``/var/`` or ``/etc/``, and +files that are located under ``/var/``, must not be created manually via +maintainer scripts, but instead be declaratively defined via the `tmpfiles.d +<https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html>`_ interface. +The ``tmpfiles.d`` file format is defined by the ``systemd`` project, and is +guaranteed to be stable. Ideally, such definitions should be defined upstream +where applicable, and shipped as they are by Debian packages. + +Details about the syntax and installation paths for ``tmpfiles.d`` are defined +by its `reference implementation's documentation, +<https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html>`_ and will +not be redefined here. + +``tmpfiles.d`` snippets should be usable on systems that do not boot (such as a +very minimal chroot image), and also on systems booting with init systems other +than ``systemd``. + +``tmpfiles.d`` snippets should be detected at package build time by tools such +as ``debhelper``, packaged, and the appropriate snippet to call them on +installation, upgrade, removal, purge and other steps as required, should be +automatically added by helpers such as ``dh_installtmpfiles``. Packages shipping +``tmpfiles.d`` snippets should depend on the appropriate virtual packages in the +following order: ``default-systemd-tmpfiles | systemd-tmpfiles``. + +Init systems are required to integrate with ``tmpfiles.d`` and run the service +that applies them on boot, and regularly for cleanup purposes. The documentation +for the reference implementation, `systemd-tmpfiles, +<https://www.freedesktop.org/software/systemd/man/systemd-tmpfiles.html>`_ +explains how to call the program so that the appropriate ``tmpfiles.d`` snippets +are applied at the appropriate time. + .. [#] If you are using GCC, ``-fPIC`` produces code with relocatable position independent code, which is required for most architectures diff --git a/policy/ch-maintainerscripts.rst b/policy/ch-maintainerscripts.rst index 724074c..320949d 100644 --- a/policy/ch-maintainerscripts.rst +++ b/policy/ch-maintainerscripts.rst @@ -50,6 +50,12 @@ absolute pathname. Maintainer scripts should also not reset the appending package-specific directories. These considerations really apply to all shell scripts. +Maintainer scripts should not be used to create or remove auxiliary files and/or +directories that packages may need, such as those in ``/var/`` or ``/etc/``. +Instead, :ref:`s-tmpfiles.d` snippets should be shipped, being ideally provided by +the upstream sources, if any. For more details about the ``tmpfiles.d`` +interface, see :ref:`s-tmpfiles.d`. + .. _s-idempotency: Maintainer scripts idempotency -- 2.39.2
signature.asc
Description: This is a digitally signed message part