From owner-freebsd-rc@FreeBSD.ORG Mon Dec 2 19:07:07 2013 Return-Path: Delivered-To: freebsd-rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D2C47A4C; Mon, 2 Dec 2013 19:07:07 +0000 (UTC) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5031E1CFD; Mon, 2 Dec 2013 19:07:07 +0000 (UTC) Received: from alph.d.allbsd.org (p4181-ipbf1307funabasi.chiba.ocn.ne.jp [123.225.173.181]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id rB2J6mC0017234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Dec 2013 04:06:59 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.7/8.14.5) with ESMTP id rB2J6mHR074161; Tue, 3 Dec 2013 04:06:48 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Tue, 03 Dec 2013 04:05:24 +0900 (JST) Message-Id: <20131203.040524.1967340345792909822.hrs@allbsd.org> To: cperciva@FreeBSD.org Subject: Re: RFC: support for re-sourcing /etc/rc.conf From: Hiroki Sato In-Reply-To: <529CD535.5010903@freebsd.org> References: <529BEDDB.8010003@freebsd.org> <20131202.214853.1540734630471865242.hrs@allbsd.org> <529CD535.5010903@freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Tue_Dec__3_04_05_24_2013_873)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Tue, 03 Dec 2013 04:06:59 +0900 (JST) X-Spam-Status: No, score=-99.1 required=13.0 tests=CONTENT_TYPE_PRESENT, SPF_SOFTFAIL,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: freebsd-rc@FreeBSD.org X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 19:07:08 -0000 ----Security_Multipart(Tue_Dec__3_04_05_24_2013_873)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Colin Percival wrote in <529CD535.5010903@freebsd.org>: cp> On 12/02/13 04:48, Hiroki Sato wrote: cp> > Colin Percival 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/ happens every time when "load_rc_config " 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)----