Page MenuHomeFreeBSD

Add support for a /etc/defaults/vendor.conf override file
ClosedPublic

Authored by lidl on Jun 19 2016, 9:29 PM.

Details

Summary

It would be really handy to have a place to hook in overrides for the system defaults
for daemons to be enabled, and their flags. Vendors who ship products based around
FreeBSD typically have to enable a bunch of product specific overrides to the daemons
that need to be run.

Rather than putting all these settings in /etc/rc.conf, which might also have a
bunch of per-machine settings. Standardize this by adding a /etc/defaults/vendor.conf settings file.

Test Plan

Tested on a virtual machine. Daemons enabled in /etc/defaults/vendor.conf are now started, without being references in /etc/rc.conf.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

lidl updated this revision to Diff 17702.Jun 19 2016, 9:29 PM
lidl retitled this revision from to Add support for a /etc/rc.vendor override file.
lidl updated this object.
lidl edited the test plan for this revision. (Show Details)
lidl added reviewers: rpaulo, dteske, stas.
lidl set the repository for this revision to rS FreeBSD src repository.
stas edited edge metadata.Jun 20 2016, 6:55 PM

This looks good, but I'm a little bit confused as to how it is different from rc.local? Does it provide anything which can't be achieved by using rc.local which seems to serve the same purpose?

lidl added a comment.Jun 20 2016, 7:21 PM

The rc.local execution happens much later in the startup process, after daemons, etc have already started being executed.

This hook happens much earlier, so a vendor shipping a product based on FreeBSD can still ship a completely 'stock' /etc/defaults/rc.conf, yet still be able to have complete control over the start state for all the FreeBSD supplied daemons on the system, and their flags.

One could even use this to override to alter the set of directories that should be searched for for additional startup files for any services/daemons that a vendor might supply for their product.

stas accepted this revision.Jun 20 2016, 9:29 PM
stas edited edge metadata.

I see, thanks for the explanation. It would be perfect to add a short version of it to the commit message as well.

This revision is now accepted and ready to land.Jun 20 2016, 9:29 PM
lidl updated this revision to Diff 17717.Jun 20 2016, 10:45 PM
lidl retitled this revision from Add support for a /etc/rc.vendor override file to Add support for a /etc/defaults/vendor.conf override file.
lidl updated this object.
lidl edited the test plan for this revision. (Show Details)
lidl edited edge metadata.

I found my email exchange with Devin from earlier this year, and reworked the patch to follow his suggestions. The net effect is the same, a vendor supplied defaults files is sourced at the same point in the execution, just now named "/etc/defaults/vendor.conf" to match the other files named /etc/defaults/*.conf

By hooking it in the /etc/defaults/rc.conf, it makes it easier to override the "source_rc_confs"
function as well, if that level of customization was wanted/needed too. Unlikely, but now possible.

This revision now requires review to proceed.Jun 20 2016, 10:45 PM
stas accepted this revision.Jun 21 2016, 6:34 PM
stas edited edge metadata.
This revision is now accepted and ready to land.Jun 21 2016, 6:34 PM
imp added inline comments.Jun 21 2016, 6:41 PM
etc/defaults/rc.conf
745 ↗(On Diff #17717)

I'd suggest this comment instead:

\# Allow vendors to override normal FreeBSD defaults in /etc/default/rc.conf
\# without the need to carefully manage /etc/rc.conf.

imp accepted this revision.Jun 21 2016, 6:41 PM
imp added a reviewer: imp.
lidl added inline comments.Jun 21 2016, 6:53 PM
etc/defaults/rc.conf
745 ↗(On Diff #17717)

OK, I will change the comment to that text when/if this gets committed.

This revision was automatically updated to reflect the committed changes.