RFC: support for re-sourcing /etc/rc.conf

Teske, Devin Devin.Teske at fisglobal.com
Mon Dec 2 19:17:55 UTC 2013


On Dec 2, 2013, at 10:45 AM, Colin Percival wrote:

> On 12/02/13 04:48, Hiroki Sato wrote:
>> Colin Percival <cperciva at freebsd.org> wrote:
>> cp> I'd like to commit the attached patch to /etc/rc.  When SIGALRM is received,
>> cp> it reloads /etc/rc.conf; this makes it possible for an rc.d script to perform
>> cp> first-boot system configuration and have it reflected by other rc.d scripts.
>> cp>
>> cp> In particular, this will allow me to provide EC2 user-data of
>> cp> 	>>/etc/rc.conf
>> cp> 	firstboot_pkgs_enable="YES"
>> cp> 	firstboot_pkgs_list="apache22"
>> cp> to an image with the sysutils/ec2-scripts and sysutils/firstboot-pkgs ports
>> cp> installed, and have a system running with apache22 installed moments later.
>> 
>> I am not familiar with sysutils/firstboot-pkgs and its use case, but
>> is it correct that packages are installed during /etc/rc and then
>> rc.conf will be updated before rc.d scripts for the installed
>> packages run from /etc/rc?  Where and when SIGALRM is sent from?
> 
> No, the other way around -- a different script (part of ec2-scripts) updates
> /etc/rc.conf based on metadata provided at VM launch time.  One use of this
> would be to set firstboot_pkgs_* variables to control the behaviour of the
> firstboot-pkgs port moments later in the boot process.
> 

sysrc(8) in 9.2+ base comes to mind.
NB: Available as a port for older releases 4.8+ (sysutils/sysrc)


> So:
> 1. VM image is created with ec2-scripts and firstboot-pkgs installed.
> 2. VM image is launched with user-data saying "I want apache22".

"bsdconfig startup_rcvar" in 9.2+ base comes to mind.
NB: Avaiable as a port for older releases 9.0+ (sysutils/bsdconfig)


> 3. Early in the boot process, ec2-scripts reads that user-data, updates
>   /etc/rc.conf, and signals /etc/rc.
> 4. /etc/rc re-sources /etc/rc.conf.

Cool. How's the signaling in #3 done to get #4?

Edit: Hiroki suggests using using /etc/rc.conf.d/{name}
Edit: "sysrc -f /etc/rc.conf.d/{name} firstboot_pkgs_{blah}=etc" comes to mind

> 5. Later in the boot process, firstboot-pkgs (having the new /etc/rc.conf
>   settings loaded) installs the apache22 package.
> 

/usr/share/bsdconfig/packages/packages.subr in 9.2+ base comes to mind.
Library for installing packages from a script (from any media device).

In 11.0-CURRENT, you have realtime API documentation:

	bsdconfig includes packages/packages

or more specifically...

	bsdconfig includes -dF package_add

Will display full description of the API function, f_package_add().

In 9.2-R or 9-STABLE (after SVN r252995), it uses pkg-tools.
In 10.0-BETA4 or 10-STABLE (after SVN r258420) or higher, it uses pkgng.

FYI:

I like the idea of firstboot_pkgs_*
I also like Hiroki's idea of stashing it all into rc.conf.d
-- 
Devin

_____________
The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you.


More information about the freebsd-rc mailing list