HomeFreeBSD

config(8): Add `envvar` support

Description

config(8): Add envvar support

envvar allows adding individual environment variables to the kernel's static
environment without the overhead of pulling in a full file. envvar in a
config looks like:

envvar some_var=5

All envvar-provided variables will be added after the env file is processed,
so envvar keys that exist in the previous env will be overwritten by
whatever value is set here in the kernel configuration directly.

As an aside, envvar lines are intentionally tokenized differently from
basically every other line. We used a named state when ENVVAR is encountered
to gobble up the rest of the line, which will later be cleaned and validated
in post-processing by sanitize_envline. This turns out to be the simplest
and cleanest way to allow the flexibility that kenv does while not
compromising on silly hacks.

Reviewed by: ian (also contributor of sanitize_envline rewrite)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D15962

Details

Provenance
kevansAuthored on
Reviewer
ian
Differential Revision
D15962: config(8): Add `envvar` support
Parents
rS335641: Fix a stack overflow in mount_smbfs when hostname is too long.
Branches
Unknown
Tags
Unknown