From owner-freebsd-current@FreeBSD.ORG Tue Oct 15 20:57:08 2013 Return-Path: Delivered-To: freebsd-current@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 ESMTP id 7E3AB1D7 for ; Tue, 15 Oct 2013 20:57:08 +0000 (UTC) (envelope-from bounces+73574-dfb6-freebsd-current=freebsd.org@sendgrid.me) Received: from o3.shared.sendgrid.net (o3.shared.sendgrid.net [208.117.48.85]) by mx1.freebsd.org (Postfix) with SMTP id 0DCAE27DB for ; Tue, 15 Oct 2013 20:57:07 +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=rbXRo06VLoOEhi0ed6bLCnY2dRc=; b=dcrfmhBIROZMHY0Blg yUOtsL8hsrMZHMGpNv7xPurCGbMtQMAbVZ3WJRTU3E480RKyjM6GY8WvvCPKE/0P +JZAoQ7Il+AQ9M6GE8FgCa/JF8NAKyG3aTlRjR1l+3lamxD4B5cMz9ESr6cy59q8 ST/P3HenBRL+J+IHxokF2wPPs= Received: by filter-170.sjc1.sendgrid.net with SMTP id filter-170.30926.525DAC1F7 Tue, 15 Oct 2013 20:57:03 +0000 (GMT) Received: from mail.tarsnap.com (unknown [10.60.208.15]) by mi19 (SG) with ESMTP id 141bde85bc7.19b4.186a20b for ; Tue, 15 Oct 2013 20:57:03 +0000 (UTC) Received: (qmail 43530 invoked from network); 15 Oct 2013 20:57:02 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by ec2-107-20-205-189.compute-1.amazonaws.com with ESMTP; 15 Oct 2013 20:57:02 -0000 Received: (qmail 4898 invoked from network); 15 Oct 2013 20:56:10 -0000 Received: from unknown (HELO clamshell.daemonology.net) (127.0.0.1) by clamshell.daemonology.net with SMTP; 15 Oct 2013 20:56:10 -0000 Message-ID: <525DABE9.2060902@freebsd.org> Date: Tue, 15 Oct 2013 13:56:09 -0700 From: Colin Percival User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Nick Hibma Subject: Re: RFC: support for "first boot" rc.d scripts References: <525B258F.3030403@freebsd.org> <41F1219E-4DCC-4B04-A1DC-40038809556B@van-laarhoven.org> <525C210A.2000306@freebsd.org> <1381770007.42859.82.camel@revolution.hippie.lan> <525C41D1.3040204@freebsd.org> <6C7D69EB-204B-45B9-AD67-EBC1AB39AB8B@van-laarhoven.org> In-Reply-To: <6C7D69EB-204B-45B9-AD67-EBC1AB39AB8B@van-laarhoven.org> X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SG-EID: XhyBwObMhraAR+zdwMupjQ6BIqbhdEfc+6p+uBxS7S/F6tz08zFvYUkvTz9x4wtiYzqTqOmZCGDXeDkMGFyDlujzvoEKFBq1usWpqTQMe9k1MViCPefx0jEJwed4RfuM1OGkHDZPYj8c8z5Twm4XjuohkN4uXIyan1JYA/77VzY= Cc: FreeBSD current , freebsd-rc@FreeBSD.org, Ian Lepore X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Oct 2013 20:57:08 -0000 On 10/15/13 01:58, Nick Hibma wrote: >> Indeed... the way my patch currently does things, it looks for the >> firstboot sentinel at the start of /etc/rc, which means it *has* to >> be on /. Making the path an rcvar is a good idea (updated patch >> attached) but we still need some way to re-probe for that file after >> mounting extra filesystems. > > In many cases a simple > > test -f /firstboot && bla_enable='YES' || bla_enable='NO' > rm -f /firstboot > > in your specific rc.d script would suffice. [...] > I am not quite sure why we need /firstboot handling in /etc/rc. Your suggestion wouldn't work if you have several scripts doing it; the first one would remove the sentinel and the others wouldn't run. In my EC2 code I have a single script which runs after all the others and removes the sentinel file, but that still means that every script has to be executed on every boot (even if just to check if it should do anything); putting the logic into /etc/rc would allow rcorder to skip those scripts entirely. > Perhaps it is a better idea to make this more generic, to move the rc.d script containing a 'runonce' keyword to a subdirectory as the last step in rc (or make that an rc.d script in itself!). That way you could consider moving it back if you need to re-run it. Or have an rc.d script setup something like a database after installing a package by creating a rc.d runonce script. > > Default dir could be ./run-once relative to the rc.d dir it is in, configurable through runonce_directory . > > Note: The move would need to be done at the very end of rc.d to prevent rcorder returning a different ordering and skipping scripts because of that. I considered this, but decided that the most common requirement use of "run once" would be for "run when the system is first booted", and it would be much simpler to provide just the firstboot functionality. -- Colin Percival Security Officer Emeritus, FreeBSD | The power to serve Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid