Fedora.next Per-Product Configuration Packaging

Goals

In the Fedora.next world, we have a set of curated Fedora Products as well as the availability of classic Fedora. Historically, we have maintained a single set of configuration defaults for all Fedora installs, but different target use-cases have different needs. The goal of this document is to set out the guidelines for creating per-Product configuration defaults.

We want to ensure that all packages have sensible defaults for whichever Product on which they are installed, while also avoiding situations where users would have some packages installed with one Product's defaults and some packages with another.

Definitions

Fedora.next: Umbrella term for planning Fedora's future. Currently covering the creation of the Fedora Products, Fedora Base Design and Fedora Environments and Stacks.$PRODUCT: One of the Fedora.next Product deliverables, currently "Cloud", "Server" and "Workstation".

Per-product Configuration Packaging

These guidelines are not needed for all packagesOnly packages whose defaults differ between Fedora Products are required to follow these instructions. Packages whose configuration is the same for all products can simply install the config files as they normally would.

Requirements

All packages MUST have a global default configuration. This configuration will be used whenever a Product-specific default configuration is not required. (For example, if a non-Product install is in use or only Fedora Cloud has a custom configuration and Fedora Workstation was installed).

Any package that requires a per-product default configuration MUST provide all alternate configuration files in the same package.

Any package that requires a configuration that differs between Products MUST obtain permission from that Product's Working Group before packaging it.

Global Default Configuration

The global default configuration MUST be provided by the package that requires it.

The global default configuration MUST be named based on the package's normal naming scheme, with the main part of the name being suffixed by -default. For example, if the package normally uses foo.conf, then the global default configuration MUST be named foo-default.conf

Per-Product Default Configuration

For each Product requiring a unique default configuration, the packager MUST provide a copy of the default configuration file, modified as appropriate for the specific product.

The product-specific configuration file MUST be named based on the package's normal naming scheme, with the main part of the name being suffixed by a dash followed by the name of the product. For example, if the package normally uses foo.conf, then the Server version MUST be named foo-server.conf.

If the configuration will be symlinked in place, the product-specific configuration file MUST be located in an appropriate part of the /etc hierarchy. The divergent config file MUST be specified as %config(noreplace) in %files as per the usual /etc packaging guidelines.

If the configuration will be copied in place, the product-specific configuration file MUST be located in an appropriate part of the /usr/share hierarchy. The divergent config file MUST be specified as a normal file in the %files section.

Applying Configuration

In order to apply the configuration, the packager MUST implement a mechanism in the %posttrans section of the specfile that behaves as follows:

It MUST first check whether the final config file already exists. If so, the script MUST make no changes.

%posttrans
if [ ! -e %{_sysconfdir}/foo/foo.conf ]; then
...
fi

Then it MUST use the value of the Fedora VARIANT_ID to symlink or copy one of the divergent config files (or the default) to the final config file location. It will get this value by importing the contents of /etc/os-release as shell values. Known values of this field at the time of this writing are "atomichost", "cloud", "server", and "workstation". For more detail, see the os-release(5) man page.

Example (firewalld)

We will assume for the sake of demonstration that firewalld will need a custom configuration for Fedora Server and Fedora Workstation, but that Fedora Cloud will not require any changes from the global default.