Re: Moving /etc/rc.conf.local to /usr/local/etc/rc.conf

From: Juan Manuel Palacios <jmpalacios_at_gmail.com>
Date: Sat, 27 Jan 2024 23:26:31 UTC

> On Jan 27, 2024, at 6:01 PM, Lowell Gilbert <freebsd-questions-local@be-well.ilk.org> wrote:
> 
> Juan Manuel Palacios <jmpalacios@gmail.com> writes:
> 
> For most people, it doesn't defeat that purpose. Keeping /etc the same
> on all your machines is something plenty of people want to do, but
> not putting anything into /etc/rc.conf is not by any means the only (or
> even the obvious) way to do that.

My use case here is automating the creation of a number of purpose-specific jails, and keeping all configurations to /usr/local/etc, which I mount into them, so as to simplify the provisioning, setup, and future migration processes as much as possible. If I have to modify /etc/rc.conf to get a fully functional jail, though, then the setup becomes a bit more complex, though admittedly in a far from insurmountable way.

With that in context, my original question about out-of-the-box support for /usr/local/etc/rc.conf came mostly out of confusion, as I can see the pattern of supporting /etc/foo & /usr/local/etc/foo in multiple places, e.g. pkg (as already referenced), but for rc(8) it’s /etc/foo & /etc/foo.local, and I couldn’t understand why, leading me to believe there was something I was either misunderstanding, or not finding in the documentation. Hence my initiative to submit a merge request to support /usr/local/etc/rc.conf out-of-the-box, even if only for consistency’s sake.

> 
> It's quite common to have a shared /etc, but very uncommon to need that
> to be limited to what an unscripted install would put in out of the
> box. If you want this because you're applying a common template to
> install a lot of machines, there is a common approach of scripting the
> install to add the extra variable (or more) to /etc/rc.conf; they will
> be customized, but they will all be customized in the same automated
> way. You just change them all to have /usr/local/etc/rc.conf (your
> choice of filename) included in ${rc_conf_files}.

In my current scripting I point sysrc(8) to /usr/local/etc/rc.conf.d/$name for each service(8) customization I need. Customizing rc_conf_files in /etc/rc.conf and then using a single /usr/local/etc/rc.conf for all of my service(8) needs would also be a functional alternative, for sure.

> 
> That said, I don't see any reason that /etc/defaults/rc.conf couldn't
> be modified in the official build to include a file in /usr/local into
> ${rc_conf_files} if said file exists. Make sure the filename isn't
> likely to conflict with anything other people have already used, but
> aside from that I don't see any downsides.

I’d think /usr/local/etc/rc.conf would by very far be the preferred choice for out-of-the-box support. When I first get a chance I’ll start a bit of a more formal inquiry into that.

> 
> Be well.

Regards,