Date: Tue, 03 Dec 2013 04:05:24 +0900 (JST) From: Hiroki Sato <hrs@FreeBSD.org> To: cperciva@FreeBSD.org Cc: freebsd-rc@FreeBSD.org Subject: Re: RFC: support for re-sourcing /etc/rc.conf Message-ID: <20131203.040524.1967340345792909822.hrs@allbsd.org> In-Reply-To: <529CD535.5010903@freebsd.org> References: <529BEDDB.8010003@freebsd.org> <20131202.214853.1540734630471865242.hrs@allbsd.org> <529CD535.5010903@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
----Security_Multipart(Tue_Dec__3_04_05_24_2013_873)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Colin Percival <cperciva@freebsd.org> wrote in <529CD535.5010903@freebsd.org>: cp> On 12/02/13 04:48, Hiroki Sato wrote: cp> > Colin Percival <cperciva@freebsd.org> wrote: cp> > cp> I'd like to commit the attached patch to /etc/rc. When SIGALRM is received, cp> > cp> it reloads /etc/rc.conf; this makes it possible for an rc.d script to perform cp> > cp> first-boot system configuration and have it reflected by other rc.d scripts. cp> > cp> cp> > cp> In particular, this will allow me to provide EC2 user-data of cp> > cp> >>/etc/rc.conf cp> > cp> firstboot_pkgs_enable="YES" cp> > cp> firstboot_pkgs_list="apache22" cp> > cp> to an image with the sysutils/ec2-scripts and sysutils/firstboot-pkgs ports cp> > cp> installed, and have a system running with apache22 installed moments later. cp> > cp> > I am not familiar with sysutils/firstboot-pkgs and its use case, but cp> > is it correct that packages are installed during /etc/rc and then cp> > rc.conf will be updated before rc.d scripts for the installed cp> > packages run from /etc/rc? Where and when SIGALRM is sent from? cp> cp> No, the other way around -- a different script (part of ec2-scripts) updates cp> /etc/rc.conf based on metadata provided at VM launch time. One use of this cp> would be to set firstboot_pkgs_* variables to control the behaviour of the cp> firstboot-pkgs port moments later in the boot process. cp> cp> So: cp> 1. VM image is created with ec2-scripts and firstboot-pkgs installed. cp> 2. VM image is launched with user-data saying "I want apache22". cp> 3. Early in the boot process, ec2-scripts reads that user-data, updates cp> /etc/rc.conf, and signals /etc/rc. cp> 4. /etc/rc re-sources /etc/rc.conf. cp> 5. Later in the boot process, firstboot-pkgs (having the new /etc/rc.conf cp> settings loaded) installs the apache22 package. So, if I understand it correctly, the ec2-scripts add $firstboot_pkgs_enable and $firstboot_pkgs_list into /etc/rc.conf and then send a signal to /etc/rc, and then the firstboot-pkg script runs. In this case, I think creating /etc/rc.conf.d/firstboot-pkg in ec2-scripts is simpler. Sourcing /etc/rc.conf happens only once, but sourcing /etc/rc.conf.d/<name> happens every time when "load_rc_config <name>" is called. If firstboot-pkgs calls load_rc_config, it should work as expected without sending a signal. -- Hiroki ----Security_Multipart(Tue_Dec__3_04_05_24_2013_873)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iEYEABECAAYFAlKc2fQACgkQTyzT2CeTzy0V5ACcDIl1Bw8FqKa/37JYzttCam1m B84AoMPijmDLaeRyzQ98j7GyJutcBvVx =+UUj -----END PGP SIGNATURE----- ----Security_Multipart(Tue_Dec__3_04_05_24_2013_873)----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131203.040524.1967340345792909822.hrs>