setting boot flag

What kind of flag? most "boot" flags are set from the loader, like when you stop the countdown and say boot into single user mode?

Kind of hard to say "best way" without knowing what flag and what the intent of the flag is.
 
I've remembered something about the existence of a firstboot_sentinel which I never fully understood but it is referenced inrc.conf().

In the expanation it mentions early_late_divider which I'm trying to figure out. I want to be able to run something after rc.conf is processed.
 
firstboot is basically "I've just done a fresh install and rebooted the system, so it's the first time the system has been booted" It can be used to do things that are unique to the system, say generate certs, contact a server to log the new system (useful in corporate environments). After the first boot stuff runs, the flag (file) is deleted so it will never run again.

I'm not sure where/what early_late_divider is but it sounds to me like early is "things that must be run before almost everything else like mounting boot filesystems, hardware initialization" and late is "things that can wait".

I could be wrong on the following, others will correct me as needed.

I don't think "rc.conf" is actually "processed"; I believe that each service file will look up values in rc.conf. Example: look at /etc/rc.d/moused It has a variable "name" value "moused" Then it calls load_rc_config $name (defined in /etc/rc.subr) which may pull in rc.conf and then look up variables related to the name moused.
Each service file does similar processing so "...after rc.conf is processed" really doesn't mean any outside the context of a specific service file.
 
I've remembered something about the existence of a firstboot_sentinel which I never fully understood but it is referenced inrc.conf().

In the expanation it mentions early_late_divider which I'm trying to figure out. I want to be able to run something after rc.conf is processed.
rc.conf runs as part of every normal rc script.

The early-late divider prevents a script outside /etc/rc.d/ from running in very early - by default before FILESYSTEMS.
 
I've remembered something about the existence of a firstboot_sentinel which I never fully understood but it is referenced inrc.conf().
It's just a file; /firstboot. Useful if you create images (for VMs for example), the existence of this file can trigger scripts that should be run the first time you boot that image. For example; sysutils/firstboot-freebsd-update to automatically run freebsd-update(8), or expanding the root filesystem with /etc/rc.d/growfs.
 
Here is a good example, from Colin Percival's Daemonology.net blog, of using firstboot, along with his cloudinit program, to automatically configure Amazon EC2 instances.
 
I've remembered something about the existence of a firstboot_sentinel which I never fully understood but it is referenced inrc.conf().

In the expanation it mentions early_late_divider which I'm trying to figure out. I want to be able to run something after rc.conf is processed.
What I do is auto-login to a shell on the alt-F1 console and have the shell execute things if we are ttyv0 and we just booted according to the uptime command. I think there really should be an autoexec.bat style startup script that just runs things after booting for a dedicated machine. This is way too complicated.
 
Back
Top