rc.conf amalgamation

# `rc.conf` amalgamation

Before converting into the native form for this system the external formats import subsystem first creates an amalgamated `rc.conf` file which incorporates the information from all of the several system `rc.conf` files as well as from other sources.

This file incorporates the information from:

- `/etc/default/rc.conf`, which is the "known starting point" of the `rc.conf` system.

- All files named in the `rc_conf_files` setting that is in `/etc/default/rc.conf`. These include `/etc/rc.conf`, `/etc/rc.conf.local`, and any further extra files employed by FreeBSD derivatives.

  Note: OpenBSD nowadays has the explicit requirement that `/etc/rc.conf` not employ any shell constructs other than simple variable assignments, and actually be a data file with `variable=value` assignments that can be processed without using a shell language interpreter. The amalgamation system enforces this on Linux. One can get away, to a small extent, with using shell scripting in these files on FreeBSD and derivatives; however it is strongly recommended to follow the lead of OpenBSD here and not do so.

- The FreeNAS `/data/freenas-v1.db` database, in particular the enabled "system tunables".

- The results of converting several Debian settings files into the equivalent FreeBSD `rc.conf` settings:

  - `/etc/vconsole.conf`, which is the systemd console settings file;

  - `/etc/defaults/console-setup` and `/etc/defaults/keyboard`, which are the Debian console-setup and keyboard packages' console settings files;

  - `/etc/kbd/config`, which is the Debian kbd package's console settings file;

    and

  - `/etc/network/interfaces`, which is the Debian ifupdown package's network interface settings file.

- The results of converting OpenBSD settings files into the equivalent FreeBSD `rc.conf` settings:

  - `/etc/hostname.interface`, which is the network settings file for interface interface.

- Several hostname settings files:

  - `/etc/HOSTNAME` and `/etc/hostname`

  - `/etc/sysconfig/network`, `/etc/conf.d/hostname`, and `/etc/default/hostname`, which are expected to be `rc.conf` style settings files with `hostname` or `HOSTNAME` settings

    The same restriction applies these as to `/etc/rc.conf`: they should not employ any shell constructs other than simple variable assignments.

  This takes over external configuration import functionality that used to be, but is no longer, part of `set-dynamic-hostname`. `set-dynamic-hostname` only uses native configuration mechanisms, environment variables, now; relying upon the external configuration import subsystem to translate all of the aforementioned non-native configuration systems.

The result is an amalgam that can be conveniently used with `read-conf` when one needs to access configuration settings. This amalgam is the unified source of information for the subsequent conversion into native form.

The amalgamation process is not designed to be restrictive when it comes to platforms. It permits (for examples) a Debian-style `/etc/network/interfaces` to be used on OpenBSD, or a FreeNAS database to be used on Debian, or an OpenBSD `/etc/hostname.interface` file to be used on FreeBSD.

The conversion of a Debian-style `/etc/network/interfaces` can cope with the "new-style" assignments of multiple IP address to a single network interface, where one repeats the same `iface … static` "stanza" several times. However, it does not convert any `post-up` or `pre-down` settings. Those do not have `rc.conf` equivalents; and the conversion of `/etc/network/interfaces` is constrained to stuff that does not constitute the execution of arbitrary commands and programs.

The conversion of an OpenBSD `/etc/hostname.interface` file does not convert any embedded shell commands. It also marks all interfaces as "AUTO".