From owner-freebsd-rc@FreeBSD.ORG Mon Dec 2 18:47:50 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 AAA85158 for ; Mon, 2 Dec 2013 18:47:50 +0000 (UTC) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id 3AFC31BC1 for ; Mon, 2 Dec 2013 18:47:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sendgrid.info; h=from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpapi; bh=ioF5pPeiszB57n2Tx1+nhFt2Ufs=; b=ayJNB8C43YcJv6GySQ a65KMey+iPCx2TRxoJKkQScwShTOqPavlQ45gJCFnw+VMDqCotXw4By9ZSWJPhHr VVTHaxaYfB9ahi0j3E7VjCFCaDxzJKuOk4zjHMBzgXHOYl8P+SnlWG9XgKpZ1AmA 9D2M9586TSK33VH/Pn+wnlBVc= Received: by mf82.sendgrid.net with SMTP id mf82.14260.529CD5D48 Mon, 02 Dec 2013 18:47:48 +0000 (GMT) Received: from mail.tarsnap.com (unknown [10.60.208.15]) by mi65 (SG) with ESMTP id 142b4a346cd.3eb8.645f43 for ; Mon, 02 Dec 2013 12:47:48 -0600 (CST) Received: (qmail 31134 invoked from network); 2 Dec 2013 18:47:47 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 2 Dec 2013 18:47:47 -0000 Received: (qmail 24413 invoked from network); 2 Dec 2013 18:45:09 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 2 Dec 2013 18:45:09 -0000 Message-ID: <529CD535.5010903@freebsd.org> Date: Mon, 02 Dec 2013 10:45:09 -0800 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Hiroki Sato Subject: Re: RFC: support for re-sourcing /etc/rc.conf References: <529BEDDB.8010003@freebsd.org> <20131202.214853.1540734630471865242.hrs@allbsd.org> In-Reply-To: <20131202.214853.1540734630471865242.hrs@allbsd.org> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SG-EID: ChUA/E68MWtQtYrYVmEHIGuqNmShXrFL3cq8iGM7RqWjJw39r1RXuPMD9Tlta9xSfN4vuTWkGgMYWhvLniBrk+GmGiAHknn2BBv1OOuPno0Ea2OKtJ7HyVUx82v70GvuzcJEQKHweKHYoLiXlwwsPV29Ii4kwpfHzu/ed+RTftY= 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 18:47:50 -0000 On 12/02/13 04:48, Hiroki Sato wrote: > Colin Percival 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