Skip to content

Ease migration to FHS' 3.0 /run directory

Summary

Add build option to switch from /var/run ($localstatedir/run) to /run, if wanted, but still defaulting to /var/run, for the time being at least.

Purpose

Present a migration path to distributions seeking to comply with FHS 3.0 (and further). More specifically regarding to the /run directory, where its dedicated chapter, in the standard, states:

The purposes of this directory were once served by /var/run. In general, programs may continue to use /var/run to fulfill the requirements set out for /run for the purposes of backwards compatibility. Programs which have migrated to use /run should cease their usage of /var/run, except as noted in the section on /var/run.

And the chapter dedicated to /var/run:

This directory was once intended for system information data describing the system since it was booted. These functions have been moved to /run; this directory exists to ensure compatibility with systems and software using an older version of this specification.


Besides, the Autotools' configure.ac provides the --with-runstatedir / --runstatedir options:

AC_ARG_WITH([runstatedir],
            AS_HELP_STRING([--with-runstatedir=DIR],
                           [Directory for /var/run. Defaults to $localstatedir/run. In autoconf >= 2.70, you should instead use --runstatedir option. This option takes precedence over --runstatedir.]),
            [runstatedir="$withval"])
AS_IF([test -z "$runstatedir"], runstatedir="$localstatedir/run")
AC_SUBST(runstatedir)

As an alternative, making the option a string to be passed to meson rather than a boolean would also suffice, if it's more desirable.


openSUSE, as other major Linux distributions, uses a /var/run -> /run symlink and lately we introduced a patch to force Meson to use /run - because of the lack of a build option/switch - and we haven't run into trouble, as far as I can tell.

Checklist

x - the subject for all commits is concise and explicative x - the message for all commits explain the reason for the change x - the source is properly formatted x - any relevant documentation is up to date x - you have added unit tests if applicable

Merge request reports