Page MenuHomeFreeBSD

(WIP) rc: Allow environment to override sourced rc.conf
Needs ReviewPublic

Authored by kevans on Jan 17 2018, 3:29 AM.
Tags
Referenced Files
F168012492: D13946.diff
Tue, Aug 25, 10:06 PM
F167998044: D13946.id.diff
Tue, Aug 25, 8:26 PM
F167991070: D13946.id38073.diff
Tue, Aug 25, 7:23 PM
Unknown Object (File)
Sun, Aug 23, 8:25 PM
Unknown Object (File)
Sun, Aug 23, 7:33 PM
Unknown Object (File)
Sun, Aug 23, 6:56 PM
Unknown Object (File)
Sat, Aug 22, 5:41 AM
Unknown Object (File)
Thu, Aug 20, 11:56 AM
Subscribers

Details

Reviewers
jilles
dteske
Summary

This is the idea I've got in the back of my mind to allow for easier testing of service(8), maybe sysrc(8) if that makes sense as well.

Allow override of local rc.conf with an environment variable, in similar fashion to __MAKE_CONF: __RC_CONF. This allows the environment to override the sourcing of /etc/rc.conf and /etc/rc.conf.local for reasonable testing of service(8). An example test being able to create an rc.conf that overrides local_startup and/or other rc vars so that it can reasonably test without worrying about an installed port breaking things.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 14428

Event Timeline

I understand the double-underbar prefix as an analog to __MAKE_CONF but right above __RC_CONF is RC_PID; could we make it RC_CONF to be more internally consistent within the given file?

I understand the double-underbar prefix as an analog to MAKE_CONF but right above RC_CONF is RC_PID; could we make it RC_CONF to be more internally consistent within the given file?

Sure- I'm not set on any of it, to be honest- I figured the double-underbar prefix would also make it harder to accidentally set, but I suppose RC_CONF is already not something likely to be accidentally set. ;)

Do you have any opinions on this as a mechanism in general? It'd be nice if we could test service(8) and some friends within our normal test framework without imposing jails as a requirement, but I can see where one might prefer such tests to be jail-based. The problem is that I *think* jail-based tests, though eventually necessary, are going to be pretty heavy from a testing perspective.

0mp added a subscriber: 0mp.
etc/defaults/rc.conf
20–21

Don’t default-assign -- with the test below this always fires and rc_conf_files becomes /etc/rc.conf every boot (drops .local).

Suggest deleting this line and consuming RC_CONF only in source_rc_confs when set.

706–708

Override only when set (empty = no local files)

etc/rc.subr
36

Makes set-NULL invalid where NULL is a valid choice (means no default files)

Suggest deleting this line

1377–1379

-r and . want one path; RC_CONF is a list. Unquoted. If unset, still want /etc/rc.conf