From 6ae9968c9a6c08526f610f1da78f1d341e9ecf61 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sun, 4 Feb 2007 06:35:10 +0000 Subject: [PATCH] Document the init_chroot and init_script variables. # I didn't check the markup too closely, so doc people, please check Submitted by: Oliver Fromme --- sys/boot/common/loader.8 | 51 ++++++++++++++++++++++++++++++++++++++ sys/boot/forth/loader.conf | 3 +++ 2 files changed, 54 insertions(+) diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8 index ef7416f4bae..ee9658f8ff3 100644 --- a/sys/boot/common/loader.8 +++ b/sys/boot/common/loader.8 @@ -423,12 +423,63 @@ userland output (e.g.\& from .It Va currdev Selects the default device. Syntax for devices is odd. +.It Va init_chroot +If set to a valid directory in the root file system, it causes +.Xr init 8 +to perform a +.Xr chroot 2 +operation on that directory, making it the new root directory. +That happens before entering single-user mode or multi-user +mode (but after executing the +.Va init_script +if enabled). .It Va init_path Sets the list of binaries which the kernel will try to run as the initial process. The first matching binary is used. The default list is .Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak:\:/rescue/init:/stand/sysinstall . +.It Va init_script +If set to a valid file name in the root file system, +instructs +.Xr init 8 +to run that script as the very first action, +before doing anything else. +Signal handling and exit code interpretation is similar to +running the +.Pa /etc/rc +script. +In particular, single-user operation is enforced +if the script terminates with a non-zero exit code, +or if a SIGTERM is delivered to the +.Xr init 8 +process (PID 1). +.It Va init_script +Defines the shell binary to be used for executing the various shell scripts. +The default is +.Dq Li /bin/sh . +It is used for running the +.Va init_script +if set, as well as for the +.Pa /etc/rc +and +.Pa /etc/rc.shutdown +scripts. +The value of the corresponding +.Xr kenv 2 +variable is evaluated every time +.Xr init 8 +calls a shell script, so it can be changed later on using the +.Xr kenv 1 +utility. +In particular, if a non-default shell is used for running an +.Va init_script , +it might be desirable to have that script reset the value of +.Va init_shell +back to the default, so that the +.Pa /etc/rc +script is executed with the standard shell +.Pa /bin/sh . .It Va interpret Has the value .Dq Li OK diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index 7e27953059f..d32dd3bdb46 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -77,6 +77,9 @@ module_path="/boot/modules" # Set the module search path #boot_verbose="" # -v: Causes extra debugging information to be printed #init_path="/sbin/init:/sbin/oinit:/sbin/init.bak:/rescue/init:/stand/sysinstall" # Sets the list of init candidates +#init_shell="/bin/sh" # The shell binary used by init(8). +#init_script="" # Initial script to run by init(8) before chrooting. +#init_chroot="" # Directory for init(8) to chroot into. ##############################################################