Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Dec 2013 10:45:09 -0800
From:      Colin Percival <cperciva@freebsd.org>
To:        Hiroki Sato <hrs@FreeBSD.org>
Cc:        freebsd-rc@FreeBSD.org
Subject:   Re: RFC: support for re-sourcing /etc/rc.conf
Message-ID:  <529CD535.5010903@freebsd.org>
In-Reply-To: <20131202.214853.1540734630471865242.hrs@allbsd.org>
References:  <529BEDDB.8010003@freebsd.org> <20131202.214853.1540734630471865242.hrs@allbsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 12/02/13 04:48, Hiroki Sato wrote:
> Colin Percival <cperciva@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.

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".
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.
5. Later in the boot process, firstboot-pkgs (having the new /etc/rc.conf
   settings loaded) installs the apache22 package.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?529CD535.5010903>