Re: RFC: support for "first boot" rc.d scripts

2013-10-16 Thread Colin Percival
On 10/14/13 10:00, Ian Lepore wrote: > The embedded systems we create at $work have readonly root and mfs /var, > but we do have writable storage on another filesystem. It would work > for us (not that we need this feature right now) if there were an rcvar > that pointed to the marker file. Of co

Re: RFC: support for "first boot" rc.d scripts

2013-10-15 Thread Colin Percival
On 10/15/13 13:09, Matthew Fleming wrote: > We use something like this at work. However, our version creates a file after > the firstboot scripts have run, and doesn't run if the file exists. > > Is there a reason to prefer one choice over the other? Naively I'd expect it > to > be better to ru

Re: RFC: support for "first boot" rc.d scripts

2013-10-15 Thread Colin Percival
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 f

Re: RFC: support for "first boot" rc.d scripts

2013-10-15 Thread Matthew Fleming
On Sun, Oct 13, 2013 at 3:58 PM, Colin Percival wrote: > Hi all, > > I've attached a very simple patch which makes /etc/rc: > > 1. Skip any rc.d scripts with the "firstboot" keyword if /var/db/firstboot > does not exist, > > 2. If /var/db/firstboot and /var/db/firstboot-reboot exist after running

Re: RFC: support for "first boot" rc.d scripts

2013-10-15 Thread Allan Jude
On 2013-10-15 15:33, Tim Kientzle wrote: > Wonderful! This capability is long overdue. > > On Oct 13, 2013, at 3:58 PM, Colin Percival wrote: >> As examples of what such scripts could do: > More examples: > > I've been experimenting with putting "gpart resize" and "growfs" > into rc.d scripts to

Re: RFC: support for "first boot" rc.d scripts

2013-10-15 Thread Tim Kientzle
Wonderful! This capability is long overdue. On Oct 13, 2013, at 3:58 PM, Colin Percival wrote: > As examples of what such scripts could do: More examples: I've been experimenting with putting "gpart resize" and "growfs" into rc.d scripts to construct images that can be dd'ed onto some medium a

Re: RFC: support for "first boot" rc.d scripts

2013-10-15 Thread Nick Hibma
>>> Yes, it's hard to store state on diskless systems... but I figured >>> that anyone building a diskless system would know to not create a >>> "run firstboot scripts" marker. And not all embedded systems are >>> diskless... >> >> The embedded systems we create at $work have readonly root and mf

Re: RFC: support for "first boot" rc.d scripts

2013-10-14 Thread Colin Percival
On 10/14/13 10:00, Ian Lepore wrote: > On Mon, 2013-10-14 at 09:51 -0700, Colin Percival wrote: >> Yes, it's hard to store state on diskless systems... but I figured >> that anyone building a diskless system would know to not create a >> "run firstboot scripts" marker. And not all embedded systems

Re: RFC: support for "first boot" rc.d scripts

2013-10-14 Thread Ian Lepore
On Mon, 2013-10-14 at 09:51 -0700, Colin Percival wrote: > Hi Nick, > > On 10/14/13 00:59, Nick Hibma wrote: > > Sounds useful: We have nanobsd images that configure a hard disk if > > present, but obviously only need to be run once. > > > > However: NanoBSD stores uses a memory disk for /etc an

Re: RFC: support for "first boot" rc.d scripts

2013-10-14 Thread Colin Percival
On 10/14/13 05:07, Hiroki Sato wrote: > Colin Percival wrote > in <525b258f.3030...@freebsd.org>: > > cp> I've attached a very simple patch which makes /etc/rc: > > cp> +if ! [ -e /var/db/firstboot ]; then > cp> + skip="$skip -s firstboot" > cp> +fi > > At this stage, it is possible that /va

Re: RFC: support for "first boot" rc.d scripts

2013-10-14 Thread Colin Percival
Hi Nick, On 10/14/13 00:59, Nick Hibma wrote: > Sounds useful: We have nanobsd images that configure a hard disk if present, > but obviously only need to be run once. > > However: NanoBSD stores uses a memory disk for /etc and stores it's permanent > scripts in /conf/* (/etc/rc.initdiskless) an

Re: RFC: support for "first boot" rc.d scripts

2013-10-14 Thread Hiroki Sato
Colin Percival wrote in <525b258f.3030...@freebsd.org>: cp> I've attached a very simple patch which makes /etc/rc: cp> +if ! [ -e /var/db/firstboot ]; then cp> + skip="$skip -s firstboot" cp> +fi At this stage, it is possible that /var/db does not exist because it is before rc.d/mountcrit

Re: RFC: support for "first boot" rc.d scripts

2013-10-14 Thread Nick Hibma
Colin, Sounds useful: We have nanobsd images that configure a hard disk if present, but obviously only need to be run once. However: NanoBSD stores uses a memory disk for /etc and stores it's permanent scripts in /conf/* (/etc/rc.initdiskless) and/or /cfg (NanoBSD) so I doubt whether the 'embe

Re: RFC: support for "first boot" rc.d scripts

2013-10-13 Thread Allan Jude
On 2013-10-13 18:58, Colin Percival wrote: > Hi all, > > I've attached a very simple patch which makes /etc/rc: > > 1. Skip any rc.d scripts with the "firstboot" keyword if /var/db/firstboot > does not exist, > > 2. If /var/db/firstboot and /var/db/firstboot-reboot exist after running rc.d > script

RFC: support for "first boot" rc.d scripts

2013-10-13 Thread Colin Percival
Hi all, I've attached a very simple patch which makes /etc/rc: 1. Skip any rc.d scripts with the "firstboot" keyword if /var/db/firstboot does not exist, 2. If /var/db/firstboot and /var/db/firstboot-reboot exist after running rc.d scripts, reboot. 3. Delete /var/db/firstboot (and firstboot-reb