.TH PLAN9RC 8
.SH NAME
plan9rc, ramskel, initskel \- rootless boot scripts
.SH SYNOPSIS
.B plan9rc [file]
.br
.B ramskel
.br
.B initskel
.SH DESCRIPTION
After the kernel boots, it execs
.B /boot
(see
.IR boot (8)),
which in turn execs
.BR plan9rc .
.IR plan9rc (8)
reads 
.I file 
if given (usually it is not) to set up environment variables. It checks the
.B $service
environment variable
.B cpu
or
.BR terminal ,
to set defaults, then proceeds as an
.IR rc (1)
script to bring the system up. It first uses
.IR paqfs (4)
to mount 
.I /boot/bootpaq 
behind both 
.I /bin 
and 
.I /boot 
to access additional programs.
.PP
.IR plan9rc 
makes use of two additional scripts by default, 
.IR ramskel 
and 
.IR initskel.
.IR ramskel 
starts a 
.IR ramfs (4)
and loads in the 
.I skel.tar 
stored in the bootpaq, and optionally loads an additional user-specified .tgz from 
.i /n/9fat to the 
.IR ramfs (4)
also.
A default 
.I tools.tgz 
is provided by the author and recommended as a good default set of additional programs to have available.
.PP
.IR Initskel
is comparable to a 
.IR cpurc (8) 
script which sets up services for the ramrooted environment. It also has interactive and non-interactive modes which follow the same environment variable. It's default actions are to bind standard devices, begin internet service if it was not already, and start 
.IR hubfs (4) 
and 
.IR rxexec (8)
and 
.IR cpu (1) 
and 
.IR exportfs (4)
listeners with
.IR listen1 (8). 
The cpu and exportfs listener are started on non-standard ports to avoid conflicting with the main system's 
.IR cpurc (8). 
The 
.IR initskel 
also has non-default options for starting its own 
.IR ndb (8)
cs/dns and
.IR keyfs (4)
and 
.IR authsrv (6)
if desired.
.SH Startup Procedures
The script operates according to the variables found in the environment,
usually those provided by
.IR plan9.ini (8)
It executes fuctions in the order of 
.TP 8
.BR dofactotum
starts
.IR factotum (4)
in either cpu or terminal mode according to the user's choice.
.TP
.B dotryusb
finds out if the system is booting to a usb volume and starts
.IR partfs (8)
if so
.TP
.B doramsetup
is done from 
.I /boot/skel.tar 
and may also make use of 
.I /n/9fat/tools.tgz
.TP 
.B dochecksys
is made to verify that a user/hostowner and system name are in place
.TP
.B dostartventi
will begin a 
.IR venti (8)
server if specified by the 
.B $venti 
environment variable.
.TP
.B dogetrootfs
will either begin a disk fileserver or dial a tcp root fileserver
.TP
.B doinistscript
runs the 
.IR initskel 
script to create a self-sufficient environment to
.IR cpu (1)
into for service and administrative access to the layer below the root filesystem.
.TP
.B dorootstart
will begin either the
.IR cpurc (8)
or
.IR termrc (8)
from the rootfs. These scripts are launched using
.IR newns (8)
to create a normal user environment independent of the namespace of
.IR plan9rc.
.TP
.B staylocal
allows the user to retain access if desired to the programs in the bootpaq and/or 
.I tools.tgz, 
or choose no to drop down to kernel-device only namespace.
.SH VARIABLES
The 
.IR plan9rc
script makes use of standard variables from
.IR plan9.ini (8)
and also new variables. Both types of variables, and their default behaviors, are listed.
.TP 8
.BR interactive
determines the mode of operation for 
.IR plan9rc. 
By default, or if set to "traditional", it will behave towards the user almost identically to the original plan9 bootup, but will still set up the rootless environment. If set to "yes" then the user will be prompted interactively through the boot process and given the option to alter any and all 
.IR plan9.ini (8)
variable settings. If set to "no" the user will not be prompted at all and the boot process proceeds in automated fashion according to the environment variables.
.TP
.B bootargs
determines the method for connecting to a root fs. tcp [internet config parameters] or local![path to disk root fs] are the standard values here. The new option srv implies the user will arrange to have a file in 
.I /srv
suitable for use as a root file system.
.TP
.B ipparams
optional parameter arguments to 
.IR ipconfig (8). 
This is another way of setting these values directly rather than the somewhat convoluted methods (which are still supported) described in 
.IR boot (8)
.TP
.B factotum
type of 
.IR factotum (4)
[cpu terminal debug]
.TP
.B sysname
standard 
.B $sysname 
definition
.TP
.B fs
standard 
.B $fs 
address from 
.IR plan9.ini (8)
needed for tcp booting
.TP
.B auth
standard 
.B $auth 
address for tcp booting
.TP
.B venti
standard 
.B $venti 
address variable from 
.IR plan9.ini (8)
.TP
.B fossil
location of 
.IR fossil (4)
partition on disk
.TP
.B cfs
location of 
.IR cfs (4)
partition on disk
.TP
.B ramsetup
program to set up 
.IR ramfs (4)
for bootscripts, defaults to [ramskel]
.TP
.B initscript
miniature 
.IR cpurc (8)
equivalent script for the ramroot namespaces, defaults to [initskel]
.TP
.B startventi
set to "yes" to start the 
.IR venti (8)
server. This will be automatically set to yes if a 
.B $venti 
variable is found beginning with #S which implies 
.IR venti (8)
should be started from the local disk.
.TP
.B bootsrv
this is usually a derivative variable determined by the attachment to a root fileserver. If the user chooses "srv" as their boot method 
.IR plan9rc 
will use an existing file in 
.I /srv 
for the root. This mode is used mostly if 
.IR plan9rc 
is launching a new namespace subsequent to the initial boot up.
.TP
.B namespace
namespace for starting initscript, defaults to [namespace]
.TP
.B rootstart
whether or not to start 
.IR cpurc (8)
or
.IR termrc (8)
scripts from mounted root [cpu terminal]
.TP
.B staylocal
whether to stay within the namespace of the 
.IR plan9rc 
script on the console, set "no" to drop back to only kernel devices [yes]
.TP
.B afterfact
command to execute after starting 
.IR factotum (8)
(happens before everything else), not used by default
.TP
.B afterroot
command to execute after mounting rootfs but before initscript or 
.IR cpurc (8)
or 
.IR termrc (8)
not used by default
.SS Initskel and ramskel variables
Variables for the other two scripts used by rootless bootup are also described here. Their meaning and default values are as follows.
.TP
.BR tgzfs
name of optional .tgz to load into the ramdisk. I provide a recommended 
.I tools.tgz 
but this value is not set by default. This value is used by 
.IR ramskel 
while the rest are all for 
.IR initskel.
.TP
.B binddevs
by default 
.IR initskel 
will
.IR bind (1)
the devices ( f t m v L P u U '$' Σ κ ). Set this to no to disable this.
.TP
.B hostfactotum
by default the ramroot namespace makes use of the system wide 
.IR factotum(8). 
Set this to no to enable running a private 
.IR factotum (8)
for this namespace. You will be prompted for the values to set for the key and authserver address.
.TP
.B netsvc
by default 
.IR initskel 
will issue an 
.IR ipconfig (8)
command if internet service has not already been started. Set no to disable this.
.TP
.B hostcsdns
by default the 
.IR factotum (4)
in the ramroot environment will use the host system 
.IR ndb (8)
cs and dns for connection information. Set no to disable this and start a cs and dns server within the service namespace.
.TP
.B cpusvc
by default 
.IR initskel 
will start a 
.IR cpu (1)
listener and an 
.IR rexexec (8)
listener. Set no to disable this.
.TP
.B cpuport
this sets the numeric port used for the 
.IR cpu (1)
listener. It is set to [17020] by default to avoid conflict with the host system 
.IR cpu (1)
listener.
.TP
.B hubsvc
by default a 
.IR hubfs (4) 
server is started and an rc connected to it. Set no to disable this.
.TP
.B unprivileged
by default the ramroot environment does not provide auth services. Set no to start a 
.IR keyfs (4)
and 
.IR authsrv (6)
using 
.I /n/9fat/adm.
.SH FILES
.TF /boot/plan9rc
.TP
.B /boot/plan9rc
bootup and namespace launching control script
.TP
.B /boot/ramskel
sets up 
.B /boot/skel.tar 
as a ramfs skeleton along with an optional 
.I tools.tgz 
from 
.I /n/9fat
.TP
.I /boot/initskel
.IR cpurc (8)
analog script for access to the rootless environment
.SH SOURCE
.B sources/contrib/mycroftiv/rootlessnext/bootdir.extras
.SH "SEE ALSO"
.IR srv (4),
.IR namespace (6),
.IR boot (8),
.IR listen (8)
.SH BUGS
The Plan 9 kernel handles variables in
.I #ec
and
.I #e
differently. This may cause unexpected results if variables set in plan9.ini are manipulated and control passes to subscripts.
