tmpfiles.eclass

Name

tmpfiles.eclass -- Functions related to tmpfiles.d files

Description

This eclass provides functionality related to installing and creating volatile and temporary files based on configuration files$and locations defined at this URL:

https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html

The dotmpfiles and newtmpfiles functions are used to install configuration files into /usr/lib/tmpfiles.d, then in pkg_postinst, the tmpfiles_process function must be called to process the newly installed tmpfiles.d entries.

The tmpfiles.d files can be used by service managers to recreate/clean up temporary directories on boot or periodically. Additionally, the pkg_postinst() call ensures that the directories are created on systems that do not support tmpfiles.d natively, without a need for explicit fallback.

Supported EAPIs

5 6 7 8

Example

Typical usage of this eclass:

EAPI=6
inherit tmpfiles

...

src_install() {
      ...
      dotmpfiles "${FILESDIR}"/file1.conf "${FILESDIR}"/file2.conf
      newtmpfiles "${FILESDIR}"/file3.conf-${PV} file3.conf
      ...
}

pkg_postinst() {
      ...
      tmpfiles_process file1.conf file2.conf file3.conf
      ...
}

Functions

dotmpfiles <tmpfiles.d_file> ...

Install one or more tmpfiles.d files into /usr/lib/tmpfiles.d.

newtmpfiles <old-name> <new-name>.conf

Install a tmpfiles.d file in /usr/lib/tmpfiles.d under a new name.

tmpfiles_process <filename> <filename> ...

Call a tmpfiles.d implementation to create new volatile and temporary files and directories.

Variables

TMPFILES_OPTIONAL (SET BEFORE INHERIT)

When not empty, disables the dependency on virtual/tmpfiles. Ebuilds that call tmpfiles_process conditionally should declare a conditional dependency themselves.

Authors

Mike Gilbert <floppym@gentoo.org>

William Hubbs <williamh@gentoo.org>

Maintainers

Gentoo systemd project <systemd@gentoo.org>

William Hubbs <williamh@gentoo.org>

Reporting Bugs

Please report bugs via https://bugs.gentoo.org/