*.a
*.so.*
*.d
+!etc/*.d
.depend
*.gcno
*.gcda
./etc/rc.cd minix-base
./etc/rc.conf minix-base
./etc/rc.d minix-base
+./etc/rc.d/DAEMON minix-base
+./etc/rc.d/DISKS minix-base
+./etc/rc.d/LOGIN minix-base
+./etc/rc.d/NETWORKING minix-base
+./etc/rc.d/SERVERS minix-base
./etc/rc.d/blacklistd minix-base
+./etc/rc.d/bootconf.sh minix-base
+./etc/rc.d/fsck minix-base
+./etc/rc.d/ftpd minix-base
+./etc/rc.d/ipfilter minix-base
+./etc/rc.d/ipsec minix-base
+./etc/rc.d/local minix-base
+./etc/rc.d/minixrc minix-base
+./etc/rc.d/mountcritlocal minix-base
+./etc/rc.d/mountcritremote minix-base
+./etc/rc.d/network minix-base
+./etc/rc.d/npf minix-base
+./etc/rc.d/pwcheck minix-base
+./etc/rc.d/root minix-base
+./etc/rc.d/sysctl minix-base
+./etc/rc.d/sysdb minix-base
+./etc/rc.d/syslogd minix-base
+./etc/rc.d/ttys minix-base
+./etc/rc.d/wscons minix-base
./etc/rc.daemons.dist minix-base
+./etc/rc.minix minix-base
./etc/rc.shutdown minix-base
./etc/rc.subr minix-base
./etc/release minix-base
./usr/man/man5/passwd.5 minix-man
./usr/man/man5/pkg_install.conf.5 minix-man
./usr/man/man5/pkg_summary.5 minix-man
+./usr/man/man5/rc.conf.5 minix-man
./usr/man/man5/resolv.conf.5 minix-man
./usr/man/man5/resolver.5 minix-man
./usr/man/man5/rhosts.5 minix-man
./usr/man/man8/pwdauth.8 minix-man obsolete
./usr/man/man8/rarpd.8 minix-man
./usr/man/man8/rawspeed.8 minix-man
+./usr/man/man8/rc.8 minix-man
+./usr/man/man8/rc.d.8 minix-man
+./usr/man/man8/rc.local.8 minix-man
+./usr/man/man8/rc.shutdown.8 minix-man
+./usr/man/man8/rc.subr.8 minix-man
./usr/man/man8/rcorder.8 minix-man
./usr/man/man8/rdate.8 minix-man
./usr/man/man8/readclock.8 minix-man
+20170223:
+ Edit your /etc/rc.conf to set rc_configured to YES. If you do not,
+ your system will refuse to enter multi-user mode after the next reboot.
+ You can then still make the same edit from single user mode, but that
+ is not as easy.
+
20170222:
Because of naming conflicts, the MINIX 3 service(8) utility has been
renamed to "minix-service". After successfully rebuilding the system
BINGRP= wheel
UTMPGRP= utmp
.if defined(__MINIX)
-BIN1+= boot.cfg.default \
+BIN1+= \
+ \
+ gettytab \
man.conf \
- passwd.conf protocols rc rc.cd rc.subr \
- rc.daemons.dist rs.inet rs.single \
- services shells syslog.conf \
- termcap utmp gettytab rc.shutdown
+ \
+ passwd.conf \
+ protocols rc rc.cd rc.subr \
+ rc.shutdown services shells \
+ syslog.conf
+# MINIX-only files:
+BIN1+= boot.cfg.default rc.daemons.dist rc.minix \
+ rs.inet rs.single termcap utmp
.else
BIN1+= bootptab changelist csh.cshrc csh.login \
csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \
${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/rc.capes/* ${DESTDIR}/etc/rc.capes
${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/minix/drivers/usb/usbd/usbd.conf ${DESTDIR}/etc/system.conf.d/usbd
.endif # Minix/earm specific
-.for subdir in . defaults mtree root skel
+.for subdir in . defaults mtree rc.d root skel
${MAKEDIRTARGET} ${subdir} configinstall
.endfor
${_MKMSG_INSTALL} ${DESTDIR}/usr/lib/fonts
# Minix-specific rc.conf default values
+# Override settings in NetBSD's default rc.conf with different default settings
+# for MINIX here, typically to disable scripts that NetBSD enables by default.
+#(nothing yet)
+
# Where to find servers/drivers binaries
PKG_SERVICE_DIR=/usr/pkg/service
SERVICES_DIRS="/service $PKG_SERVICE_DIR"
+# $NetBSD: rc.conf,v 1.133 2015/03/30 10:58:37 chopps Exp $
+#
+# /etc/defaults/rc.conf --
+# default configuration of /etc/rc.conf
+#
+# see rc.conf(5) for more information.
+#
+# DO NOT EDIT THIS FILE DIRECTLY; IT MAY BE REPLACED DURING A SYSTEM UPGRADE.
+# EDIT /etc/rc.conf INSTEAD.
+#
+
+#
+# Use program=YES to enable program, NO to disable it. program_flags are
+# passed to the program on the command line.
+#
+
+# Uncomment this if you want to use local paths in rc.
+#
+#export PATH=$PATH:/usr/pkg/sbin:/usr/pkg/bin:/usr/local/sbin:/usr/local/bin
+
+# Uncomment the following to execute each /etc/rc.d script in
+# the current shell rather than in a subshell. This may be
+# faster on very slow machines that have an expensive fork(2).
+# NOTE: USE THIS AT YOUR OWN RISK; A ROGUE COMMAND
+# MAY INADVERTENTLY PREVENT BOOT TO MULTIUSER.
+#
+#rc_fast_and_loose=YES
+
+# If rc_silent is true then /etc/rc will suppress most output to
+# the console. The default is taken from the AB_SILENT flag passed
+# from the boot loader to the kernel in the boothowto(9) variable.
+#
+# rc_silent_cmd is executed once for each suppressed line of output.
+# Useful values are ":" and "twiddle".
+#
+rc_silent=$( [ "$(( $(/sbin/sysctl -n kern.boothowto 2>/dev/null || echo 0) \
+ & 0x40000 ))" != 0 ] && echo true || echo false )
+rc_silent_cmd=twiddle
+
+# Additional flags to the rcorder(8) that's run by /etc/rc.
+#
+rc_rcorder_flags=""
+
+# The directories searched for rc scripts.
+# These directories must be part of the root file system.
+rc_directories=/etc/rc.d
+
+# If this is set to NO, shutdown(8) will not run /etc/rc.shutdown.
+#
+do_rcshutdown=YES
+
+# Additional flags to the rcorder(8) that's run by /etc/rc.shutdown.
+#
+rcshutdown_rcorder_flags=""
+
+# If this is non-blank, use as the number of seconds to run a watchdog
+# timer which will terminate /etc/rc.shutdown if the timeout expires.
+#
+rcshutdown_timeout=""
+
+
+# Basic network configuration
+#
+
+# Fully Qualified Internet Domain Name (a.k.a. hostname, e.g. foo.baz.edu).
+# If blank, use /etc/myname.
+#
+hostname=""
+
+# If there's only one way out of your IPv4 network, set this to the hostname
+# or the IPv4 address of the router that will get your packets off the LAN.
+# If blank, use /etc/mygate.
+#
+defaultroute=""
+
+# Same thing for IPv6. If blank, use /etc/mygate6.
+#
+defaultroute6=""
+
+# The NIS domain name (formerly known as Yellow Pages); not in any way
+# related to Internet domain names.
+# If blank, use /etc/defaultdomain.
+#
+domainname=""
+
+# Filesystems to mount early in boot-up.
+# Note that `/var' is needed in $critical_filesystems_local (or
+# implied as part of `/') as certain services that need /var (such as
+# dhclient) may be needed to get the network operational enough to mount
+# the $critical_filesystems_remote. Prepending "OPTIONAL:" means it
+# will not be an error if that file system is not present in fstab(5).
+#
+critical_filesystems_local="OPTIONAL:/var"
+critical_filesystems_remote="OPTIONAL:/usr"
+
+# Swap device controls.
+#
+no_swap=NO # Set to YES if you have purposefully setup no swap
+ # partitions and don't want to be warned about it.
+swapoff=YES # Remove block-type swap partitions upon shutdown
+ # This defaults to yes, so that raids shutdown cleanly
+
+# Concatenated disk driver.
+#
+ccd=YES
+
+# RAIDframe driver (manually configured devices).
+#
+raidframe=YES
+
+# Crypto file system.
+#
+cgd=YES
+
+# Logical Volume Manager
+#
+lvm=NO
+
+# One-time actions and programs on boot-up.
+#
+savecore=YES savecore_flags="-z"
+ savecore_dir="/var/crash"
+resize_root=NO # resize root to fill partition
+per_user_tmp=NO # per-user /tmp directories
+per_user_tmp_dir="/private/tmp" # real storage for /tmp
+clear_tmp=YES # clear /tmp after reboot
+update_motd=YES # updates /etc/motd
+dmesg=YES dmesg_flags="" # write /var/run/dmesg.boot
+accounting=NO # uses /var/account/acct
+newsyslog=NO newsyslog_flags="" # trim log files
+quota=YES # check and enable quotas
+ldconfig=YES # rebuild a.out ldconfig cache
+sysdb=YES # build system databases
+rndctl=NO rndctl_flags="" # configure rndctl(8)
+gpio=NO # configure GPIO devices
+modules=YES # process /etc/modules.conf
+
+# cope with other OSes using the real time clock at localtime on this
+# machine (by adjusting kern.rtc_offset at boot)
+rtclocaltime=NO
+
+# NOTE: default coredump name now set in /etc/sysctl.conf
+
+#
+# File system check flags; default to preen mode, checking file systems
+# that are listed in /etc/fstab in parallel as the fsck pass number
+# permits. Fix minor faults automatically, and exit with non 0 only
+# when major errors occur.
+#
+fsck_flags=-p
+
+# Security setting. If $securelevel is non-empty, the system securelevel
+# is set to this value early in the boot sequence. Otherwise the default
+# action is taken (see init(8)).
+#
+securelevel="" # securelevel to set to
+
+# To set the IP address of an interface either use
+# ifconfig_xxN="IP-NO"
+# where xxN is the interface. If this variable is not set then
+# contents of the file /etc/ifconfig.xxN is used.
+
+# Networking startup.
+#
+mdnsd=NO
+npf=NO
+ipfilter=NO ipfilter_flags="" # uses /etc/ipf.conf
+ipnat=NO # uses /etc/ipnat.conf
+ipfs=NO ipfs_flags="" # save/load ipnat and ipf states
+ipsec=NO # uses /etc/ipsec.conf
+ipmon=NO ipmon_flags="-Dns" # syslog ipfilter messages
+pf=NO pf_rules="/etc/pf.conf" pf_flags=""
+pflogd=NO
+ftp_proxy=NO
+racoon=NO # IKE daemon
+auto_ifconfig=YES # config all avail. interfaces
+net_interfaces="" # used only if above is NO
+flushroutes=YES # flush routes in netstart
+dhcpcd=NO
+ dhcpcd_flags="-qM" # For ifconfig_XXX=dhcp.
+dhclient=NO # behave as a DHCP client
+ dhclient_flags="" # blank: config all interfaces
+ntpdate=NO ntpdate_flags="-b -s" # May need '-u' thru firewall
+ppp=YES ppp_peers="" # /etc/ppp/peers to call
+ip6mode=host # host, autohost or router
+ip6uniquelocal=NO # IPv6 unique-local forwarding
+
+# Special treatment for interfaces that need to be downed on
+# shutdown (because they might cause unnecessary costs or block resources
+# on the peer). All pppoe* interfaces are automatically included in this
+# list, add others here manually.
+#force_down_interfaces=""
+
+ifwatchd=NO # execute up/down scripts for in-kernel PPPoE interfaces
+ ifwatchd_flags="-u /etc/ppp/ip-up -d /etc/ppp/ip-down pppoe0"
+
+# ALTQ configuration/monitoring daemon
+altqd=NO altqd_flags=""
+
+# Daemons required by servers. These are not needed for strictly client use.
+#
+
+# inetd is used to start the IP-based services enabled in /etc/inetd.conf
+#
+inetd=YES inetd_flags="-l" # -l logs libwrap
+
+# identd
+#
+identd=NO identd_flags="-b -l -u nobody"
+
+# rpcbind (formerly known as 'portmap') is used to look up RPC-based services.
+#
+rpcbind=NO rpcbind_flags="-l" # -l logs libwrap
+
+# Commonly used daemons.
+#
+syslogd=YES syslogd_flags="-s" # -s "secure" unix domain only
+cron=YES
+named=NO named_flags="" # see below for named_chrootdir
+timed=NO timed_flags=""
+ntpd=NO ntpd_flags="" # see below for ntpd_chrootdir
+# The default setting for postfix here is YES, but gets re-examined by
+# the rc.d/postfix startup script when it runs. The script sets
+# _rc_d_postfix to "check", and then causes all rc.conf settings to
+# be re-evaluated. If the value of $postfix after this is "check",
+# the script then checks to see if /etc/mailer.conf selects the system
+# postfix. If not, it does print a warning and does not start postfix
+# to avoid conflict with a different MTA.
+postfix=${_rc_d_postfix:-YES}
+lpd=NO lpd_flags="-s" # -s "secure" unix domain only
+sshd=NO sshd_flags=""
+ssh_keygen_flags=""
+ftpd=NO ftpd_flags="-ll"
+httpd=NO httpd_flags=""
+ httpd_wwwdir="/var/www"
+ httpd_wwwuser="_httpd"
+
+# To run the named(8) DNS server as an unprivileged user under a
+# chroot(2) cage, uncomment the following after migrating the contents
+# of /etc/namedb to /var/chroot/named/etc/namedb
+#
+#named_chrootdir="/var/chroot/named"
+
+# To run the ntpd(8) NTP server as an unprivileged user under a
+# chroot(2) cage, uncomment the following, after ensuring that:
+# - The kernel has "pseudo-device clockctl" compiled in
+# - /dev/clockctl is present
+#
+#ntpd_chrootdir="/var/chroot/ntpd"
+
+# Routing daemons.
+#
+routed=NO routed_flags="-q"
+gated=NO
+mrouted=NO mrouted_flags=""
+route6d=NO route6d_flags=""
+ldpd=NO
+
+# Daemons used to boot other hosts over a network.
+#
+rarpd=NO rarpd_flags="-a"
+bootparamd=NO bootparamd_flags=""
+dhcpd=NO dhcpd_flags="-q"
+dhcrelay=NO dhcrelay_flags=""
+rbootd=NO rbootd_flags=""
+mopd=NO mopd_flags="-a"
+ndbootd=NO ndbootd_flags="-s /tftpboot /tftpboot/bootyy"
+rtadvd=NO rtadvd_flags=""
+isibootd=NO isibootd_flags=""
+
+# X11 daemons.
+#
+xfs=NO xfs_flags="" # X11 font server
+xdm=NO xdm_flags="" # X11 display manager; needs
+ # wscons=YES for local displays.
+
+# Update fontconfig cache at boot
+fccache=YES
+
+# YP (NIS) daemons.
+#
+ypbind=NO ypbind_flags=""
+ypserv=NO ypserv_flags="-d"
+yppasswdd=NO yppasswdd_flags=""
+
+# NFS daemons and parameters.
+#
+mountd=NO mountd_flags="" # NFS mount requests daemon
+nfs_client=NO # enable client daemons
+nfs_server=NO # enable server daemons
+ nfsd_flags=""
+lockd=NO lockd_flags=""
+statd=NO statd_flags=""
+amd=NO amd_flags="-l syslog -x error,noinfo,nostats"
+ amd_dir=/amd # mount dir
+
+# Heimdal Kerberos 5 KDC (with Kerberos IV compatibility)
+kdc=NO kdc_flags="--detach"
+
+# iSCSI target
+iscsi_target=NO iscsi_target_flags=""
+# iSCSI kernel initiator
+iscsid=NO
+
+# WPA daemons.
+hostapd=NO hostapd_flags="-B /etc/hostapd.conf"
+wpa_supplicant=NO wpa_supplicant_flags="" # -i<if> -c<file>
+
+# ISDN daemon
+isdnd=NO isdnd_flags=""
+
+# Bluetooth configuration
+bluetooth=NO
+# and the following are used when bluetooth=YES
+btconfig_devices="" # all
+bthcid=YES bthcid_flags=""
+sdpd=YES sdpd_flags=""
+
+# Other daemons.
+#
+rwhod=NO rwhod_flags="-u _rwhod"
+devpubd=NO devpubd_flags="" # autocreate nodes for new devs
+envsys=NO # Set /etc/envsys.conf preferences
+
+# Hardware daemons.
+#
+apmd=NO apmd_flags="" # APM power management daemon.
+powerd=NO powerd_flags="" # power management daemon
+screenblank=NO screenblank_flags="" # wscons and FBIO screenblanker
+
+moused=NO # serial mouse handler
+ moused_flags="-p /dev/tty00"
+
+wdogctl=NO # watchdog timer control
+# wdogctl_flags="-k devicename"
+irdaattach=NO # attach serial lines to IrDA
+ irdaattach_flags="tty00"
+
+# Configuration of "wscons" console driver virtual screens.
+#
+wscons=NO wscons_flags="" # setup wscons from wscons.conf
+
+# Configuration of "wsmoused" console driver cut-n-paste support
+#
+wsmoused=NO wsmoused_flags=""
+
+# Configuration of "tpctl" touch panel calibration utility
+#
+tpctl=NO tpctl_flags=""
+
+# Mixer setting
+#
+mixerctl=NO mixerctl_mixers="" # "mixer0 mixer1" means saving
+ # and restoring their settings
+
+# Vi recovery notification. Vi(1)'s -r option can recover files which were
+# accidentally closed. See vi(1) for more details.
+#
+virecover=YES
+
+# Veriexec signature loading.
+#
+veriexec=NO
+veriexec_strict=0
+veriexec_verbose=0
+veriexec_flags="-k"
+
+# Entropy load/save to/from /dev/random at startup/shutdown
+#
+random_seed=YES
+
+# Creating / updating of man page index on boot
+makemandb=YES
+
+# blacklist daemon, needs npf
+blacklistd=NO
+
+# Start of MINIX 3 specific settings block
if [ -r /etc/defaults/minix.rc.conf ]; then
. /etc/defaults/minix.rc.conf
fi
-
+# End of MINIX 3 specific settings block
-# /etc/rc - System startup script run by init before going multiuser.
+#!/bin/sh
+#
+# $NetBSD: rc,v 1.170 2014/07/29 20:39:16 apb Exp $
+#
+# rc --
+# Run the scripts in /etc/rc.d with rcorder, and log output
+# to /var/run/rc.log.
+
+# System startup script run by init(8) on autoboot or after single-user.
+# Output and error are redirected to console by init, and the console
+# is the controlling terminal.
+
+export HOME=/
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+umask 022
-if sysenv bootramdisk >/dev/null
-then
- /bin/sh /etc/rc.ramdisk
+if [ -e ./rc.subr ] ; then
+ . ./rc.subr # for testing
+else
+ . /etc/rc.subr
fi
+. /etc/rc.conf
+_rc_conf_loaded=true
-# Are we booting from CD?
-bootcd="`/bin/sysenv bootcd`"
+: ${RC_LOG_FILE:="/var/run/rc.log"}
-exec >/dev/log
-exec 2>/dev/log
-exec </dev/null
+# rc.subr redefines echo and printf. Undo that here.
+unset echo ; unalias echo
+unset printf ; unalias printf
-umask 022
+if ! checkyesno rc_configured; then
+ echo "/etc/rc.conf is not configured. Multiuser boot aborted."
+ exit 1
+fi
+
+if [ "$1" = autoboot ]; then
+ autoboot=yes
+ rc_fast=yes # run_rc_command(): do fast booting
+fi
+
+#
+# Completely ignore INT and QUIT at the outer level. The rc_real_work()
+# function should do something different.
+#
+trap '' INT QUIT
+
+#
+# This string will be used to mark lines of meta-data sent over the pipe
+# from the rc_real_work() function to the rc_postprocess() function. Lines
+# not so marked are assumed to be output from rc.d scripts.
+#
+# This string is long and unique to ensure that it does not accidentally
+# appear in output from any rc.d script. It must not contain any
+# characters that are special to glob expansion ('*', '?', '[', or ']').
+#
+rc_metadata_prefix="$0:$$:metadata:";
+
+# Child scripts may sometimes want to print directly to the original
+# stdout and stderr, bypassing the pipe to the postprocessor. These
+# _rc_*_fd variables are private, shared with /etc/rc.subr, but not
+# intended to be used directly by child scripts. (Child scripts
+# may use rc.subr's no_rc_postprocess function.)
+#
+_rc_original_stdout_fd=7; export _rc_original_stdout_fd
+_rc_original_stderr_fd=8; export _rc_original_stderr_fd
+eval "exec ${_rc_original_stdout_fd}>&1"
+eval "exec ${_rc_original_stderr_fd}>&2"
+
+#
+# rc_real_work
+# Do the real work. Output from this function will be piped into
+# rc_postprocess(), and some of the output will be marked as
+# metadata.
+#
+# The body of this function is defined using (...), not {...}, to force
+# it to run in a subshell.
+#
+rc_real_work()
+(
+ stty status '^T'
+
+ # print_rc_metadata() wants to be able to print to the pipe
+ # that goes to our postprocessor, even if its in a context
+ # with redirected output.
+ #
+ _rc_postprocessor_fd=9 ; export _rc_postprocessor_fd
+ _rc_pid=$$ ; export _rc_pid
+ eval "exec ${_rc_postprocessor_fd}>&1"
+
+ # Print a metadata line when we exit
+ #
+ trap 'es=$?; print_rc_metadata "exit:$es"; trap "" 0; exit $es' 0
+
+ # Set shell to ignore SIGINT, but children will not ignore it.
+ # Shell catches SIGQUIT and returns to single user.
+ #
+ trap : INT
+ trap '_msg="Boot interrupted at $(date)";
+ print_rc_metadata "interrupted:${_msg}";
+ exit 1' QUIT
+
+ print_rc_metadata "start:$(date)"
+
+ #
+ # The stop_boot() function in rc.subr may kill $RC_PID. We want
+ # it to kill the subshell running this rc_real_work() function,
+ # rather than killing the parent shell, because we want the
+ # rc_postprocess() function to be able to log the error
+ # without being killed itself.
+ #
+ # "$$" is the pid of the top-level shell, not the pid of the
+ # subshell that's executing this function. The command below
+ # tentatively assumes that the parent of the "/bin/sh -c ..."
+ # process will be the current subshell, and then uses "kill -0
+ # ..." to check the result. If the "/bin/sh -c ..." process
+ # fails, or returns the pid of an ephemeral process that exits
+ # before the "kill" command, then we fall back to using "$$".
+ #
+ RC_PID=$(/bin/sh -c 'ps -p $$ -o ppid=') || RC_PID=$$
+ kill -0 $RC_PID >/dev/null 2>&1 || RC_PID=$$
-# Same settings as in the default /etc/profile. We do not source this file
-# as the system administrator may decide to change those values for his users.
-RC_TZ=/etc/rc.timezone
-PATH=/usr/local/sbin:/usr/pkg/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/pkg/bin:/usr/bin:/bin
+ #
+ # As long as process $RC_PID is still running, send a "nop"
+ # metadata message to the postprocessor every few seconds.
+ # This should help flush partial lines that may appear when
+ # rc.d scripts that are NOT marked with "KEYWORD: interactive"
+ # nevertheless attempt to print prompts and wait for input.
+ #
+ (
+ # First detach from tty, to avoid intercepting SIGINFO.
+ eval "exec ${_rc_original_stdout_fd}<&-"
+ eval "exec ${_rc_original_stderr_fd}<&-"
+ exec </dev/null >/dev/null 2>&1
+ while kill -0 $RC_PID ; do
+ print_rc_metadata "nop"
+ sleep 3
+ done
+ ) &
-# Set TERM to minix if not present.
-TERM="${TERM-minix}"
+ #
+ # Get a list of all rc.d scripts, and use rcorder to choose
+ # what order to execute them.
+ #
+ # For testing, allow RC_FILES_OVERRIDE from the environment to
+ # override this.
+ #
+ print_rc_metadata "cmd-name:rcorder"
+ scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do
+ test -d ${rcd} && echo ${rcd}/*;
+ done)
+ files=$(rcorder -s nostart ${rc_rcorder_flags} ${scripts})
+ print_rc_metadata "cmd-status:rcorder:$?"
+
+ if [ -n "${RC_FILES_OVERRIDE}" ]; then
+ files="${RC_FILES_OVERRIDE}"
+ fi
-export TERM PATH
+ #
+ # Run the scripts in order.
+ #
+ for _rc_elem in $files; do
+ print_rc_metadata "cmd-name:$_rc_elem"
+ run_rc_script $_rc_elem start
+ print_rc_metadata "cmd-status:$_rc_elem:$?"
+ done
+
+ print_rc_metadata "end:$(date)"
+ exit 0
+)
+
+#
+# rc_postprocess
+# Post-process the output from the rc_real_work() function. For
+# each line of input, we have to decide whether to print the line
+# to the console, print a twiddle on the console, print a line to
+# the log, or some combination of these.
+#
+# If rc_silent is true, then suppress most output, instead running
+# rc_silent_cmd (typically "twiddle") for each line.
+#
+# The body of this function is defined using (...), not {...}, to force
+# it to run in a subshell.
+#
+# We have to deal with the following constraints:
+#
+# * There may be no writable file systems early in the boot, so
+# any use of temporary files would be problematic.
+#
+# * Scripts run during the boot may clear /tmp and/var/run, so even
+# if they are writable, using those directories too early may be
+# problematic. We assume that it's safe to write to our log file
+# after the mountcritlocal script has run.
+#
+# * /usr/bin/tee cannot be used because the /usr file system may not
+# be mounted early in the boot.
+#
+# * All calls to the rc_log_message and rc_log_flush functions must be
+# from the same subshell, otherwise the use of a shell variable to
+# buffer log messages will fail.
+#
+rc_postprocess()
+(
+ local line
+ local before after
+ local IFS=''
+
+ # Try quite hard to flush the log to disk when we exit.
+ trap 'es=$?; rc_log_flush FORCE; trap "" 0; exit $es' 0
+
+ yesno_to_truefalse rc_silent 2>/dev/null
+
+ while read -r line ; do
+ case "$line" in
+ "${rc_metadata_prefix}"*)
+ after="${line#*"${rc_metadata_prefix}"}"
+ rc_postprocess_metadata "${after}"
+ ;;
+ *"${rc_metadata_prefix}"*)
+ # magic string is present, but not at the start of
+ # the line. Treat it as a partial line of
+ # ordinary data, followed by a line of metadata.
+ before="${line%"${rc_metadata_prefix}"*}"
+ rc_postprocess_partial_line "${before}"
+ after="${line#*"${rc_metadata_prefix}"}"
+ rc_postprocess_metadata "${after}"
+ ;;
+ *)
+ rc_postprocess_plain_line "${line}"
+ ;;
+ esac
+ done
+
+ # If we get here, then the rc_real_work() function must have
+ # exited uncleanly. A clean exit would have been accompanied by
+ # a line of metadata that would have prevented us from getting
+ # here.
+ #
+ exit 1
+)
+
+#
+# rc_postprocess_plain_line string
+# $1 is a string representing a line of output from one of the
+# rc.d scripts. Append the line to the log, and also either
+# display the line on the console, or run $rc_silent_cmd,
+# depending on the value of $rc_silent.
+#
+rc_postprocess_plain_line()
+{
+ local line="$1"
+ rc_log_message "${line}"
+ if $rc_silent; then
+ eval "$rc_silent_cmd"
+ else
+ printf "%s\n" "${line}"
+ fi
+}
-# Local variables
-ARCH="`sysenv arch`"
+#
+# rc_postprocess_partial_line string
+# This is just like rc_postprocess_plain_line, except that
+# a newline is not appended to the string.
+#
+rc_postprocess_partial_line()
+{
+ local line="$1"
+ rc_log_message_n "${line}"
+ if $rc_silent; then
+ eval "$rc_silent_cmd"
+ else
+ printf "%s" "${line}"
+ fi
+}
-usage()
+#
+# rc_postprocess_metadata string
+# $1 is a string containing metadata from the rc_real_work()
+# function. The rc_metadata_prefix marker should already
+# have been removed before the string is passed to this function.
+# Take appropriate action depending on the content of the string.
+#
+rc_postprocess_metadata()
{
- echo >&2 "Usage: $0 [-saf] autoboot|start|stop|down"
- exec intr sh
+ local metadata="$1"
+ local keyword args
+ local msg
+ local IFS=':'
+
+ # given metadata="bleep:foo bar:baz",
+ # set keyword="bleep", args="foo bar:baz",
+ # $1="foo bar", $2="baz"
+ #
+ keyword="${metadata%%:*}"
+ args="${metadata#*:}"
+ set -- $args
+
+ case "$keyword" in
+ start)
+ # Marks the start of the entire /etc/rc script.
+ # $args contains a date/time.
+ rc_log_message "[$0 starting at $args]"
+ if ! $rc_silent; then
+ # MINIX 3: the clock has not been set yet!
+ #printf "%s\n" "$args"
+ # MINIX 3: end
+ fi
+ ;;
+ cmd-name)
+ # Marks the start of a child script (usually one of
+ # the /etc/rc.d/* scripts).
+ rc_log_message "[running $1]"
+ ;;
+ cmd-status)
+ # Marks the end of a child script.
+ # $1 is a command name, $2 is the command's exit status.
+ # If the command failed, report it, and add it to a list.
+ if [ "$2" != 0 ]; then
+ rc_failures="${rc_failures}${rc_failures:+ }$1"
+ msg="$1 $(human_exit_code $2)"
+ rc_log_message "$msg"
+ if ! $rc_silent; then
+ printf "%s\n" "$msg"
+ fi
+ fi
+ # After the mountcritlocal script has finished, it's
+ # OK to flush the log to disk
+ case "$1" in
+ */mountcritlocal)
+ rc_log_flush OK
+ ;;
+ esac
+ ;;
+ nop)
+ # Do nothing.
+ # This has the side effect of flushing partial lines,
+ # and the echo() and printf() functions in rc.subr take
+ # advantage of this.
+ ;;
+ note)
+ # Unlike most metadata messages, which should be used
+ # only by /etc/rc and rc.subr, the "note" message may be
+ # used directly by /etc.rc.d/* and similar scripts.
+ # It adds a note to the log file, without displaying
+ # it to stdout.
+ rc_log_message "[NOTE: $args]"
+ ;;
+ end)
+ # Marks the end of processing, after the last child script.
+ # If any child scripts (or other commands) failed, report them.
+ #
+ if [ -n "$rc_failures" ]; then
+ rc_log_message "[failures]"
+ msg="The following components reported failures:"
+ msg="${msg}${nl}$( echo " ${rc_failures}" | fmt )"
+ msg="${msg}${nl}See ${RC_LOG_FILE} for more information."
+ rc_log_message "${msg}"
+ printf "%s\n" "${msg}"
+ fi
+ #
+ # Report the end date/time, even in silent mode
+ #
+ rc_log_message "[$0 finished at $args]"
+ printf "%s\n" "$args"
+ ;;
+ exit)
+ # Marks an exit from the rc_real_work() function.
+ # This may be a normal or abnormal exit.
+ #
+ rc_log_message "[$0 exiting with status $1]"
+ exit $1
+ ;;
+ interrupted)
+ # Marks an interrupt trapped by the rc_real_work() function.
+ # $args is a human-readable message.
+ rc_log_message "$args"
+ printf "%s\n" "$args"
+ ;;
+ *)
+ # an unrecognised line of metadata
+ rc_log_message "[metadata:${metadata}]"
+ ;;
+ esac
}
-up()
+#
+# rc_log_message string [...]
+# Write a message to the log file, or buffer it for later.
+# This function appends a newline to the message.
+#
+rc_log_message()
{
- # Function to dynamically start a system service
- opt=""
- prefix=$(expr "$1 " : '\(-\)')
- if [ "$prefix" = "-" ];
- then
- opt=$1
- shift
- fi
- service=$1
- shift
-
- minix-service $opt up /service/$service "$@"
+ _rc_log_buffer="${_rc_log_buffer}${*}${nl}"
+ rc_log_flush
}
-edit()
+#
+# rc_log_message_n string [...]
+# Just like rc_log_message, except without appending a newline.
+#
+rc_log_message_n()
{
- # Function to dynamically edit system service settings
- opt=""
- prefix=$(expr "$1 " : '\(-\)')
- if [ "$prefix" = "-" ];
- then
- opt=$1
- shift
- fi
- service=$1
- shift
-
- # Assume binaries are always in /service or /usr/pkg/service
- binlocation=/service/$service
- if [ ! -x $binlocation ]
- then binlocation=/usr/pkg/service/$service
- fi
-
- # Mostly to find init...
- if [ ! -x $binlocation ]
- then binlocation=/sbin/$service
- fi
- minix-service $opt edit $binlocation -label $service "$@"
+ _rc_log_buffer="${_rc_log_buffer}${*}"
+ rc_log_flush
}
-while getopts 'saf' opt
-do
- case $opt in
- s) sflag=t ;; # Single user
- a) aflag=t ;; # Ask for /usr
- f) fflag=-f ;; # Force a full file system check
- *) usage
- esac
-done
-shift `expr $OPTIND - 1`
-
-case "$#:$1" in
-1:start|1:stop|1:down|1:autoboot)
- action=$1
- ;;
-*) usage
-esac
-
-case $action in
-autoboot|start)
- # If booting from CD, we want some directories to be ramdisks
- if [ ! -z "$bootcd" ]
- then
- . /etc/rc.cd
- fi
-
- # National keyboard?
- test -f /etc/keymap && loadkeys /etc/keymap
-
- # options for fsck. default is -r, which prompts the user for repairs.
- optname=fsckopts
- fsckopts=-p
- if sysenv $optname >/dev/null
- then fsckopts="`sysenv $optname`"
- fi
-
- if [ "`sysenv debug_fkeys`" != 0 ]
- then
- up -n is -period 5HZ
- fi
-
- # Set timezone.
- export TZ=GMT0
- if [ -f "$RC_TZ" ]
- then
- . "$RC_TZ"
- fi
-
- # Start real time clock driver & set system time, otherwise default date.
- up readclock.drv
- readclock -q || date 201301010000
-
- # We are not shutting down.
- if [ -f /etc/nologin ]
- then
- rm -f /etc/nologin
- fi
-
- # Use MFS binary only from kernel image?
- if [ "`sysenv bin_img`" = 1 ]
- then
- bin_img="-i "
- fi
-
- # fsck + mount using /etc/fstab.
- fsck -x / $fflag $fsckopts
- mount -a
-
- if [ -z "`sysenv bootramdisk`" ]
- then
- # Unmount and free now defunct ramdisk
- umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
- ramdisk 0 /dev/imgrd || echo "Failed to free boot ramdisk"
- fi
-
- # Initialize files.
- >/var/run/utmp # /etc/utmp keeps track of logins
- >/var/run/utmpx # /etc/utmpx keeps track of logins
-
- # Edit settings for boot system services
- if [ "`sysenv skip_boot_config`" != 1 ]
- then
- edit rs
- edit vm
- edit pm
- edit sched
- edit vfs
- edit ds
- edit tty
- edit memory
- edit mib
- edit pfs
- edit init
- #
- # Keep a copy around to recover the root FS from crashes
- #
- rootline=`cat /etc/mtab | grep "on / "`
- rootfs=fs_`echo "$rootline" | cut -d' ' -f1 | cut -d'/' -f3`
- roottype=`echo "$rootline" | cut -d' ' -f5`
- minix-service -c edit /service/$roottype -label $rootfs
- fi
-
- if [ "$sflag" ]
- then
- echo "Single user. Press ^D to resume multiuser startup."
- intr sh
- echo
- fi
-
- echo "Multiuser startup in progress ..."
-
- case "`printroot -r`":$bootcd in
- /dev/ram:)
- # Remove boot-only things to make space,
- # unless booting from CD, in which case we need them.
- rm -rf /boot
- # put the compiler on ram
- cp /usr/lib/em* /usr/lib/cpp* /lib
- esac
-
- echo -n "Starting hotplugging infrastructure... "
- rm -f /var/run/devmand.pid
- devmand -d /etc/devmand -d /usr/pkg/etc/devmand &
- echo "done."
-
- # Things should be alright now.
- ;;
-down|stop)
- sync
- if [ -f /var/run/devmand.pid ]
- then
- kill -INT `cat /var/run/devmand.pid`
- # without this delay the following will
- # be printed in the console
- # RS: devman not running?
- sleep 1
- fi
- #
- # usbd needs to be stopped exactly
- # at this stage(before stopping devman
- # and after stopping the services
- # stated by devmand)
- if [ -x /usr/pkg/etc/rc.d/usbd ]
- then
- /usr/pkg/etc/rc.d/usbd stop
- fi
-
- if [ -x /service/usbd ]
- then
- minix-service down usbd
- fi
-
- # Tell RS server we're going down.
- minix-service shutdown
- ;;
-esac
-
-# Further initialization.
-test -f /usr/etc/rc && sh /usr/etc/rc $action
-test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
-
-# Any messages?
-if [ "$action" = start -o "$action" = autoboot ]
-then if [ -f /etc/issue ]
- then cat /etc/issue
+#
+# rc_log_flush [OK|FORCE]
+# save outstanding messages from $_rc_log_buffer to $RC_LOG_FILE.
+#
+# The log file is expected to reside in the /var/run directory, which
+# may not be writable very early in the boot sequence, and which is
+# erased a little later in the boot sequence. We therefore avoid
+# writing to the file until we believe it's safe to do so. We also
+# assume that it's reasonable to always append to the file, never
+# truncating it.
+#
+# Optional argument $1 may be "OK" to report that writing to the log
+# file is expected to be safe from now on, or "FORCE" to force writing
+# to the log file even if it may be unsafe.
+#
+# Returns a non-zero status if messages could not be written to the
+# file.
+#
+rc_log_flush()
+{
+ #
+ # If $_rc_log_flush_ok is false, then it's probably too early to
+ # write to the log file, so don't do it, unless $1 is "FORCE".
+ #
+ : ${_rc_log_flush_ok=false}
+ case "$1:$_rc_log_flush_ok" in
+ OK:*)
+ _rc_log_flush_ok=true
+ ;;
+ FORCE:*)
+ : OK just this once
+ ;;
+ *:true)
+ : OK
+ ;;
+ *)
+ # it's too early in the boot sequence, so don't flush
+ return 1
+ ;;
+ esac
+
+ #
+ # Now append the buffer to the file. The buffer should already
+ # contain a trailing newline, so don't add an extra newline.
+ #
+ if [ -n "$_rc_log_buffer" ]; then
+ if { printf "%s" "${_rc_log_buffer}" >>"${RC_LOG_FILE}" ; } \
+ 2>/dev/null
+ then
+ _rc_log_buffer=""
+ else
+ return 1
+ fi
fi
-fi
+ return 0
+}
-exit 0
+#
+# Most of the action is in the rc_real_work() and rc_postprocess()
+# functions.
+#
+rc_real_work "$@" 2>&1 | rc_postprocess
+exit $?
}
# Create /var ramdisk
-create_ramdisk ram0 /var 256
+create_ramdisk ram0 /var 512
create_ramdisk ram1 /tmp 128
create_ramdisk ram2 /usr/run 64
create_ramdisk ram3 /root 512
fi
# If this is not set to YES, the system will drop into single-user mode.
+# MINIX 3: for now, this setting is enabled by default.
#
-rc_configured=NO
+rc_configured=YES
# Add local overrides below.
#
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $
+#
+
+# PROVIDE: DAEMON
+# REQUIRE: NETWORKING SERVERS
+
+# This is a dummy dependency, to ensure that general purpose daemons
+# are run _after_ the above are.
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: DISKS,v 1.1 2009/04/21 16:08:57 joerg Exp $
+#
+
+# PROVIDE: DISKS
+
+#
+# This is a dummy dependency, to ensure that all disk devices are
+# accessible for fsck and mountcritlocal.
+#
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $
+#
+
+# PROVIDE: LOGIN
+# REQUIRE: DAEMON
+
+# This is a dummy dependency to ensure user services such as xdm,
+# inetd, cron and kerberos are started after everything else, incase
+# the administrator has increased the system security level and
+# wants to delay user logins until the system is (almost) fully
+# operational.
--- /dev/null
+# $NetBSD: Makefile,v 1.93 2015/03/30 10:58:37 chopps Exp $
+
+.include <bsd.own.mk>
+
+#
+# NOTE:
+#
+# If you're adding new scripts, don't forget to update following:
+# src/distrib/sets/lists/etc/mi
+# src/etc/mtree/special
+# src/usr.sbin/postinstall/postinstall
+#
+# You can find a script to visualize the dependency graph in
+# src/sbin/rcorder.
+
+# MINIX: the idea for importing rc.d scripts is basically:
+# - in principle, import only the scripts for functionality that we support;
+# - do not change dependencies ("REQUIRE", "BEFORE") in such scripts; rather,
+# satisfy the dependencies, recursively, with the following rules;
+# - for each such dependency, if it can be disabled (= it has a "rcvar"), then
+# import its script as is, even if we do not support its functionality;
+# - if such an unsupported dependency is enabled by default as per
+# etc/defaults/rc.conf, then disable it by overriding it explicitly in
+# etc/defaults/minix.rc.conf;
+# - for unsupported dependencies that can not be disabled, create a stub for it
+# (examples: fsck, root, mountcritlocal) but whenever relevant do try to keep
+# its dependency listing intact so as not to disturb the regular ordering.
+CONFIGFILES=\
+ DAEMON DISKS LOGIN NETWORKING SERVERS \
+ \
+ bootconf.sh \
+ \
+ \
+ fsck ftpd \
+ \
+ \
+ ipfilter ipsec \
+ \
+ \
+ local \
+ \
+ mountcritlocal mountcritremote \
+ network npf \
+ \
+ pwcheck \
+ \
+ \
+ root \
+ \
+ \
+ sysctl sysdb syslogd \
+ ttys \
+ wscons \
+
+
+.if defined(__MINIX)
+# MINIX: we will gradually switch over to the NetBSD rc system. For conflict
+# avoidance, all MINIX-specific scripts should have "minix" in their name.
+CONFIGFILES+= minixrc
+.endif
+
+FILESDIR= /etc/rc.d
+FILESMODE= ${BINMODE}
+
+.if !defined(__MINIX) # XXX needs testing first
+.if ${MKX11} != "no"
+CONFIGFILES+= xdm xfs fccache
+FILESBUILD_xdm= yes
+FILESBUILD_xfs= yes
+FILESBUILD_fccache= yes
+.endif # !defined(__MINIX)
+
+.SUFFIXES: .in
+.in:
+ ${_MKTARGET_CREATE}
+ ${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.IMPSRC} > ${.TARGET}
+.endif
+
+.include <bsd.prog.mk>
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $
+#
+
+# PROVIDE: NETWORKING NETWORK
+
+# This is a dummy dependency, for services which require networking
+# to be operational before starting.
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $
+#
+
+# PROVIDE: SERVERS
+# REQUIRE: mountcritremote
+
+# This is a dummy dependency, for early-start servers relying on
+# some basic configuration.
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: bootconf.sh,v 1.15 2012/12/31 23:21:27 christos Exp $
+#
+
+# PROVIDE: bootconf
+# REQUIRE: mountcritlocal
+# KEYWORD: interactive
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="bootconf"
+start_cmd="bootconf_start"
+stop_cmd=":"
+
+bootconf_start()
+{
+ # Refer to newbtconf(8) for more information
+ #
+
+ if [ ! -e /etc/etc.current ]; then
+ return 0
+ fi
+ if [ -h /etc/etc.default ]; then
+ def=$(ls -ld /etc/etc.default 2>&1)
+ default="${def##*-> *etc.}"
+ else
+ default=current
+ fi
+ if [ "$default" = "current" ]; then
+ def=$(ls -ld /etc/etc.current 2>&1)
+ default="${def##*-> *etc.}"
+ fi
+
+ spc=""
+ for i in /etc/etc.*; do
+ name="${i##/etc/etc.}"
+ case $name in
+ current|default|\*)
+ continue
+ ;;
+ *)
+ if [ "$name" = "$default" ]; then
+ echo -n "${spc}[${name}]"
+ else
+ echo -n "${spc}${name}"
+ fi
+ spc=" "
+ ;;
+ esac
+ done
+ echo
+ _DUMMY=/etc/passwd
+ conf=${_DUMMY}
+ while [ ! -d /etc/etc.$conf/. ]; do
+ trap "conf=$default; echo; echo Using default of $default" ALRM
+ echo -n "Which configuration [$default] ? "
+ (sleep 30 && kill -ALRM $RC_PID) >/dev/null 2>&1 &
+ read conf
+ trap : ALRM
+ if [ -z $conf ] ; then
+ conf=$default
+ fi
+ if [ ! -d /etc/etc.$conf/. ]; then
+ conf=${_DUMMY}
+ fi
+ done
+
+ print_rc_metadata "note:Using configuration \"${conf}\""
+
+ case $conf in
+ current|default)
+ ;;
+ *)
+ rm -f /etc/etc.current
+ ln -s etc.$conf /etc/etc.current
+ sync
+ ;;
+ esac
+
+ if [ -f /etc/rc.conf ] ; then
+ . /etc/rc.conf
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+# MINIX 3 stub.
+
+# PROVIDE: fsck
+# REQUIRE: DISKS
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: ftpd,v 1.3 2005/08/09 14:59:33 peter Exp $
+#
+
+# PROVIDE: ftpd
+# REQUIRE: LOGIN
+# KEYWORD: shutdown
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="ftpd"
+rcvar=$name
+command="/usr/libexec/${name}"
+command_args="-D"
+pidfile="/var/run/${name}.pid"
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: ipfilter,v 1.18 2009/03/23 18:52:02 hannken Exp $
+#
+
+# PROVIDE: ipfilter
+# REQUIRE: root bootconf mountcritlocal tty
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="ipfilter"
+rcvar=$name
+start_precmd="ipfilter_prestart"
+start_cmd="ipfilter_start"
+stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf"
+stop_cmd="ipfilter_stop"
+reload_precmd="$stop_precmd"
+reload_cmd="ipfilter_reload"
+resync_precmd="$stop_precmd"
+resync_cmd="ipfilter_resync"
+status_precmd="$stop_precmd"
+status_cmd="ipfilter_status"
+extra_commands="reload resync status"
+
+ipfilter_prestart()
+{
+ if [ ! -f /etc/ipf.conf ] && [ ! -f /etc/ipf6.conf ]; then
+ warn "/etc/ipf*.conf not readable; ipfilter start aborted."
+
+ stop_boot
+ return 1
+ fi
+ return 0
+}
+
+ipfilter_start()
+{
+ echo "Enabling ipfilter."
+ /sbin/ipf ${rc_flags} -E
+
+ # Do the flush first; since older ipf has different semantics.
+ #
+ if [ -f /etc/ipf.conf ]; then
+ /sbin/ipf -Fa
+ fi
+ if [ -f /etc/ipf6.conf ]; then
+ /sbin/ipf -6 -Fa
+ fi
+
+ # Now load the config files
+ #
+ if [ -f /etc/ipf.conf ]; then
+ /sbin/ipf -f /etc/ipf.conf
+ fi
+ if [ -f /etc/ipf6.conf ]; then
+ /sbin/ipf -6 -f /etc/ipf6.conf
+ fi
+}
+
+ipfilter_stop()
+{
+ echo "Disabling ipfilter."
+ /sbin/ipf -D
+}
+
+ipfilter_reload()
+{
+ echo "Reloading ipfilter rules."
+
+ # Do the flush first; since older ipf has different semantics.
+ #
+ if [ -f /etc/ipf.conf ]; then
+ /sbin/ipf -I -Fa
+ fi
+ if [ -f /etc/ipf6.conf ]; then
+ /sbin/ipf -6 -I -Fa
+ fi
+
+ # Now load the config files into the Inactive set
+ #
+ if [ -f /etc/ipf.conf ] && ! /sbin/ipf -I -f /etc/ipf.conf; then
+ err 1 "reload of ipf.conf failed; not swapping to new ruleset."
+ fi
+ if [ -f /etc/ipf6.conf ] && ! /sbin/ipf -I -6 -f /etc/ipf6.conf; then
+ err 1 "reload of ipf6.conf failed; not swapping to new ruleset."
+ fi
+
+ # Swap in the new rules
+ #
+ /sbin/ipf -s
+}
+
+ipfilter_resync()
+{
+ /sbin/ipf -y
+}
+
+ipfilter_status()
+{
+ /sbin/ipf -V
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: ipsec,v 1.13 2013/09/12 19:52:50 christos Exp $
+#
+
+# PROVIDE: ipsec
+# REQUIRE: root bootconf mountcritlocal tty
+# BEFORE: DAEMON
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="ipsec"
+rcvar=$name
+start_precmd="ipsec_prestart"
+start_cmd="ipsec_start"
+stop_precmd="test -f /etc/ipsec.conf"
+stop_cmd="ipsec_stop"
+reload_cmd="ipsec_reload"
+extra_commands="reload"
+
+ipsec_prestart()
+{
+ if [ ! -f /etc/ipsec.conf ]; then
+ warn "/etc/ipsec.conf not readable; ipsec start aborted."
+
+ stop_boot
+ return 1
+ fi
+ return 0
+}
+
+ipsec_getip() {
+ ifconfig $1 | while read what address rest; do
+ case "$what" in
+ inet) echo "$address";;
+ esac
+ done
+}
+
+ipsec_load() {
+ if [ -z "$1" ]; then
+ /sbin/setkey -f /etc/ipsec.conf
+ else
+ sed -e "s/@LOCAL_ADDR@/$1/" < /etc/ipsec.conf | \
+ /sbin/setkey -f -
+ fi
+}
+
+ipsec_configure() {
+ while true; do
+ local addr="$(ipsec_getip "$ipsec_flags")"
+ case "$addr" in
+ '') sleep 1;;
+ "0.0.0.0") sleep 1;;
+ *) ipsec_load "$addr"; return;;
+ esac
+ done &
+}
+
+ipsec_start()
+{
+ echo "Installing ipsec manual keys/policies."
+ if [ -n "$ipsec_flags" ]; then
+ ipsec_configure
+ else
+ ipsec_load
+ fi
+}
+
+ipsec_stop()
+{
+ echo "Clearing ipsec manual keys/policies."
+
+ # still not 100% sure if we would like to do this.
+ # it is very questionable to do this during shutdown session, since
+ # it can hang any of remaining IPv4/v6 session.
+ #
+ /sbin/setkey -F
+ /sbin/setkey -FP
+}
+
+ipsec_reload()
+{
+ echo "Reloading ipsec manual keys/policies."
+ ipsec_stop
+ ipsec_start
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: local,v 1.7 2004/08/13 18:08:03 mycroft Exp $
+#
+
+# REQUIRE: DAEMON
+# PROVIDE: local
+# BEFORE: LOGIN
+# KEYWORD: shutdown
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="local"
+start_cmd="local_start"
+stop_cmd="local_stop"
+
+local_start()
+{
+ if [ -f /etc/rc.local ]; then
+ . /etc/rc.local
+ fi
+}
+
+local_stop()
+{
+ if [ -f /etc/rc.shutdown.local ]; then
+ . /etc/rc.shutdown.local
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+# MINIX 3 bridge from NetBSD rc to MINIX rc. Must be called as the very first
+# script at startup (hence the current 'before'). Ideally the MINIX rc would
+# be decomposed into a number of small rc scripts, though.
+
+# PROVIDE: minixrc
+# BEFORE: DISKS
+# KEYWORD: shutdown
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="minixrc"
+start_cmd="sh /etc/rc.minix start"
+stop_cmd="sh /etc/rc.minix stop"
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+# MINIX 3 stub.
+
+# PROVIDE: mountcritlocal
+# REQUIRE: fsck
--- /dev/null
+#!/bin/sh
+# MINIX 3 stub.
+# Even though this script does not appear to do much, it will in some cases
+# invoke the mount command with a syntax that we do not support.
+
+# PROVIDE: mountcritremote
+# REQUIRE: NETWORKING root mountcritlocal
--- /dev/null
+#!/bin/sh
+# MINIX 3 stub (for now!).
+
+# PROVIDE: network
+# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl
+# BEFORE: NETWORKING
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: npf,v 1.3 2012/11/01 06:06:14 mrg Exp $
+#
+# Public Domain.
+#
+
+# PROVIDE: npf
+# REQUIRE: root bootconf mountcritlocal tty network
+# BEFORE: NETWORKING
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="npf"
+rcvar=$name
+
+config="/etc/npf.conf"
+
+start_cmd="npf_start"
+stop_cmd="npf_stop"
+
+reload_cmd="npf_reload"
+status_cmd="npf_status"
+extra_commands="reload status"
+
+npf_cfg_check()
+{
+ if [ ! -f ${config} ]; then
+ warn "${config} is not readable; failed."
+ exit 1
+ fi
+}
+
+npf_start()
+{
+ echo "Enabling NPF."
+ npf_cfg_check
+ /sbin/npfctl reload
+ /sbin/npfctl start
+}
+
+npf_stop()
+{
+ echo "Disabling NPF."
+ /sbin/npfctl stop
+ /sbin/npfctl flush
+}
+
+npf_reload()
+{
+ echo "Reloading NPF ruleset."
+ npf_cfg_check
+ /sbin/npfctl reload
+}
+
+npf_status()
+{
+ :
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: pwcheck,v 1.5 2004/08/13 18:08:03 mycroft Exp $
+#
+
+# PROVIDE: pwcheck
+# REQUIRE: mountcritremote syslogd
+# BEFORE: DAEMON
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="pwcheck"
+start_cmd="pwcheck_start"
+stop_cmd=":"
+
+pwcheck_start()
+{
+ # check the password temp/lock file
+ #
+ if [ -f /etc/ptmp ]; then
+ logger -s -p auth.err \
+ "password file may be incorrect -- /etc/ptmp exists"
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+# MINIX 3 stub.
+
+# PROVIDE: root
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: sysctl,v 1.13 2004/08/13 18:08:03 mycroft Exp $
+#
+
+# PROVIDE: sysctl
+# REQUIRE: root ipfilter ipsec
+# BEFORE: DAEMON
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="sysctl"
+start_cmd="sysctl_start"
+stop_cmd=":"
+
+sysctl_start()
+{
+ if [ -r /etc/sysctl.conf ]; then
+ echo "Setting sysctl variables:"
+ sysctl -f /etc/sysctl.conf
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: sysdb,v 1.24 2012/06/03 21:42:45 joerg Exp $
+#
+
+# PROVIDE: sysdb
+# REQUIRE: mountcritremote
+# BEFORE: DAEMON
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="sysdb"
+rcvar=$name
+start_cmd="sysdb_start"
+stop_cmd=":"
+extra_commands="devdb utmp services netgroup password"
+devdb_cmd="build_devdb"
+utmp_cmd="build_utmp"
+services_cmd="build_services"
+netgroup_cmd="build_netgroup"
+password_cmd="build_password"
+echo=:
+
+sysdb_start()
+{
+ echo -n "Building databases:"
+ echo=echo
+ comma=" "
+ $devdb_cmd
+ $utmp_cmd
+ $services_cmd
+ $netgroup_cmd
+ $password_cmd
+ echo "."
+}
+
+check_file()
+{
+ local src="$1"
+ local db="$2"
+
+ shift 2
+ if [ ! -e "$src" ]; then
+ return
+ fi
+ if [ \( ! -f "$db" \) -o \( "$src" -nt "$db" \) ]; then
+ $echo -n "$comma$(basename "$src")"
+ comma=", "
+ "$@"
+ fi
+}
+
+build_services()
+{
+ check_file /etc/services /var/db/services.cdb services_mkdb -q
+}
+
+build_netgroup()
+{
+ check_file /etc/netgroup /var/db/netgroup.db netgroup_mkdb
+}
+
+build_devdb()
+{
+ check_file /dev /var/run/dev.db dev_mkdb
+ check_file /dev /var/run/dev.cdb dev_mkdb
+}
+
+build_password()
+{
+ local p=/etc/master.passwd
+ check_file $p /etc/spwd.db pwd_mkdb -w $p
+}
+
+build_utmp()
+{
+ # Re-create /var/run/utmp and /var/run/utmpx, which are
+ # deleted by mountcritlocal but can't be recreated by it
+ # because install and chown may not be available then
+ # (possibly no /usr).
+ #
+ local i
+ for i in "" x; do
+ if [ ! -f /var/run/utmp$i ]; then
+ $echo -n "${comma}utmp$i"
+ comma=", "
+ install -c -m 664 -g utmp /dev/null /var/run/utmp$i
+ fi
+ done
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: syslogd,v 1.15 2004/10/11 13:29:52 lukem Exp $
+#
+
+# PROVIDE: syslogd
+# REQUIRE: mountcritremote sysdb wscons
+# BEFORE: SERVERS
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="syslogd"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/syslog.conf"
+start_precmd="syslogd_precmd"
+extra_commands="reload"
+
+_sockfile="/var/run/syslogd.sockets"
+
+syslogd_precmd()
+{
+ # Transitional symlink for old binaries
+ #
+ # MINIX 3: unsupported, disabled
+ #if [ ! -h /dev/log ]; then
+ # ln -sf /var/run/log /dev/log
+ #fi
+ # MINIX 3: end
+
+ # Create default list of syslog sockets to watch
+ #
+ ( umask 022 ; > $_sockfile )
+
+ # Find /etc/rc.d scripts with "chrootdir" rcorder(8) keyword,
+ # and if $${app}_chrootdir is a directory, add appropriate
+ # syslog socket to list of sockets to watch.
+ #
+ for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do
+ (
+ _l=${_lr##*/}
+ load_rc_config ${_l}
+ eval _ldir=\$${_l}_chrootdir
+ if checkyesno $_l && [ -n "$_ldir" ]; then
+ echo "${_ldir}/var/run/log" >> $_sockfile
+ fi
+ )
+ done
+
+ # If other sockets have been provided, change run_rc_command()'s
+ # internal copy of $syslogd_flags to force use of specific
+ # syslogd sockets.
+ #
+ if [ -s $_sockfile ]; then
+ echo "/var/run/log" >> $_sockfile
+ rc_flags="-P $_sockfile $rc_flags"
+ fi
+
+ return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+#!/bin/sh
+# MINIX 3 stub.
+# There is currently nothing in the NetBSD script that we want: setting tty
+# flags is not yet a supported concept, and changing /dev/tty permissions does
+# not work from the installation CD with its read-only /dev directory.
+
+# PROVIDE: tty
+# REQUIRE: root bootconf
--- /dev/null
+#!/bin/sh
+#
+# $NetBSD: wscons,v 1.13 2011/08/09 08:08:10 mbalmer Exp $
+#
+
+# PROVIDE: wscons
+# REQUIRE: mountcritremote
+# BEFORE: LOGIN
+
+$_rc_subr_loaded . /etc/rc.subr
+
+name="wscons"
+rcvar=$name
+start_cmd="wscons_start"
+stop_cmd=":"
+
+wscons_start()
+{
+ wscfg=/usr/sbin/wsconscfg
+ wsfld=/usr/sbin/wsfontload
+ wsctl=/sbin/wsconsctl
+ config=/etc/wscons.conf
+ usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]"
+ DOIT=
+
+ while [ $# -gt 0 ]; do
+ case $1 in
+ -n)
+ DOIT=echo
+ ;;
+ -f)
+ config=$2
+ shift
+ ;;
+ -font)
+ wsfld=$2
+ shift
+ ;;
+ -screen)
+ wscfg=$2
+ shift
+ ;;
+ *)
+ echo $usage
+ exit 1
+ ;;
+ esac
+ shift
+ done
+
+
+ # args mean:
+ # screen idx scr emul
+ # font name width height enc file
+ ( while read type arg1 arg2 arg3 arg4 arg5; do
+ case "$type" in
+ \#*|"")
+ continue
+ ;;
+
+ font)
+ name=$arg1
+ width=$arg2
+ height=$arg3
+ enc=$arg4
+ file=$arg5
+ cmd=$wsfld
+
+ case $width in
+ -)
+ ;;
+ *)
+ cmd="$cmd -w $width"
+ ;;
+ esac
+ case $height in
+ -)
+ ;;
+ *)
+ cmd="$cmd -h $height"
+ ;;
+ esac
+ case $enc in
+ -)
+ ;;
+ *)
+ cmd="$cmd -e $enc"
+ ;;
+ esac
+ cmd="$cmd -N $name $file"
+ eval $DOIT $cmd
+ ;;
+
+ screen)
+ idx=$arg1
+ scr=$arg2
+ emul=$arg3
+ cmd=$wscfg
+
+ case $scr in
+ -)
+ ;;
+ *)
+ cmd="$cmd -t $scr"
+ ;;
+ esac
+ case $emul in
+ -)
+ ;;
+ *)
+ cmd="$cmd -e $emul"
+ ;;
+ esac
+ cmd="$cmd $idx"
+ eval $DOIT $cmd
+ ;;
+
+ keyboard)
+ kbd=$arg1
+ cmd=$wscfg
+ case $kbd in
+ -|auto)
+ cmd="$cmd -k"
+ ;;
+ *)
+ cmd="$cmd -k $kbd"
+ ;;
+ esac
+ eval $DOIT $cmd
+ ;;
+
+ encoding)
+ map=$arg1
+ cmd="$wsctl -w \"encoding=$map\""
+ echo -n 'Keyboard '
+ eval $DOIT $cmd
+ ;;
+
+ mapfile)
+ mapfile=$arg1
+ ( while read entry; do
+ case "$entry" in
+ \#*|"")
+ continue
+ ;;
+ *)
+ cmd="$wsctl -w \"map+=$entry\""
+ cmd="$cmd >/dev/null"
+ eval $DOIT $cmd
+ ;;
+ esac
+ done ) < $mapfile
+ ;;
+
+ mux)
+ cmd="$wscfg -m $arg1"
+ eval $DOIT $cmd
+ ;;
+
+ setvar)
+ dev=$arg1
+ var=$arg2
+ val=$arg3
+
+ case $dev in
+ ttyE*)
+ cmdmod="-d"
+ ;;
+ wskbd*)
+ cmdmod="-k"
+ ;;
+ wsmouse*)
+ cmdmod="-m"
+ ;;
+ esac
+ echo -n "$dev: "
+ cmd="$wsctl -f /dev/$dev $cmdmod -w $var=$val"
+ eval $DOIT $cmd
+ ;;
+
+ esac
+ done ) < $config
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+# /etc/rc.minix - MINIX system startup script
+
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+
+# The normal system boot situation is that init(8) invokes the ramdisk RC
+# script, which invokes the NetBSD rc infrastructure, which in turn calls this
+# script through /etc/rc.d/minixrc. With a boot ramdisk (x86_ramimage), the
+# ramdisk RC is bypassed altogether, but stored as /etc/rc.ramdisk. We then
+# have to invoke it here (for startup only!) to let it perform its tasks first.
+if sysenv bootramdisk >/dev/null
+then
+ [ "$1" = "start" ] && sh /etc/rc.ramdisk "$@"
+fi
+
+# Same settings as in the default /etc/profile. We do not source this file
+# as the system administrator may decide to change those values for his users.
+RC_TZ=/etc/rc.timezone
+
+# Are we booting from CD?
+bootcd="`/bin/sysenv bootcd`"
+
+# Set TERM to minix if not present.
+TERM="${TERM-minix}"
+
+export TERM PATH
+
+# Local variables
+ARCH="`sysenv arch`"
+
+usage()
+{
+ echo >&2 "Usage: $0 [-saf] [start|stop]"
+ exec intr sh
+}
+
+up()
+{
+ # Function to dynamically start a system service
+ opt=""
+ prefix=$(expr "$1 " : '\(-\)')
+ if [ "$prefix" = "-" ];
+ then
+ opt=$1
+ shift
+ fi
+ service=$1
+ shift
+
+ minix-service $opt up /service/$service "$@"
+}
+
+edit()
+{
+ # Function to dynamically edit system service settings
+ opt=""
+ prefix=$(expr "$1 " : '\(-\)')
+ if [ "$prefix" = "-" ];
+ then
+ opt=$1
+ shift
+ fi
+ service=$1
+ shift
+
+ # Assume binaries are always in /service or /usr/pkg/service
+ binlocation=/service/$service
+ if [ ! -x $binlocation ]
+ then binlocation=/usr/pkg/service/$service
+ fi
+
+ # Mostly to find init...
+ if [ ! -x $binlocation ]
+ then binlocation=/sbin/$service
+ fi
+ minix-service $opt edit $binlocation -label $service "$@"
+}
+
+set -- `sysenv bootopt` "$@"
+while getopts 'saf' opt
+do
+ case $opt in
+ s) sflag=t ;; # Single user
+ a) aflag=t ;; # Ask for /usr
+ f) fflag=-f ;; # Force a full file system check
+ *) usage
+ esac
+done
+shift `expr $OPTIND - 1`
+
+case "$#:$1" in
+1:start|1:stop)
+ action=$1
+ ;;
+*) usage
+esac
+
+case $action in
+start)
+ # If booting from CD, we want some directories to be ramdisks
+ if [ ! -z "$bootcd" ]
+ then
+ . /etc/rc.cd
+ fi
+
+ # National keyboard?
+ test -f /etc/keymap && loadkeys /etc/keymap
+
+ # options for fsck. default is -r, which prompts the user for repairs.
+ optname=fsckopts
+ fsckopts=-p
+ if sysenv $optname >/dev/null
+ then fsckopts="`sysenv $optname`"
+ fi
+
+ if [ "`sysenv debug_fkeys`" != 0 ]
+ then
+ up -n is -period 5HZ
+ fi
+
+ # Set timezone.
+ export TZ=GMT0
+ if [ -f "$RC_TZ" ]
+ then
+ . "$RC_TZ"
+ fi
+
+ # Start real time clock driver & set system time, otherwise default date.
+ up readclock.drv
+ readclock -q || date 201301010000
+
+ # We are not shutting down.
+ if [ -f /etc/nologin ]
+ then
+ rm -f /etc/nologin
+ fi
+
+ # Use MFS binary only from kernel image?
+ if [ "`sysenv bin_img`" = 1 ]
+ then
+ bin_img="-i "
+ fi
+
+ # fsck + mount using /etc/fstab.
+ fsck -x / $fflag $fsckopts
+ mount -a
+
+ if [ -z "`sysenv bootramdisk`" ]
+ then
+ # Unmount and free now defunct ramdisk
+ umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk"
+ ramdisk 0 /dev/imgrd || echo "Failed to free boot ramdisk"
+ fi
+
+ # Initialize files.
+ >/var/run/utmp # /etc/utmp keeps track of logins
+ >/var/run/utmpx # /etc/utmpx keeps track of logins
+
+ # Edit settings for boot system services
+ if [ "`sysenv skip_boot_config`" != 1 ]
+ then
+ edit rs
+ edit vm
+ edit pm
+ edit sched
+ edit vfs
+ edit ds
+ edit tty
+ edit memory
+ edit mib
+ edit pfs
+ edit init
+ #
+ # Keep a copy around to recover the root FS from crashes
+ #
+ rootline=`cat /etc/mtab | grep "on / "`
+ rootfs=fs_`echo "$rootline" | cut -d' ' -f1 | cut -d'/' -f3`
+ [ "$rootfs" = "fs_bootramdisk" ] && rootfs=fs_imgrd
+ roottype=`echo "$rootline" | cut -d' ' -f5`
+ minix-service -c edit /service/$roottype -label $rootfs
+ fi
+
+ if [ "$sflag" ]
+ then
+ echo "Single user. Press ^D to resume multiuser startup."
+ intr sh
+ echo
+ fi
+
+ echo "Multiuser startup in progress ..."
+
+ case "`printroot -r`":$bootcd in
+ /dev/ram:)
+ # Remove boot-only things to make space,
+ # unless booting from CD, in which case we need them.
+ rm -rf /boot
+ # put the compiler on ram
+ cp /usr/lib/em* /usr/lib/cpp* /lib
+ esac
+
+ echo -n "Starting hotplugging infrastructure... "
+ rm -f /var/run/devmand.pid
+ devmand -d /etc/devmand -d /usr/pkg/etc/devmand &
+ echo "done."
+
+ # Things should be alright now.
+ ;;
+stop)
+ sync
+ if [ -f /var/run/devmand.pid ]
+ then
+ kill -INT `cat /var/run/devmand.pid`
+ # without this delay the following will
+ # be printed in the console
+ # RS: devman not running?
+ sleep 1
+ fi
+ #
+ # usbd needs to be stopped exactly
+ # at this stage(before stopping devman
+ # and after stopping the services
+ # stated by devmand)
+ if [ -x /usr/pkg/etc/rc.d/usbd ]
+ then
+ /usr/pkg/etc/rc.d/usbd stop
+ fi
+
+ if [ -x /service/usbd ]
+ then
+ minix-service down usbd
+ fi
+
+ # Tell RS server we're going down.
+ minix-service shutdown
+ ;;
+esac
+
+# Further initialization.
+test -f /usr/etc/rc && sh /usr/etc/rc $action
+test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action
+
+# Any messages?
+if [ "$action" = start ]
+then if [ -f /etc/issue ]
+ then cat /etc/issue
+ fi
+fi
+
+exit 0
#!/bin/sh
+#
+# $NetBSD: rc.shutdown,v 1.9 2012/06/25 07:22:45 jnemeth Exp $
+#
+# rc.shutdown --
+# Run the scripts in /etc/rc.d with reverse rcorder.
-sh /etc/rc stop
+# System shutdown script run by shutdown(8) at system shutdown time.
+# Note that halt(8) and reboot(8) do NOT invoke this script.
+
+export HOME=/
+export PATH=/sbin:/bin:/usr/sbin:/usr/bin
+
+. /etc/rc.subr
+. /etc/rc.conf
+
+if ! checkyesno do_rcshutdown; then
+ echo "Skipping shutdown hooks."
+ exit 0
+fi
+
+stty status '^T'
+
+# Set shell to ignore SIGINT, but not children;
+# shell catches SIGQUIT and returns to single user.
+#
+trap : INT
+trap "echo 'Shutdown interrupted.'; exit 1" QUIT
+
+# If requested, start a watchdog timer in the background which
+# will terminate rc.shutdown if rc.shutdown doesn't complete
+# within the specified time.
+#
+_rcshutdown_watchdog=
+if [ -n "$rcshutdown_timeout" ]; then
+ sleep $rcshutdown_timeout && (
+ _msg="$rcshutdown_timeout second watchdog timeout expired. Shutdown terminated."
+ logger -t rc.shutdown "$_msg"
+ echo "$_msg"
+ date
+ kill -KILL $$ >/dev/null 2>&1
+ ) &
+ _rcshutdown_watchdog=$!
+fi
+
+
+# Determine the shutdown order of the rc.d scripts,
+# and perform the operation
+#
+scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do
+ test -d ${rcd} && echo ${rcd}/*; done)
+files=$(rcorder -k shutdown ${rcshutdown_rcorder_flags} ${scripts})
+
+for _rc_elem in $(reverse_list $files); do
+ run_rc_script $_rc_elem stop
+done
+
+
+# Terminate the background watchdog timer (if it is running)
+#
+if [ -n "$_rcshutdown_watchdog" ]; then
+ kill -TERM $_rcshutdown_watchdog >/dev/null 2>&1
+fi
+
+date
+exit 0
bootcd="`/bin/sysenv bootcd`"
case "$#:$1" in
-1:autoboot)
- action=start
- ;;
-1:start|1:stop|1:down)
+1:start|1:stop)
action=$1
;;
-*) echo >&2 "Usage: $0 autoboot|start|stop|down"
+*) echo >&2 "Usage: $0 [start|stop]"
exit 1
esac
DAEMONS=/etc/rc.daemons
case $action in
-start|autoboot)
+start)
# Select console font.
test -f /etc/font && loadfont /etc/font </dev/console
ln -s /tmp/log /var/log || true
. /etc/rc.cd
fi
- # syslogd has not been started yet
- rm -f /var/run/syslogd.pid
- daemonize syslogd -s
+
echo .
# i2c only supported on ARM at the moment
fi
fi
- # Now that all device files should be created, see if we need to update the
- # device file database. This code is butchered from NetBSD etc/rc.d/sysdb.
- DEVDIR=/dev
- DEVDB=/var/run/dev.cdb
- if [ ! -f "$DEVDB" -o "$DEVDIR" -nt "$DEVDB" ]
- then
- dev_mkdb
- fi
-
- # Same for /etc/services.
- SERVICESFILE=/etc/services
- SERVICESDB=/var/db/services.cdb
- if [ ! -f "$SERVICESDB" -o "$SERVICESFILE" -nt "$SERVICESDB" ]
- then
- services_mkdb -q
- fi
-
if [ "$net" ]
then
# Get the nodename from the DNS and set it.
# Run the daily cleanup on systems that are not on at night.
test -f /usr/etc/daily && sh /usr/etc/daily boot &
;;
-stop|down)
+stop)
# Save random data, if /usr is mounted rw.
if grep ' \/usr .*rw.*' /etc/mtab >/dev/null
then
fi
esac
-d=
# Let packages run their own scripts
+# FIXME: this should be removed altogether: pkgsrc is not supposed to be used
+# this way. Instead, the user should copy over scripts from /usr/pkg/etc/rc.d
+# to /etc/rc.d as desired, and configure them in /etc/rc.conf as appropriate.
for d in /usr/local/etc/rc.d /usr/pkg/etc/rc.d
do
if [ -d "$d" -a -z "$bootcd" ]
#!/bin/sh
set -e
-exec >/dev/log
-exec 2>/dev/log
-exec </dev/null
-
PATH=/sbin:/usr/sbin:/bin:/usr/bin
FSCK=/bin/fsck_mfs
ACPI=/service/acpi
-if [ X`/bin/sysenv arch` = Xi386 ]
+if [ X`sysenv arch` = Xi386 ]
then if [ -e $ACPI -a -n "`sysenv acpi`" ]
then
minix-service -c up $ACPI
# Do we want to use the virtio block device?
# If not specified, default to yes if the device is found.
- if /bin/sysenv virtio_blk >/dev/null
- then virtio_blk="`/bin/sysenv virtio_blk`"
+ if sysenv virtio_blk >/dev/null
+ then virtio_blk="`sysenv virtio_blk`"
elif grep '^[^ ]* [^ ]* 1AF4:1001[^ ]* ' /proc/pci >/dev/null
then echo "virtio_blk not set, defaulting to using found virtio device."
virtio_blk=yes
fi
minix-service -cn up /service/floppy -dev /dev/fd0
- if [ X`/bin/sysenv ahci` = Xyes ]
+ if [ X`sysenv ahci` = Xyes ]
then
# this is here temporarily, for testing purposes
minix-service -c up /service/ahci -dev /dev/c0d0 -label ahci_0 -args instance=0
minix-service -c up /service/at_wini -dev /dev/c0d0 -label at_wini_0
minix-service -cr up /service/at_wini -dev /dev/c1d0 -label at_wini_1 -args instance=1 2>/dev/null || :
fi
- /bin/umount /proc >/dev/null
+ umount /proc >/dev/null
fi
-if [ X`/bin/sysenv arch` = Xearm ]
+if [ X`sysenv arch` = Xearm ]
then echo Starting the mmc driver
minix-service -c up /service/mmc -dev /dev/c0d0
fi
+# Load ProcFS from the ramdisk to minimize the chance of a desync with the boot
+# image services from which it obtains data structures directly. As we move to
+# the MIB service, this will eventually become obsolete.
minix-service up /service/procfs || echo "WARNING: couldn't start procfs"
-if /bin/sysenv rootdevname >/dev/null
-then rootdevname=/dev/`/bin/sysenv rootdevname`
+if sysenv rootdevname >/dev/null
+then rootdevname=/dev/`sysenv rootdevname`
else
if (! sysenv cdproberoot) && (! sysenv bootramdisk) >/dev/null
then echo "rootdevname not set"
export rootdevname
elif [ "$rootdevname" = "/dev/ram" ]
then
- ramimagename=/dev/`/bin/sysenv ramimagename`
+ ramimagename=/dev/`sysenv ramimagename`
echo "Loading ramdisk from $ramimagename"
loadramdisk "$ramimagename" || echo "WARNING: loadramdisk failed"
fi
fi
fi
-# Change root from temporary boot ramdisk to the configure
-# root device
-if ! sysenv bootramdisk >/dev/null
-then
- /bin/mount -n $bin_img"$rootdevname" /
+# Change root from temporary boot ramdisk to the configure root device
+if ! sysenv bootramdisk >/dev/null; then
+ mount -n $bin_img"$rootdevname" /
+
+ # Reopen standard file descriptors, so that we can unmount the ramdisk.
+ # That is essentially a VFS shortcoming that should be fixed, though..
+ exec >/dev/log
+ exec 2>/dev/log
+ exec </dev/console
fi
-/bin/mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs"
+# Mount the ProcFS instance that was loaded from the ramdisk, on the root FS.
+mount -e -n -t procfs none /proc || echo "WARNING: couldn't mount procfs"
-if ! sysenv bootramdisk >/dev/null
-then
- exec /bin/sh /etc/rc `sysenv bootopts` "$@"
+# Start the NetBSD rc infrastructure
+if ! sysenv bootramdisk >/dev/null; then
+ exec sh /etc/rc "$@"
fi
# Missing: ms
.include <bsd.own.mk>
-#__MINIX: dict doc examples man me \
+#__MINIX: dict doc examples me \
# tabset tmac wscons xml
.if ${MKSHARE} != "no" || \
make(clean) || make(cleandir) || make(distclean) || make(obj)
-SUBDIR= legal misc mk \
+SUBDIR= legal man misc mk \
terminfo
.if ${MKNLS} != "no"
SUBDIR+=i18n locale nls
--- /dev/null
+# $NetBSD: Makefile,v 1.34 2014/12/13 14:16:48 christos Exp $
+# from: @(#)Makefile 8.2 (Berkeley) 4/16/94
+
+.include <bsd.own.mk>
+
+.if ${MKSHARE} != "no"
+# MINIX 3: XXX FIXME
+#SUBDIR= man0 man1 man2 man3 man3lua man4 man5 man6 man7 man8 man9 man9lua
+SUBDIR= man5 man8
+
+.if !defined(__MINIX) # XXX FIXME
+.if ${MKRUMP} != "no"
+SUBDIR+=${.CURDIR}/../../sys/rump/share/man
+.endif
+
+WHATISDBDIR?= /usr/share/man
+
+.if ${MKMAKEMANDB} == "no"
+makedb:
+ ${TOOL_MAKEWHATIS} ${DESTDIR}${WHATISDBDIR}
+.if ${MKUNPRIVED} != "no"
+ echo ".${WHATISDBDIR}/whatis.db type=file mode=0444 uname=${BINOWN} gname=${BINGRP}" \
+ | ${METALOG.add}
+.endif
+.else
+makedb:
+.endif
+
+.else
+.endif # !defined(__MINIX)
+makedb:
+.endif
+
+.include <bsd.subdir.mk>
--- /dev/null
+# $NetBSD: Makefile,v 1.71 2015/03/21 19:10:43 jmcneill Exp $
+# @(#)Makefile 8.1 (Berkeley) 6/5/93
+
+# missing: dump.5 plot.5
+
+# MINIX:
+MAN= \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ \
+ rc.conf.5 \
+ \
+ \
+ \
+
+
+#MLINKS+=capfile.5 termcap.5
+#MLINKS+=daily.5 daily.conf.5
+#MLINKS+=fs.5 inode.5
+#MLINKS+=hosts.equiv.5 rhosts.5
+#MLINKS+=monthly.5 monthly.conf.5
+#MLINKS+=resolv.conf.5 resolver.5
+#MLINKS+=utmp.5 wtmp.5 utmp.5 lastlog.5 passwd.5 master.passwd.5
+#MLINKS+=utmpx.5 wtmpx.5 utmpx.5 lastlogx.5
+#MLINKS+=weekly.5 weekly.conf.5
+
+.include <bsd.man.mk>
+.include <bsd.subdir.mk>
--- /dev/null
+.\" $NetBSD: rc.conf.5,v 1.162 2015/10/09 19:49:25 plunky Exp $
+.\"
+.\" Copyright (c) 1996 Matthew R. Green
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" Copyright (c) 1997 Curt J. Sampson
+.\" Copyright (c) 1997 Michael W. Long
+.\" Copyright (c) 1998-2010 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This document is derived from works contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.Dd July 9, 2015
+.Dt RC.CONF 5
+.Os
+.Sh NAME
+.Nm rc.conf
+.Nd system startup configuration file
+.Sh DESCRIPTION
+The
+.Nm
+file specifies which services are enabled during system startup by
+the startup scripts invoked by
+.Pa /etc/rc
+(see
+.Xr rc 8 ) ,
+and the shutdown scripts invoked by
+.Pa /etc/rc.shutdown .
+The
+.Nm
+file is a shell script that is sourced by
+.Xr rc 8 ,
+meaning that
+.Nm
+must contain valid shell commands.
+.Pp
+Listed below are the standard
+.Nm
+variables that may be set, the values to which each may be set,
+a brief description of what each variable does, and a reference to
+relevant manual pages.
+Third party packages may test for additional variables.
+.Pp
+By default,
+.Nm
+reads
+.Pa /etc/defaults/rc.conf
+(if it is readable)
+to obtain default values for various variables, and the end-user
+may override these by appending appropriate entries to the end of
+.Nm .
+.Pp
+.Xr rc.d 8
+scripts that use
+.Ic load_rc_config
+from
+.Xr rc.subr 8
+also support sourcing an optional end-user provided per-script override
+file
+.Pa /etc/rc.conf.d/ Ns Ar service ,
+(where
+.Ar service
+is the contents of the
+.Sy name
+variable in the
+.Xr rc.d 8
+script).
+This may contain variable overrides, including allowing the end-user
+to override various
+.Ic run_rc_command
+.Xr rc.d 8
+control variables, and thus changing the operation of the script
+without requiring editing of the script.
+.Ss Variable naming conventions and data types
+Most variables are one of two types: enabling variables or flags
+variables.
+Enabling variables, such as
+.Sy inetd ,
+are generally named after the program or the system they enable,
+and have boolean values (specified using
+.Sq Ic YES ,
+.Sq Ic TRUE ,
+.Sq Ic ON
+or
+.Sq Ic 1
+for true, and
+.Sq Ic NO ,
+.Sq Ic FALSE ,
+.Sq Ic OFF
+or
+.Sq Ic 0
+for false, with the values being case insensitive).
+Flags variables, such as
+.Sy inetd_flags
+have the same name with "_flags" appended, and determine what
+arguments are passed to the program if it is enabled.
+.Pp
+If a variable that
+.Xr rc 8
+expects to be set is not set, or the value is not one of the allowed
+values, a warning will be printed.
+.Ss Overall control
+.Bl -tag -width net_interfaces
+.It Sy do_rcshutdown
+Boolean value.
+If false,
+.Xr shutdown 8
+will not run
+.Pa /etc/rc.shutdown .
+.It Sy rcshutdown_rcorder_flags
+A string.
+Extra arguments to the
+.Xr rcorder 8
+run by
+.Pa /etc/rc.shutdown .
+.It Sy rcshutdown_timeout
+A number.
+If non-blank, use this as the number of seconds to run a watchdog timer for
+which will terminate
+.Pa /etc/rc.shutdown
+if the timer expires before the shutdown script completes.
+.It Sy rc_configured
+Boolean value.
+If false then the system will drop into single-user mode during boot.
+.It Sy rc_fast_and_loose
+If set to a non-empty string,
+each script in
+.Pa /etc/rc.d
+will be executed in the current shell rather than a sub shell.
+This may be faster on slow machines that have an expensive
+.Xr fork 2
+operation.
+.Bl -hang
+.It Em Note :
+Use this at your own risk!
+A rogue command or script may inadvertently prevent boot to multiuser.
+.El
+.It Sy rc_rcorder_flags
+A string.
+Extra arguments to the
+.Xr rcorder 8
+run by
+.Pa /etc/rc .
+.It Sy rc_directories
+A string.
+Space separated list of directories searched for rc scripts.
+The default is
+.Pa /etc/rc.d .
+All directories in
+.Ev rc_directories
+must be located in the root file system, otherwise they will be silently
+skipped.
+.It Sy rc_silent
+Boolean value.
+If true then the usual output is suppressed, and
+.Xr rc 8
+invokes the command specified in the
+.Va rc_silent_cmd
+variable once for each line of suppressed output.
+The default value of
+.Va rc_silent
+is set from the
+.Dv AB_SILENT
+flag in the kernel's
+.Va boothowto
+variable (see
+.Xr boot 8 ,
+.Xr reboot 2 ) .
+.It Sy rc_silent_cmd
+A command to be executed once per line of suppressed output, when
+.Va rc_silent
+is true.
+The default value of
+.Va rc_silent_cmd
+is
+.Dq twiddle ,
+which will display a spinning symbol instead of each line of output.
+Another useful value is
+.Dq \&: ,
+which will display nothing at all.
+.El
+.Ss Basic network configuration
+.Bl -tag -width net_interfaces
+.It Sy defaultroute
+A string.
+Default IPv4 network route.
+If empty or not set, then the contents of
+.Pa /etc/mygate
+(if it exists) are used.
+.It Sy defaultroute6
+A string.
+Default IPv6 network route.
+If empty or not set, then the contents of
+.Pa /etc/mygate6
+(if it exists) are used.
+.It Sy domainname
+A string.
+.Tn NIS
+(YP) domain of host.
+If empty or not set, then the contents of
+.Pa /etc/defaultdomain
+(if it exists) are used.
+.It Sy force_down_interfaces
+A space separated list of interface names.
+These interfaces will be configured down when going from multiuser to single-user
+mode or on system shutdown.
+.Pp
+This is important for some stateful interfaces, for example PPP over ISDN
+connections that cost money by connection time or PPPoE interfaces which
+have no direct means of noticing
+.Dq disconnect
+events.
+.Pp
+All active
+.Xr pppoe 4
+and
+.Xr ippp 4
+interfaces will be automatically added to this list.
+.It Sy hostname
+A string.
+Name of host.
+If empty or not set, then the contents of
+.Pa /etc/myname
+(if it exists) are used.
+.El
+.Ss Boottime file-system and swap configuration
+.Bl -tag -width net_interfaces
+.It Sy critical_filesystems_local
+A string.
+File systems mounted very early in the system boot before networking
+services are available.
+Usually
+.Pa /var
+is part of this, because it is needed by services such as
+.Xr dhclient 8
+which may be required to get the network operational.
+The default is
+.Dq "OPTIONAL:/var" ,
+where the
+.Dq "OPTIONAL:"
+prefix means that it's not an error if the file system is not
+present in
+.Xr fstab 5 .
+.It Sy critical_filesystems_remote
+A string.
+File systems such as
+.Pa /usr
+that may require network services to be available to mount,
+that must be available early in the system boot for general services to use.
+The default is
+.Dq "OPTIONAL:/usr" ,
+where the
+.Dq "OPTIONAL:"
+prefix means that it is not an error if the file system is not
+present in
+.Xr fstab 5 .
+.It Sy fsck_flags
+A string.
+A file system is checked with
+.Xr fsck 8
+during boot before mounting it.
+This option may be used to override the default command-line options
+passed to the
+.Xr fsck 8
+program.
+.Pp
+When set to
+.Fl y ,
+.Xr fsck 8
+assumes yes as the answer to all operator questions during file system checks.
+This might be important with hosts where the administrator does not have
+access to the console and an unsuccessful shutdown must not make the host
+unbootable even if the file system checks would fail in preen mode.
+.It Sy no_swap
+Boolean value.
+Should be true if you have deliberately configured your system with no swap.
+If false and no swap devices are configured, the system will warn you.
+.It Sy resize_root
+Boolean value.
+Set to true to have the system resize the root file system to fill its
+partition.
+Will only attempt to resize the root file system if it is of type ffs and does
+not have logging enabled.
+Defaults to false.
+.It Sy swapoff
+Boolean value.
+Remove block-type swap devices at shutdown time.
+Useful if swapping onto RAIDframe devices.
+.El
+.Ss Block device subsystems
+.Bl -tag -width net_interfaces
+.It Sy ccd
+Boolean value.
+Configures concatenated disk devices according to
+.Xr ccd.conf 5 .
+.It Sy cgd
+Boolean value.
+Configures cryptographic disk devices.
+Requires
+.Pa /etc/cgd/cgd.conf .
+See
+.Xr cgdconfig 8
+for additional details.
+.It Sy lvm
+Boolean value.
+Configures the logical volume manager.
+See
+.Xr lvm 8
+for additional details.
+.It Sy raidframe
+Boolean value.
+Configures
+.Xr raid 4 ,
+RAIDframe disk devices.
+See
+.Xr raidctl 8
+for additional details.
+.El
+.Ss One-time actions to perform or programs to run on boot-up
+.Bl -tag -width net_interfaces
+.It Sy accounting
+Boolean value.
+Enables process accounting with
+.Xr accton 8 .
+Requires
+.Pa /var/account/acct
+to exist.
+.It Sy clear_tmp
+Boolean value.
+Clear
+.Pa /tmp
+after reboot.
+.It Sy dmesg
+Boolean value.
+Create
+.Pa /var/run/dmesg.boot
+from the output of
+.Xr dmesg 8 .
+Passes
+.Sy dmesg_flags .
+.It Sy envsys
+Boolean value.
+Sets preferences for the environmental systems framework,
+.Xr envsys 4 .
+Requires
+.Pa /etc/envsys.conf ,
+which is described in
+.Xr envsys.conf 5 .
+.It Sy gpio
+Boolean value.
+Configure
+.Xr gpio 4
+devices.
+See
+.Xr gpio.conf 5 .
+.It Sy ldconfig
+Boolean value.
+Configures
+.Xr a.out 5
+runtime link editor directory cache.
+.It Sy mixerctl
+Boolean value.
+Read
+.Xr mixerctl.conf 5
+for how to set mixer values.
+List in
+.Sy mixerctl_mixers
+the devices whose settings are to be saved at shutdown and
+restored at start-up.
+.It Sy newsyslog
+Boolean value.
+Run
+.Nm newsyslog
+to trim log files before syslogd starts.
+Intended for laptop users.
+Passes
+.Sy newsyslog_flags .
+.It Sy per_user_tmp
+Boolean value.
+Enables a per-user
+.Pa /tmp
+directory.
+.Sy per_user_tmp_dir
+can be used to override the default location of the
+.Dq real
+temporary directories,
+.Dq Pa /private/tmp .
+See
+.Xr security 7
+for additional details.
+.It Sy quota
+Boolean value.
+Checks and enables quotas by running
+.Xr quotacheck 8
+and
+.Xr quotaon 8 .
+.It Sy random_seed
+Boolean value.
+During boot-up, runs the
+.Xr rndctl 8
+utility with the
+.Fl L
+flag to seed the random number subsystem from an entropy file.
+During shutdown, runs the
+.Xr rndctl 8
+utility with the
+.Fl S
+flag to save some random information to the entropy file.
+The entropy file name is specified by the
+.Sy random_file
+variable, and defaults to
+.Pa /var/db/entropy-file .
+The entropy file must be on a local file system that is writable early during
+boot-up (just after the file systems specified in
+.Sy critical_filesystems_local
+have been mounted), and correspondingly late during shutdown.
+.It Sy rndctl
+Boolean value.
+Runs the
+.Xr rndctl 8
+utility one or more times according to the specification in
+.Sy rndctl_flags .
+.Pp
+If
+.Sy rndctl_flags
+does not contain a semicolon
+.Pq Ql \&;
+then it is expected to contain zero or more flags,
+followed by one or more device or type names.
+The
+.Xr rndctl 8
+command will be executed once for each device or type name.
+If the specified flags do not include any of
+.Fl c , C , e ,
+or
+.Fl E ,
+then the flags
+.Fl c
+and
+.Fl e
+are added, to specify that entropy from the relevant device or type
+should be both collected and estimated.
+If the specified flags do not include either of
+.Fl d
+or
+.Fl t ,
+then the flag
+.Fl d
+is added, to specify that the non-flag arguments are device names,
+not type names.
+.Pp
+.Sy rndctl_flags
+may contain multiple semicolon-separated segments, in which each
+segment contains flags and device or type names as described above.
+This allows different flags to be associated with different
+device or type names.
+For example, given
+.Li rndctl_flags="wd0 wd1; -t tty; -c -t net" ,
+the following commands will be executed:
+.Li "rndctl -c -e -d wd0" ;
+.Li "rndctl -c -e -d wd1" ;
+.Li "rndctl -c -e -t tty" ;
+.Li "rndctl -c -t net" .
+.It Sy rtclocaltime
+Boolean value.
+Sets the real time clock to local time by adjusting the
+.Xr sysctl 7
+value of
+.Pa kern.rtc_offset .
+The offset from UTC is calculated automatically according
+to the time zone information in the file
+.Pa /etc/localtime .
+.It Sy savecore
+Boolean value.
+Runs the
+.Xr savecore 8
+utility.
+Passes
+.Sy savecore_flags .
+The directory where crash dumps are stored is specified by
+.Sy savecore_dir .
+The default setting is
+.Dq Pa /var/crash .
+.It Sy sysdb
+Boolean value.
+Builds various system databases, including
+.Pa /var/run/dev.cdb ,
+.Pa /etc/spwd.db ,
+.Pa /var/db/netgroup.db ,
+.Pa /var/db/services.cdb ,
+and entries for
+.Xr utmp 5 .
+.It Sy tpctl
+Boolean value.
+Run
+.Xr tpctl 8
+to calibrate touch panel device.
+Passes
+.Sy tpctl_flags .
+.It Sy update_motd
+Boolean value.
+Updates the
+.Nx
+version string in the
+.Pa /etc/motd
+file to reflect the version of the running kernel.
+See
+.Xr motd 5 .
+.It Sy virecover
+Boolean value.
+Send notification mail to users if any recoverable files exist in
+.Pa /var/tmp/vi.recover .
+Read
+.Xr virecover 8
+for more information.
+.It Sy wdogctl
+Boolean value.
+Configures watchdog timers.
+Passes
+.Sy wdogctl_flags .
+Refer to
+.Xr wdogctl 8
+for information on how to configure a timer.
+.El
+.Ss System security settings
+.Bl -tag -width net_interfaces
+.It Sy securelevel
+A number.
+The system securelevel is set to the specified value early
+in the boot process, before any external logins, or other programs
+that run users job, are started.
+If set to nothing, the default action is taken, as described in
+.Xr init 8
+and
+.Xr secmodel_securelevel 9 ,
+which contains definitive information about the system securelevel.
+Note that setting
+.Sy securelevel
+to 0 in
+.Nm
+will actually result in the system booting with securelevel set to 1, as
+.Xr init 8
+will raise the level when
+.Xr rc 8
+completes.
+.It Sy permit_nonalpha
+Boolean value.
+Allow passwords to include non-alpha characters, usually to allow
+NIS/YP netgroups.
+.It Sy veriexec
+Boolean value.
+Load Veriexec fingerprints during startup.
+Read
+.Xr veriexecctl 8
+for more information.
+.It Sy veriexec_strict
+A number.
+Controls the strict level of Veriexec.
+Level 0 is learning mode, used when building the signatures file.
+It will only output messages but will not enforce anything.
+Level 1 will only prevent access to files with a fingerprint
+mismatch.
+Level 2 will also deny writing to and removing of
+monitored files, as well as enforce access type (as specified in
+the signatures file).
+Level 3 will take a step further and prevent
+access to files that are not monitored.
+.It Sy veriexec_verbose
+A number.
+Controls the verbosity of Veriexec.
+Recommended operation is at level 0, verbose output (mostly used when
+building the signatures file) is at level 1.
+Level 2 is for debugging only and should not be used.
+.It Sy veriexec_flags
+A string.
+Flags to pass to the
+.Nm veriexecctl
+command.
+.El
+.Ss Networking startup
+.Bl -tag -width net_interfaces
+.It Sy altqd
+Boolean value.
+ALTQ configuration/monitoring daemon.
+Passes
+.Sy altqd_flags .
+.It Sy auto_ifconfig
+Boolean value.
+Sets the
+.Sy net_interfaces
+variable (see below) to the output of
+.Xr ifconfig 8
+with the
+.Dq Li -l
+flag and suppresses warnings about interfaces in this list that
+do not have an ifconfig file or variable.
+.It Sy dhclient
+Boolean value.
+Set true to configure some or all network interfaces using
+the ISC DHCP client.
+If you set
+.Sy dhclient
+true, then
+.Pa /var
+must be in
+.Sy critical_filesystems_local ,
+or
+.Pa /var
+must be on the root file system,
+or you must modify the
+.Sy dhclient_flags
+variable to direct the DHCP client to store the leases file
+in some other directory on the root file system.
+You must not provide ifconfig information or ifaliases
+information for any interface that is to be configured using the DHCP client.
+Interface aliases can be set up in the DHCP client configuration
+file if needed - see
+.Xr dhclient.conf 5
+for details.
+.Pp
+Passes
+.Sy dhclient_flags
+to the DHCP client.
+See
+.Xr dhclient 8
+for complete documentation.
+If you wish to configure all broadcast
+network interfaces using the DHCP client, you can leave this blank.
+To configure only specific interfaces, name the interfaces to be configured
+on the command line.
+.Pp
+If you must run the DHCP client before mounting critical file systems,
+then you should specify an alternate location for the DHCP client's lease
+file in the
+.Sy dhclient_flags
+variable - for example, "-lf /tmp/dhclient.leases".
+.It Sy dhcpcd
+Boolean value.
+Set true to configure some or all network interfaces using dhcpcd.
+If you set
+.Sy dhcpcd
+true, then
+.Pa /var
+must be in
+.Sy critical_filesystems_local ,
+or
+.Pa /var
+must be on the root file system.
+If you need to restrict dhcpcd to one or a number of interfaces,
+or need a separate configuration per interface,
+then this should be done in the configuration file - see
+.Xr dhcpcd.conf 5
+for details.
+dhcpcd presently ignores the
+.Sy wpa_supplicant
+variable in rc.conf and will start wpa_supplicant if a suitable
+wpa_supplicant.conf is found unless otherwise instructed in
+.Xr dhcpcd.conf 5 .
+.It Sy dhcpcd_flags
+Passes
+.Sy dhcpcd_flags
+to dhcpcd.
+See
+.Xr dhcpcd 8
+for complete documentation.
+.It Sy flushroutes
+Boolean value.
+Flushes the route table on networking startup.
+Useful when coming up to multiuser mode after going down to
+single-user mode.
+.It Sy ftp_proxy
+Boolean value.
+Runs
+.Xr ftp-proxy 8 ,
+the proxy daemon for the Internet File Transfer Protocol.
+.It Sy hostapd
+Boolean value.
+Runs
+.Xr hostapd 8 ,
+the authenticator for IEEE 802.11 networks.
+.It Sy ifaliases_*
+A string.
+List of
+.Sq Em "address netmask"
+pairs to configure additional network addresses for the given
+configured interface
+.Dq *
+(e.g.
+.Sy ifaliases_le0 ) .
+If
+.Em netmask
+is
+.Dq - ,
+then use the default netmask for the interface.
+.Pp
+.Sy ifaliases_*
+covers limited cases only and is considered unrecommended.
+We recommend using
+.Sy ifconfig_nnX
+variables or
+.Pa /etc/ifconfig.xxN
+files with multiple lines instead.
+.It Sy ifwatchd
+Boolean value.
+Monitor dynamic interfaces and perform actions upon address changes.
+Passes
+.Sy ifwatchd_flags .
+.It Sy ip6mode
+A string.
+An IPv6 node can be a router
+.Pq nodes that forward packet for others
+or a host
+.Pq nodes that do not forward .
+A host can be autoconfigured
+based on the information advertised by adjacent IPv6 routers.
+By setting
+.Sy ip6mode
+to
+.Dq Li router ,
+.Dq Li host ,
+or
+.Dq Li autohost ,
+you can configure your node as a router,
+a non-autoconfigured host, or an autoconfigured host.
+Invalid values will be ignored, and the node will be configured as
+a non-autoconfigured host.
+You may want to check
+.Sy rtsol
+and
+.Sy rtsold
+as well, if you set the variable to
+.Dq Li autohost .
+.It Sy ip6uniquelocal
+Boolean value.
+If
+.Sy ip6mode
+is equal to
+.Dq Li router ,
+and
+.Sy ip6uniquelocal
+is false,
+a reject route will be installed on boot to avoid misconfiguration relating
+to unique-local addresses.
+If
+.Sy ip6uniquelocal
+is true, the reject route won't be installed.
+.It Sy ipfilter
+Boolean value.
+Runs
+.Xr ipf 8
+to load in packet filter specifications from
+.Pa /etc/ipf.conf
+at network boot time, before any interfaces are configured.
+Passes
+.Sy ipfilter_flags .
+See
+.Xr ipf.conf 5 .
+.It Sy ipfs
+Boolean value.
+Runs
+.Xr ipfs 8
+to save and restore information for ipnat and ipfilter state tables.
+The information is stored in
+.Pa /var/db/ipf/ipstate.ipf
+and
+.Pa /var/db/ipf/ipnat.ipf .
+Passes
+.Sy ipfs_flags .
+.It Sy ipmon
+Boolean value.
+Runs
+.Xr ipmon 8
+to read
+.Xr ipf 8
+packet log information and log it to a file or the system log.
+Passes
+.Sy ipmon_flags .
+.It Sy ipmon_flags
+A string.
+Specifies arguments to supply to
+.Xr ipmon 8 .
+Defaults to
+.Dq Li -ns .
+A typical example would be
+.Dq Fl nD Pa /var/log/ipflog
+to have
+.Xr ipmon 8
+log directly to a file bypassing
+.Xr syslogd 8 .
+If the
+.Dq -D
+argument is used, remember to modify
+.Pa /etc/newsyslog.conf
+accordingly; for example:
+.Bd -literal
+/var/log/ipflog 640 10 100 * Z /var/run/ipmon.pid
+.Ed
+.It Sy ipnat
+Boolean value.
+Runs
+.Xr ipnat 8
+to load in the IP network address translation (NAT) rules from
+.Pa /etc/ipnat.conf
+at network boot time, before any interfaces are configured.
+See
+.Xr ipnat.conf 5 .
+.It Sy ipsec
+Boolean value.
+Runs
+.Xr setkey 8
+to load in IPsec manual keys and policies from
+.Pa /etc/ipsec.conf
+at network boot time, before any interfaces are configured.
+.It Sy net_interfaces
+A string.
+The list of network interfaces to be configured at boot time.
+For each interface "xxN", the system first looks for ifconfig
+parameters in the variable
+.Sy ifconfig_xxN ,
+and then in the file
+.Pa /etc/ifconfig.xxN .
+If
+.Sy auto_ifconfig
+is false, and neither the variable nor the file is found,
+a warning is printed.
+Information in either the variable or the file is parsed identically,
+except that, if an
+.Sy ifconfig_xxN
+variable contains a single line with embedded semicolons,
+then the value is split into multiple lines prior to further parsing,
+treating the semicolon as a line separator.
+.Pp
+One common case it to set the
+.Sy ifconfig_xxN
+variable to a set of arguments to be passed to an
+.Xr ifconfig 8
+command after the interface name.
+Refer to
+.Xr ifconfig.if 5
+for more details on
+.Pa /etc/ifconfig.xxN
+files, and note that the information there also applies to
+.Sy ifconfig_xxN
+variables (after the variables are split into lines).
+.It Sy ntpdate
+Boolean value.
+Runs
+.Xr ntpdate 8
+to set the system time from one of the hosts in
+.Sy ntpdate_hosts .
+If
+.Sy ntpdate_hosts
+is empty, it will attempt to find a list of hosts in
+.Pa /etc/ntp.conf .
+Passes
+.Sy ntpdate_flags .
+.It Sy pf
+Boolean value.
+Enable
+.Xr pf 4
+at network boot time:
+Load the initial configuration
+.Xr pf.boot.conf 5
+before the network is up.
+After the network has been configured, then load the final rule set
+.Xr pf.conf 5 .
+.It Sy pf_rules
+A string.
+The path of the
+.Xr pf.conf 5
+rule set that will be used when loading the final rule set.
+.It Sy pflogd
+Boolean value.
+Run
+.Xr pflogd 8
+for dumping packet filter logging information to a file.
+.It Sy ppp
+A boolean.
+Toggles starting
+.Xr pppd 8
+on startup.
+See
+.Sy ppp_peers
+below.
+.It Sy ppp_peers
+A string.
+If
+.Sy ppp
+is true and
+.Sy ppp_peers
+is not empty, then
+.Pa /etc/rc.d/ppp
+will check each word in
+.Sy ppp_peers
+for a corresponding ppp configuration file in
+.Pa /etc/ppp/peers
+and will call
+.Xr pppd 8
+with the
+.Dq call Sy peer
+option.
+.It Sy racoon
+Boolean value.
+Runs
+.Xr racoon 8 ,
+the IKE (ISAKMP/Oakley) key management daemon.
+.It Sy rtsol
+Boolean value.
+Run
+.Xr rtsol 8 ,
+router solicitation command for IPv6 hosts.
+On nomadic hosts like notebook computers, you may want to enable
+.Sy rtsold
+as well.
+Passes
+.Sy rtsol_flags .
+This is only for autoconfigured IPv6 hosts, so set
+.Sy ip6mode
+to
+.Dq Li autohost
+if you use it.
+.It Sy wpa_supplicant
+Boolean value.
+Run
+.Xr wpa_supplicant 8 ,
+WPA/802.11i Supplicant for wireless network devices.
+If you set
+.Sy wpa_supplicant
+true, then
+.Pa /usr
+must be in
+.Sy critical_filesystems_local ,
+or
+.Pa /usr
+must be on the root file system.
+dhcpcd ignores this variable, see the
+.Sy dhcpcd
+variable for details.
+.El
+.Ss Daemons required by other daemons
+.Bl -tag -width net_interfaces
+.It Sy inetd
+Boolean value.
+Runs the
+.Xr inetd 8
+daemon to start network server processes (as listed in
+.Pa /etc/inetd.conf )
+as necessary.
+Passes
+.Sy inetd_flags .
+The
+.Dq Li -l
+flag turns on libwrap connection logging.
+.It Sy rpcbind
+Boolean value.
+The
+.Xr rpcbind 8
+daemon is required for any
+.Xr rpc 3
+services.
+These include NFS,
+.Tn NIS ,
+.Xr rpc.bootparamd 8 ,
+.Xr rpc.rstatd 8 ,
+.Xr rpc.rusersd 8 ,
+and
+.Xr rpc.rwalld 8 .
+Passes
+.Sy rpcbind_flags .
+.El
+.Ss Commonly used daemons
+.Bl -tag -width net_interfaces
+.It Sy cron
+Boolean value.
+Run
+.Xr cron 8 .
+.It Sy ftpd
+Boolean value.
+Runs the
+.Xr ftpd 8
+daemon and passes
+.Sy ftpd_flags .
+.It Sy httpd
+Boolean value.
+Runs the
+.Xr httpd 8
+daemon and passes
+.Sy httpd_flags .
+.It Sy httpd_wwwdir
+A string.
+The
+.Xr httpd 8
+WWW root directory.
+Used only if
+.Sy httpd
+is true.
+The default setting is
+.Dq Pa /var/www .
+.It Sy httpd_wwwuser
+A string.
+If non-blank and
+.Sy httpd
+is true, run
+.Xr httpd 8
+and cause it to switch to the specified user after initialization.
+It is preferred to
+.Sy httpd_user
+because
+.Xr httpd 8
+is requiring extra privileges to start listening on default port 80.
+The default setting is
+.Dq Dv _httpd .
+.It Sy lpd
+Boolean value.
+Runs
+.Xr lpd 8
+and passes
+.Sy lpd_flags .
+The
+.Dq Li -l
+flag will turn on extra logging.
+.It Sy mdnsd
+Boolean value.
+Runs
+.Xr mdnsd 8 .
+.It Sy named
+Boolean value.
+Runs
+.Xr named 8
+and passes
+.Sy named_flags .
+.It Sy named_chrootdir
+A string.
+If non-blank and
+.Sy named
+is true, run
+.Xr named 8
+as the unprivileged user and group
+.Sq named ,
+.Xr chroot 2 Ns ed
+to
+.Sy named_chrootdir .
+.Sy named_chrootdir Ns Pa /var/run/log
+will be added to the list of log sockets that
+.Xr syslogd 8
+listens to.
+.It Sy ntpd
+Boolean value.
+Runs
+.Xr ntpd 8
+and passes
+.Sy ntpd_flags .
+.It Sy ntpd_chrootdir
+A string.
+If non-blank and
+.Sy ntpd
+is true, run
+.Xr ntpd 8
+as the unprivileged user and group
+.Sq ntpd ,
+.Xr chroot 2 Ns ed
+to
+.Sy ntpd_chrootdir .
+.Sy ntpd_chrootdir Ns Pa /var/run/log
+will be added to the list of log sockets that
+.Xr syslogd 8
+listens to.
+This option requires that the kernel has
+.Dl pseudo-device clockctl
+compiled in, and that
+.Pa /dev/clockctl
+is present.
+.It Sy postfix
+Boolean value.
+Starts
+.Xr postfix 1
+mail system.
+.It Sy sshd
+Boolean value.
+Runs
+.Xr sshd 8
+and passes
+.Sy sshd_flags .
+.It Sy syslogd
+Boolean value.
+Runs
+.Xr syslogd 8
+and passes
+.Sy syslogd_flags .
+.It Sy timed
+Boolean value.
+Runs
+.Xr timed 8
+and passes
+.Sy timed_flags .
+The
+.Dq Li -M
+option allows
+.Xr timed 8
+to be a master time source as well as a slave.
+If you are also running
+.Xr ntpd 8 ,
+only one machine running both should have the
+.Dq Li -M
+flag given to
+.Xr timed 8 .
+.El
+.Ss Routing daemons
+.Bl -tag -width net_interfaces
+.It Sy mrouted
+Boolean value.
+Runs
+.Xr mrouted 8 ,
+the DVMRP multicast routing protocol daemon.
+Passes
+.Sy mrouted_flags .
+.It Sy route6d
+Boolean value.
+Runs
+.Xr route6d 8 ,
+the RIPng routing protocol daemon for IPv6.
+Passes
+.Sy route6d_flags .
+.It Sy routed
+Boolean value.
+Runs
+.Xr routed 8 ,
+the RIP routing protocol daemon.
+Passes
+.Sy routed_flags .
+.\" This should be false
+.\" if
+.\" .Sy gated
+.\" is true.
+.It Sy rtsold
+Boolean value.
+Runs
+.Xr rtsold 8 ,
+the IPv6 router solicitation daemon.
+.Xr rtsold 8
+periodically transmits router solicitation packets
+to find IPv6 routers on the network.
+This configuration is mainly for nomadic hosts like notebook computers.
+Stationary hosts should work fine with just
+.Sy rtsol .
+Passes
+.Sy rtsold_flags .
+This is only for autoconfigured IPv6 hosts, so set
+.Sy ip6mode
+to
+.Dq Li autohost
+if you use it.
+.El
+.Ss Daemons used to boot other hosts over a network
+.Bl -tag -width net_interfaces
+.It Sy bootparamd
+Boolean value.
+Runs
+.Xr bootparamd 8 ,
+the boot parameter server, with
+.Sy bootparamd_flags
+as options.
+Used to boot
+.Nx
+and
+.Tn "SunOS 4.x"
+systems.
+.It Sy dhcpd
+Boolean value.
+Runs
+.Xr dhcpd 8 ,
+the Dynamic Host Configuration Protocol (DHCP) daemon,
+for assigning IP addresses to hosts and passing boot information.
+Passes
+.Sy dhcpd_flags .
+.It Sy dhcrelay
+Boolean value.
+Runs
+.Xr dhcrelay 8 .
+Passes
+.Sy dhcrelay_flags .
+.It Sy mopd
+Boolean value.
+Runs
+.Xr mopd 8 ,
+the
+.Tn DEC
+.Tn MOP
+protocol daemon; used for booting
+.Tn VAX
+and other
+.Tn DEC
+machines.
+Passes
+.Sy mopd_flags .
+.It Sy ndbootd
+Boolean value.
+Runs
+.Xr ndbootd 8 ,
+the Sun Network Disk (ND) Protocol server.
+Passes
+.Sy ndbootd_flags .
+.It Sy rarpd
+Boolean value.
+Runs
+.Xr rarpd 8 ,
+the reverse ARP daemon, often used to boot
+.Nx
+and Sun workstations.
+Passes
+.Sy rarpd_flags .
+.It Sy rbootd
+Boolean value.
+Runs
+.Xr rbootd 8 ,
+the
+.Tn HP
+boot protocol daemon; used for booting
+.Tn HP
+workstations.
+Passes
+.Sy rbootd_flags .
+.It Sy rtadvd
+Boolean value.
+Runs
+.Xr rtadvd 8 ,
+the IPv6 router advertisement daemon, which is used to advertise
+information about the subnet to IPv6 end hosts.
+Passes
+.Sy rtadvd_flags .
+This is only for IPv6 routers, so set
+.Sy ip6mode
+to
+.Dq Li router
+if you use it.
+.El
+.Ss X Window System daemons
+.Bl -tag -width net_interfaces
+.It Sy xdm
+Boolean value.
+Runs the
+.Xr xdm 1
+X display manager.
+These X daemons are available only with the optional X distribution of
+.Nx .
+.It Sy xfs
+Boolean value.
+Runs the
+.Xr xfs 1
+X11 font server, which supplies local X font files to X terminals.
+.El
+.Ss NIS (YP) daemons
+.Bl -tag -width net_interfaces
+.It Sy ypbind
+Boolean value.
+Runs
+.Xr ypbind 8 ,
+which lets
+.Tn NIS
+(YP) clients use information from a
+.Tn NIS
+server.
+Passes
+.Sy ypbind_flags .
+.It Sy yppasswdd
+Boolean value.
+Runs
+.Xr yppasswdd 8 ,
+which allows remote
+.Tn NIS
+users to update password on master server.
+Passes
+.Sy yppasswdd_flags .
+.It Sy ypserv
+Boolean value.
+Runs
+.Xr ypserv 8 ,
+the
+.Tn NIS
+(YP) server for distributing information from certain files in
+.Pa /etc .
+Passes
+.Sy ypserv_flags .
+The
+.Dq Li -d
+flag causes it to use DNS for lookups in
+.Pa /etc/hosts
+that fail.
+.El
+.Ss NFS daemons and parameters
+.Bl -tag -width net_interfaces
+.It Sy amd
+Boolean value.
+Runs
+.Xr amd 8 ,
+the automounter daemon, which automatically mounts NFS file systems
+whenever a file or directory within that file system is accessed.
+Passes
+.Sy amd_flags .
+.It Sy amd_dir
+A string.
+The
+.Xr amd 8
+mount directory.
+Used only if
+.Sy amd
+is true.
+.It Sy lockd
+Boolean value.
+Runs
+.Xr rpc.lockd 8
+if
+.Sy nfs_server
+and/or
+.Sy nfs_client
+are true.
+Passes
+.Sy lockd_flags .
+.It Sy mountd
+Boolean value.
+Runs
+.Xr mountd 8
+and passes
+.Sy mountd_flags .
+.It Sy nfs_client
+Boolean value.
+The number of local NFS asynchronous I/O server is now controlled via
+.Xr sysctl 8 .
+.It Sy nfs_server
+Boolean value.
+Sets up a host to be a NFS server by running
+.Xr nfsd 8
+and passing
+.Sy nfsd_flags .
+.It Sy statd
+Boolean value.
+Runs
+.Xr rpc.statd 8 ,
+a status monitoring daemon used when
+.Xr rpc.lockd 8
+is running, if
+.Sy nfs_server
+and/or
+.Sy nfs_client
+are true.
+Passes
+.Sy statd_flags .
+.El
+.Ss Bluetooth support
+.Bl -tag -width net_interfaces
+.It Sy bluetooth
+Boolean value.
+Configure Bluetooth support, comprising the following tasks:
+.Bl -dash -compact
+.It
+attach serial Bluetooth controllers as listed in the
+.Pa /etc/bluetooth/btattach.conf
+configuration file.
+.It
+enable Bluetooth controllers with useful defaults, plus
+additional options as detailed below.
+.It
+optionally, start
+.Xr bthcid 8 ,
+the Bluetooth Link Key/PIN Code manager, passing
+.Sy bthcid_flags .
+.It
+configure local Bluetooth drivers as listed in the
+.Pa /etc/bluetooth/btdevctl.conf
+configuration file.
+.It
+optionally, start
+.Xr sdpd 8 ,
+the Service Discovery server, passing
+.Sy sdpd_flags .
+.El
+.It Sy btconfig_devices
+A string.
+An optional list of Bluetooth controllers to configure.
+.It Sy btconfig_{dev}
+A string.
+Additional configuration options for specific Bluetooth controllers.
+.It Sy btconfig_args
+A string.
+Additional configuration options for Bluetooth controllers without
+specific options as above.
+.It Sy bthcid
+Boolean value.
+If set to false, disable starting the Bluetooth Link Key/PIN Code manager.
+.It Sy sdpd
+Boolean value.
+If set to false, disable starting the Bluetooth Service Discovery server.
+.El
+.Ss Other daemons
+.Bl -tag -width net_interfaces
+.It Sy identd
+Boolean value.
+Runs
+.Xr identd 8 ,
+the daemon for the user identification protocol.
+Passes
+.Sy identd_flags .
+.It Sy iscsi_target
+Boolean value.
+Runs the server for iSCSI requests,
+.Xr iscsi-target 8 .
+Passes
+.Sy iscsi_target_flags .
+.It Sy isdnd
+Boolean value.
+Runs
+.Xr isdnd 8 ,
+the isdn4bsd ISDN connection management daemon.
+Passes
+.Sy isdnd_flags .
+.It Sy isdn_autoupdown
+Boolean value.
+Set all configured ISDN interfaces to
+.Dq up .
+If
+.Sy isdn_interfaces
+is not blank, only the listed interfaces will be modified.
+Used only if
+.Sy isdnd
+is true.
+.It Sy kdc
+Boolean value.
+Runs the
+.Xr kdc 8
+Kerberos v4 and v5 server.
+This should be run on Kerberos master and slave servers.
+.It Sy rwhod
+Boolean value.
+Runs
+.Xr rwhod 8
+to support the
+.Xr rwho 1
+and
+.Xr ruptime 1
+commands.
+.El
+.Ss Hardware daemons
+.Bl -tag -width net_interfaces
+.It Sy apmd
+Boolean value.
+Runs
+.Xr apmd 8
+and passes
+.Sy apmd_flags .
+.It Sy irdaattach
+Boolean value.
+Runs
+.Xr irdaattach 8
+and passes
+.Sy irdaattach_flags .
+.It Sy moused
+Boolean value.
+Runs
+.Xr moused 8 ,
+to pass serial mouse data to the wscons mouse mux.
+Passes
+.Sy moused_flags .
+.It Sy screenblank
+Boolean value.
+Runs
+.Xr screenblank 1
+and passes
+.Sy screenblank_flags .
+.It Sy wscons
+Boolean value.
+Configures the
+.Xr wscons 4
+console driver, from the configuration file
+.Pa /etc/wscons.conf .
+.It Sy wsmoused
+Boolean value.
+Runs
+.Xr wsmoused 8 ,
+to provide copy and paste text support in wscons displays.
+Passes
+.Sy wsmoused_flags .
+.El
+.Sh FILES
+.Bl -tag -width /etc/defaults/rc.conf -compact
+.It Pa /etc/rc.conf
+The file
+.Nm
+resides in
+.Pa /etc .
+.It Pa /etc/defaults/rc.conf
+Default settings for
+.Nm ,
+sourced by
+.Nm
+before the end-user configuration section.
+.It Pa /etc/rc.conf.d/ Ns Ar foo
+.Ar foo Ns No -specific
+.Nm
+overrides.
+.El
+.Sh SEE ALSO
+.Xr boot 8 ,
+.Xr rc 8 ,
+.Xr rc.d 8 ,
+.Xr rc.subr 8 ,
+.Xr rcorder 8
+.Sh HISTORY
+The
+.Nm
+file appeared in
+.Nx 1.3 .
--- /dev/null
+# $NetBSD: Makefile,v 1.104 2014/02/24 07:23:41 skrll Exp $
+# from: @(#)Makefile 8.1 (Berkeley) 6/5/93
+
+# MINIX:
+MAN= \
+ \
+ \
+ \
+ rc.8 rc.subr.8 \
+ \
+
+#MLINKS+=MAKEDEV.8 makedev.8
+#MLINKS+=MAKEDEV.local.8 makedev.local.8
+#MLINKS+=compat_svr4.8 compat_sco.8
+#MLINKS+=compat_svr4.8 compat_solaris.8
+#MLINKS+=compat_svr4.8 compat_svr4_32.8
+#MLINKS+=compat_svr4.8 compat_xenix.8
+#MLINKS+=compat_netbsd32.8 netbsd32.8
+#MLINKS+=nis.8 yp.8
+MLINKS+=rc.8 rc.d.8
+MLINKS+=rc.8 rc.local.8
+MLINKS+=rc.8 rc.shutdown.8
+
+.if !defined(__MINIX)
+SUBDIR= man8.acorn26 man8.acorn32 man8.alpha man8.amiga man8.atari \
+ man8.cobalt man8.dreamcast man8.emips man8.evbarm \
+ man8.hp300 man8.hpcarm man8.hpcmips man8.hpcsh man8.hppa \
+ man8.mac68k man8.macppc \
+ man8.mvme68k man8.next68k man8.pmax man8.prep man8.sandpoint \
+ man8.sgimips man8.sparc man8.sparc64 man8.sun2 man8.sun3 \
+ man8.vax man8.x68k man8.x86
+
+# create MAKEDEV.8 from ../../etc/MAKEDEV.tmpl
+makedevs:
+ cd ${.CURDIR} && ${HOST_SH} MAKEDEV2manpage.sh
+.endif # !defined(__MINIX)
+
+.include <bsd.man.mk>
+.include <bsd.subdir.mk>
--- /dev/null
+.\" $NetBSD: rc.8,v 1.36 2010/05/14 16:19:58 jruoho Exp $
+.\"
+.\" Copyright (c) 2000-2004 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd May 14, 2010
+.Dt RC 8
+.Os
+.Sh NAME
+.Nm rc ,
+.Nm rc.local ,
+.Nm rc.shutdown ,
+.Nm rc.d/
+.Nd startup and shutdown scripts
+.Sh SYNOPSIS
+.Nm rc
+.Nm rc.local
+.Nm rc.shutdown
+.Nm rc.d/
+.Sh DESCRIPTION
+.Nm
+is the command script which controls the startup of various services,
+and is invoked by
+.Xr init 8
+as part of the process of entering the automatic reboot to multi-user startup,
+or after the single user mode shell has exited.
+If
+.Xr init 8
+is starting the automatic reboot process,
+.Nm
+is invoked with the argument of
+.Sq autoboot .
+.Pp
+.Nm rc.local
+is a command script to which local boot-time actions can be added.
+It is (nearly) the last thing invoked by
+.Nm rc
+during a normal boot.
+.Pp
+.Nm rc.shutdown
+is the command script which shuts down various services, and is invoked by
+.Xr shutdown 8
+as part of the process of shutting down the system.
+.Pp
+.Nm rc.d/
+is the directory which contains various
+.Xr sh 1
+scripts, one for each service,
+which are called by
+.Nm
+at startup,
+.Nm rc.shutdown
+at shutdown,
+and as necessary during system operation to stop, start, restart, reload,
+or otherwise control the service.
+.Ss Operation of rc
+.Bl -enum
+.It
+Source
+.Pa /etc/rc.subr
+to load various
+.Xr rc.subr 8
+shell functions to use.
+.It
+If autobooting, set
+.Sy autoboot=yes
+and enable a flag
+.Sy ( rc_fast=yes ) ,
+which prevents the
+.Nm rc.d
+scripts from performing the check for already running processes
+(thus speeding up the boot process).
+This
+.Sy rc_fast=yes
+speedup won't occur when
+.Nm
+is started up after exiting the single-user shell.
+.It
+Invoke
+.Xr rcorder 8
+to order the files in
+.Pa /etc/rc.d/
+that do not have a
+.Dq nostart
+keyword (refer to
+.Xr rcorder 8 Ns 's
+.Fl s
+flag),
+and assigns the result to a variable.
+.It
+Calls each script in turn using
+.Fn run_rc_script
+(from
+.Xr rc.subr 8 ) ,
+which sets
+.Dv $1
+to
+.Sq start ,
+and sources the script in a subshell.
+If the script has a
+.Sq .sh
+suffix then it is sourced directly into the current shell.
+.It
+The output from the above steps is sent to a post-processor.
+If
+.Sy rc_silent
+is false, then the post-processor displays the output.
+If
+.Sy rc_silent
+is true, then the post-processor invokes the command specified in
+.Va rc_silent_cmd
+once for each line, without otherwise displaying the output.
+Useful values for
+.Va rc_silent_cmd
+include
+.Dq \&:
+to display nothing at all, and
+.Dq twiddle
+to display a spinning symbol on the console.
+Regardless of the value of
+.Sy rc_silent ,
+the post-processor saves the output in
+.Pa /var/run/rc.log .
+.El
+.Ss Operation of rc.shutdown
+.Bl -enum
+.It
+Source
+.Pa /etc/rc.subr
+to load various
+.Xr rc.subr 8
+shell functions to use.
+.It
+Invoke
+.Xr rcorder 8
+to order the files in
+.Pa /etc/rc.d/
+that have a
+.Dq shutdown
+keyword (refer to
+.Xr rcorder 8 Ns 's
+.Fl k
+flag),
+reverses that order, and assigns the result to a variable.
+.It
+Calls each script in turn using
+.Fn run_rc_script
+(from
+.Xr rc.subr 8 ) ,
+which sets
+.Dv $1
+to
+.Sq stop ,
+and sources the script in a subshell.
+If the script has a
+.Sq .sh
+suffix then it is sourced directly into the current shell.
+.El
+.Ss Contents of rc.d/
+.Nm rc.d/
+is located in
+.Pa /etc/rc.d .
+The following file naming conventions are currently used in
+.Nm rc.d/ :
+.Bl -tag -width ALLUPPERCASExx -offset indent
+.It Pa ALLUPPERCASE
+Scripts that are
+.Sq placeholders
+to ensure that certain operations are performed before others.
+In order of startup, these are:
+.Bl -tag -width NETWORKINGxx
+.It Pa NETWORKING
+Ensure basic network services are running, including general
+network configuration
+.Pq Pa network
+and
+.Pa dhclient .
+.It Pa SERVERS
+Ensure basic services (such as
+.Pa NETWORKING ,
+.Pa ppp ,
+.Pa syslogd ,
+and
+.Pa kdc )
+exist for services that start early (such as
+.Pa named ) ,
+because they're required by
+.Pa DAEMON
+below.
+.It Pa DAEMON
+Before all general purpose daemons such as
+.Pa dhcpd ,
+.Pa lpd ,
+and
+.Pa ntpd .
+.It Pa LOGIN
+Before user login services
+.Pa ( inetd ,
+.Pa telnetd ,
+.Pa rshd ,
+.Pa sshd ,
+and
+.Pa xdm ) ,
+as well as before services which might run commands as users
+.Pa ( cron ,
+.Pa postfix ,
+and
+.Pa sendmail ) .
+.El
+.It Pa foo.sh
+Scripts that are to be sourced into the current shell rather than a subshell
+have a
+.Sq Pa .sh
+suffix.
+Extreme care must be taken in using this, as the startup sequence will
+terminate if the script does.
+.Pa /etc/rc.d/bootconf.sh
+uses this behaviour to allow the user to select a different
+configuration (including
+.Pa /etc/rc.conf )
+early in the boot.
+.It Pa bar
+Scripts that are sourced in a subshell.
+The boot does not stop if such a script terminates with a non-zero status,
+but a script can stop the boot if necessary by invoking the
+.Fn stop_boot
+function (from
+.Xr rc.subr 8 ) .
+.El
+.Pp
+Each script should contain
+.Xr rcorder 8
+keywords, especially an appropriate
+.Dq PROVIDE
+entry.
+.Pp
+The scripts are expected to support at least the following arguments:
+.Bl -tag -width restart -offset indent
+.It Sy start
+Start the service.
+This should check that the service is to be started as specified by
+.Xr rc.conf 5 .
+Also checks if the service is already running and refuses to start if
+it is.
+This latter check is not performed by standard
+.Nx
+scripts if the system is starting directly to multi-user mode, to
+speed up the boot process.
+.It Sy stop
+If the service is to be started as specified by
+.Xr rc.conf 5 ,
+stop the service.
+This should check that the service is running and complain if it's not.
+.It Sy restart
+Perform a
+.Sy stop
+then a
+.Sy start .
+.It Sy status
+If the script starts a process (rather than performing a one-off
+operation), show the status of the process.
+Otherwise it's not necessary to support this argument.
+Defaults to displaying the process ID of the program (if running).
+.It Sy poll
+If the script starts a process (rather than performing a one-off
+operation), wait for the command to exit.
+Otherwise it's not necessary to support this argument.
+.It Sy rcvar
+Display which
+.Xr rc.conf 5
+variables are used to control the startup of the service (if any).
+.El
+.Pp
+Other arguments (such as
+.Sq reload ,
+.Sq dumpdb ,
+etc) can be added if necessary.
+.Pp
+The argument may have one of the following prefixes to alter its operation:
+.Bl -tag -width "force" -offset indent
+.It Sy fast
+Skip the check for an existing running process.
+Sets
+.Sy rc_fast=yes .
+.It Sy force
+Skips the
+.Xr rc.conf 5
+check, ignores a failure result from any of the prerequisite checks,
+executes the command, and always returns a zero exit status.
+Sets
+.Sy rc_force=yes .
+.It Sy one
+Skips the
+.Xr rc.conf 5
+check, but performs all other prerequisite tests.
+.El
+.Pp
+In order to simplify scripts, the
+.Fn run_rc_command
+function from
+.Xr rc.subr 8
+may be used.
+.Sh FILES
+.Bl -tag -width /etc/rc.shutdown -compact
+.It Pa /etc/rc
+Startup script called by
+.Xr init 8 .
+.It Pa /etc/rc.d/
+Directory containing control scripts for each service.
+.It Pa /etc/rc.local
+Local startup script.
+.It Pa /etc/rc.shutdown
+Shutdown script called by
+.Xr shutdown 8 .
+.It Pa /etc/rc.subr
+Contains
+.Xr rc.subr 8
+functions used by various scripts.
+.It Pa /etc/rc.conf
+System startup configuration file.
+.It Pa /var/run/rc.log
+Log file created by
+.Nm .
+.El
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr init 8 ,
+.Xr rc.subr 8 ,
+.Xr rcorder 8 ,
+.Xr reboot 8 ,
+.Xr shutdown 8
+.Rs
+.%A Luke Mewburn
+.%T The Design and Implementation of the NetBSD rc.d system
+.%I USENIX Association
+.%B Proceedings of the FREENIX Track: 2001 USENIX Annual Technical Conference
+.%D June 25-30, 2001
+.%U http://www.usenix.org/publications/library/proceedings/usenix01/freenix01/full_papers/mewburn/mewburn.pdf
+.Re
+.Sh HISTORY
+The
+.Nm
+command appeared in
+.Bx 4.0 .
+The
+.Pa /etc/rc.d
+support was implemented in
+.Nx 1.5
+by
+.An Luke Mewburn
+.Aq lukem@NetBSD.org .
+The post-processor, support for
+.Va rc_silent ,
+and saving output to a file, was implemented in
+.Nx 6.0
+by
+.An Alan Barrett .
--- /dev/null
+.\" $NetBSD: rc.subr.8,v 1.31 2012/12/18 13:14:34 wiz Exp $
+.\"
+.\" Copyright (c) 2002-2011 The NetBSD Foundation, Inc.
+.\" All rights reserved.
+.\"
+.\" This code is derived from software contributed to The NetBSD Foundation
+.\" by Luke Mewburn.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd December 17, 2012
+.Dt RC.SUBR 8
+.Os
+.Sh NAME
+.Nm rc.subr
+.Nd functions used by system shell scripts
+.Sh SYNOPSIS
+.Bl -item
+.It
+.Li . /etc/rc.subr
+.It
+.Ic backup_file Ar action Ar file Ar current Ar backup
+.It
+.Ic basename Ar file Op Ar suffix
+.It
+.Ic checkyesno Ar var
+.It
+.Ic check_pidfile Ar pidfile Ar procname Op Ar interpreter
+.It
+.Ic check_process Ar procname Op Ar interpreter
+.It
+.Ic collapse_backslash_newline
+.It
+.Ic dirname Ar file
+.It
+.Ic err Ar exitval Ar message
+.It
+.Ic load_rc_config Ar command
+.It
+.Ic load_rc_config_var Ar command Ar var
+.It
+.Ic mount_critical_filesystems Ar type
+.It
+.Ic no_rc_postprocess Ar command Op Ar arguments
+.It
+.Ic print_rc_metadata Ar string
+.It
+.Ic print_rc_normal Oo Fl n Oc Ar string
+.It
+.Ic rc_usage Ar command Op Ar ...
+.It
+.Ic reverse_list Ar item Op Ar ...
+.It
+.Ic run_rc_command Ar argument [parameters]
+.It
+.Ic run_rc_script Ar file Ar argument
+.It
+.Ic stop_boot
+.It
+.Ic twiddle
+.It
+.Ic wait_for_pids Op Ar pid Op Ar ...
+.It
+.Ic warn Ar message
+.It
+.Ic yesno_to_truefalse Ar var
+.El
+.Sh DESCRIPTION
+.Nm
+contains commonly used shell script functions which are used by
+various scripts such as
+.Xr rc 8 ,
+and the periodic system services which are controlled by
+.Xr daily.conf 5 ,
+.Xr monthly.conf 5 ,
+.Xr security.conf 5 ,
+and
+.Xr weekly.conf 5 .
+.Pp
+The
+.Nm
+functions are accessed by sourcing
+.Pa /etc/rc.subr
+into the current shell.
+.Pp
+The following shell functions are available:
+.Bl -tag -width 4n
+.It Ic backup_file Ar action Ar file Ar current Ar backup
+Make a backup copy of
+.Ar file
+into
+.Ar current .
+If the
+.Xr rc.conf 5
+variable
+.Sy backup_uses_rcs
+is
+.Sq YES ,
+use
+.Xr rcs 1
+to archive the previous version of
+.Ar current ,
+otherwise save the previous version of
+.Ar current
+as
+.Ar backup .
+.Pp
+.Ar action
+may be one of the following:
+.Bl -tag -width remove
+.It Sy add
+.Ar file
+is now being backed up by or possibly re-entered into this backup mechanism.
+.Ar current
+is created, and if necessary, the
+.Xr rcs 1
+files are created as well.
+.It Sy update
+.Ar file
+has changed and needs to be backed up.
+If
+.Ar current
+exists, it is copied to
+.Ar backup
+or checked into
+.Xr rcs 1
+(if the repository file is old),
+and then
+.Ar file
+is copied to
+.Ar current .
+.It Sy remove
+.Ar file
+is no longer being tracked by this backup mechanism.
+If
+.Xr rcs 1
+is being used, an empty file is checked in and
+.Ar current
+is removed,
+otherwise
+.Ar current
+is moved to
+.Ar backup .
+.El
+.Ic basename Ar file Op Ar suffix
+Just like
+.Xr basename 1 ,
+except implemented using shell built-in commands, and usable before the
+.Pa /usr/bin
+direcory is available.
+.It Ic checkyesno Ar var
+Return 0 if
+.Ar var
+is defined to
+.Sq YES ,
+.Sq TRUE ,
+.Sq ON ,
+or
+.Sq 1 .
+Return 1 if
+.Ar var
+is defined to
+.Sq NO ,
+.Sq FALSE ,
+.Sq OFF ,
+or
+.Sq 0 .
+Otherwise, warn that
+.Ar var
+is not set correctly.
+The values are case insensitive.
+.Pp
+Note that the warning message shown by this function when
+.Ar var
+is not set references a manual page where the user can find more information.
+Its name is picked up from the
+.Sy rcvar_manpage
+variable.
+.It Ic check_pidfile Ar pidfile Ar procname Op Ar interpreter
+Parses the first word of the first line of
+.Ar pidfile
+for a PID, and ensures that the process with that PID
+is running and its first argument matches
+.Ar procname .
+Prints the matching PID if successful, otherwise nothing.
+If
+.Ar interpreter
+is provided, parse the first line of
+.Ar procname ,
+ensure that the line is of the form
+.Dl #! interpreter [...]
+and use
+.Ar interpreter
+with its optional arguments and
+.Ar procname
+appended as the process string to search for.
+.It Ic check_process Ar procname Op Ar interpreter
+Prints the PIDs of any processes that are running with a first
+argument that matches
+.Ar procname .
+.Ar interpreter
+is handled as per
+.Ic check_pidfile .
+.It Ic collapse_backslash_newline
+Copy input to output, collapsing
+.Ao backslash Ac Ns Ao newline Ac
+to nothing, but leaving other backslashes alone.
+.Ic dirname Ar file
+Just like
+.Xr dirname 1 ,
+except implemented using shell built-in commands, and usable before the
+.Pa /usr/bin
+direcory is available.
+.It Ic err Ar exitval Ar message
+Display an error message to
+.Em stderr ,
+log it to the system log
+using
+.Xr logger 1 ,
+and
+.Cm exit
+with an exit value of
+.Ar exitval .
+The error message consists of the script name
+(from
+.Sy $0 ) ,
+followed by
+.Dq ": ERROR: " ,
+and then
+.Ar message .
+.It Ic load_rc_config Ar command
+Source in the
+.Xr rc.conf 5
+configuration files for
+.Ar command .
+First,
+.Pa /etc/rc.conf
+is sourced if it has not yet been read in.
+Then,
+.Pa /etc/rc.conf.d/ Ns Ar command
+is sourced if it is an existing file.
+The latter may also contain other variable assignments to override
+.Ic run_rc_command
+arguments defined by the calling script, to provide an easy
+mechanism for an administrator to override the behaviour of a given
+.Xr rc.d 8
+script without requiring the editing of that script.
+.It Ic load_rc_config_var Ar command Ar var
+Read the
+.Xr rc.conf 5
+variable
+.Ar var
+for
+.Ar command
+and set in the current shell, using
+.Ic load_rc_config
+in a sub-shell to prevent unwanted side effects from other variable
+assignments.
+.It Ic mount_critical_filesystems Ar type
+Go through a list of critical file systems,
+as found in the
+.Xr rc.conf 5
+variable
+.Sy critical_filesystems_ Ns Ar type ,
+mounting each one that
+is not currently mounted.
+.It Ic no_rc_postprocess Ar command Op Ar arguments
+Execute the specified command with the specified arguments,
+in such a way that its output bypasses the post-processor that
+.Xr rc 8
+uses for most commands.
+This implies that the output will not appear in the
+.Pa /var/run/rc.log
+file, and will appear on the console regardless of the
+value of
+.Va rc_silent .
+This is expected to be useful for interactive commands,
+and this mechanism is automatically used by
+.Ic run_rc_command
+when a script contains the
+.Xr rcorder 8
+keyword
+.Dq interactive .
+.Pp
+If invoked from a context that does not appear to be under the control of
+.Xr rc 8 ,
+then the command is executed without special treatment.
+.It Ic print_rc_metadata Ar string
+Print the specified
+.Ar string
+in such a way that it should be handled as meta-data by the
+.Xr rc 8
+post-processor.
+If invoked from a context that does not appear to be under the control of
+.Xr rc 8 ,
+then the
+.Ar string
+is discarded.
+.Pp
+Any
+.Xr rc.d 8
+script may invoke this function with an argument that begins with
+.Dq note: ,
+followed by one line of arbitrary text;
+the text will be logged by
+.Xr rc 8
+but will not be displayed on the console.
+.Pp
+The use of arguments that do not begin with
+.Dq note:
+is reserved for internal use by
+.Xr rc 8
+and
+.Nm .
+.It Ic print_rc_normal Oo Fl n Oc Ar string
+Print the specified
+.Ar string
+in such a way that it should be handled as normal output by the
+.Xr rc 8
+post-processor.
+If invoked from a context that does not appear to be under the control of
+.Xr rc 8 ,
+then the
+.Ar string
+is printed to standard output.
+.Pp
+If the
+.Fl n
+flag is specified, then the string is printed without a newline.
+.Pp
+Intended use cases include:
+.Bl -bullet
+.It
+An rc.d script can use
+.Dq Sy print_rc_normal Fl n
+to print a partial line in such a way that it appears
+immediately instead of being buffered by
+.Xr rc 8 Ap s
+post-processor.
+.It
+An rc.d script that is run via the
+.Sy no_rc_postprocess
+function (so most of its output is invisible to
+.Xr rc 8 Ap s
+post-processor) can use
+.Sy print_rc_normal
+to force some of its output to be seen by the post-processor.
+.El
+.It Ic rc_usage Ar command Op Ar ...
+Print a usage message for
+.Sy $0 ,
+with
+.Ar commands
+being the list of valid arguments
+prefixed by
+.Dq "[fast|force|one]" .
+.It Ic reverse_list Ar item Op Ar ...
+Print the list of
+.Ar items
+in reverse order.
+.It Ic run_rc_command Ar argument Op Ar parameter ...
+Run the
+.Ar argument
+method for the current
+.Xr rc.d 8
+script, based on the settings of various shell variables.
+.Ic run_rc_command
+is extremely flexible, and allows fully functional
+.Xr rc.d 8
+scripts to be implemented in a small amount of shell code.
+The optional set of parameters is passed verbatim to the command, but not to its
+pre/post hooks.
+.Pp
+.Ar argument
+is searched for in the list of supported commands, which may be one
+of:
+.Bl -tag -width restart -offset indent
+.It Sy start
+Start the service.
+This should check that the service is to be started as specified by
+.Xr rc.conf 5 .
+Also checks if the service is already running and refuses to start if
+it is.
+This latter check is not performed by standard
+.Nx
+scripts if the system is starting directly to multi-user mode, to
+speed up the boot process.
+.It Sy stop
+If the service is to be started as specified by
+.Xr rc.conf 5 ,
+stop the service.
+This should check that the service is running and complain if it's not.
+.It Sy restart
+Perform a
+.Sy stop
+then a
+.Sy start .
+Defaults to displaying the process ID of the program (if running).
+.It Sy rcvar
+Display which
+.Xr rc.conf 5
+variables are used to control the startup of the service (if any).
+.El
+.Pp
+If
+.Sy pidfile
+or
+.Sy procname
+is set, also support:
+.Bl -tag -width restart -offset indent
+.It Sy poll
+Wait for the command to exit.
+.It Sy status
+Show the status of the process.
+.El
+.Pp
+Other supported commands are listed in the optional variable
+.Sy extra_commands .
+.Pp
+.Ar argument
+may have one of the following prefixes which alters its operation:
+.Bl -tag -width "Prefix" -offset indent
+.It Sy fast
+Skip the check for an existing running process,
+and sets
+.Sy rc_fast=YES .
+.It Sy force
+Skip the checks for
+.Sy rcvar
+being set to yes,
+and sets
+.Sy rc_force=YES .
+This ignores
+.Ar argument Ns Sy _precmd
+returning non-zero, and ignores any of the
+.Sy required_*
+tests failing, and always returns a zero exit status.
+.It Sy one
+Skip the checks for
+.Sy rcvar
+being set to yes, but performs all the other prerequisite tests.
+.El
+.Pp
+.Ic run_rc_command
+uses the following shell variables to control its behaviour.
+Unless otherwise stated, these are optional.
+.Bl -tag -width procname -offset indent
+.It Sy name
+The name of this script.
+This is not optional.
+.It Sy rcvar
+The value of
+.Sy rcvar
+is checked with
+.Ic checkyesno
+to determine if this method should be run.
+.It Sy rcvar_manpage
+The manual page containing information about
+.Sy rcvar .
+It will be part of the warning message shown when
+.Sy rcvar
+is undefined.
+Defaults to
+.Xr rc.conf 5 .
+.It Sy command
+Full path to the command.
+Not required if
+.Ar argument Ns Sy _cmd
+is defined for each supported keyword.
+.It Sy command_args
+Optional arguments and/or shell directives for
+.Sy command .
+.It Sy command_interpreter
+.Sy command
+is started with
+.Dl #! command_interpreter [...]
+which results in its
+.Xr ps 1
+command being
+.Dl command_interpreter [...] command
+so use that string to find the PID(s) of the running command
+rather than
+.Ql command .
+.It Sy extra_commands
+Extra commands/keywords/arguments supported.
+.It Sy pidfile
+Path to pid file.
+Used to determine the PID(s) of the running command.
+If
+.Sy pidfile
+is set, use
+.Dl check_pidfile $pidfile $procname
+to find the PID.
+Otherwise, if
+.Sy command
+is set, use
+.Dl check_process $procname
+to find the PID.
+.It Sy procname
+Process name to check for.
+Defaults to the value of
+.Sy command .
+.It Sy required_dirs
+Check for the existence of the listed directories
+before running the default start method.
+.It Sy required_files
+Check for the readability of the listed files
+before running the default start method.
+.It Sy required_vars
+Perform
+.Ic checkyesno
+on each of the list variables
+before running the default start method.
+.It Sy ${name}_chdir
+Directory to
+.Ic cd
+to before running
+.Sy command ,
+if
+.Sy ${name}_chroot
+is not provided.
+.It Sy ${name}_chroot
+Directory to
+.Xr chroot 8
+to before running
+.Sy command .
+Only supported after
+.Pa /usr
+is mounted.
+.It Sy ${name}_env
+List of additional or modified environment variables to set
+when starting
+.Sy command .
+.It Sy ${name}_flags
+Arguments to call
+.Sy command
+with.
+This is usually set in
+.Xr rc.conf 5 ,
+and not in the
+.Xr rc.d 8
+script.
+The environment variable
+.Sq Ev flags
+can be used to override this.
+.It Sy ${name}_nice
+.Xr nice 1
+level to run
+.Sy command
+as.
+Only supported after
+.Pa /usr
+is mounted.
+.It Sy ${name}_user
+User to run
+.Sy command
+as, using
+.Xr chroot 8 .
+if
+.Sy ${name}_chroot
+is set, otherwise
+uses
+.Xr su 1 .
+Only supported after
+.Pa /usr
+is mounted.
+.It Sy ${name}_group
+Group to run the chrooted
+.Sy command
+as.
+.It Sy ${name}_groups
+Comma separated list of supplementary groups to run the chrooted
+.Sy command
+with.
+.It Ar argument Ns Sy _cmd
+Shell commands which override the default method for
+.Ar argument .
+.It Ar argument Ns Sy _precmd
+Shell commands to run just before running
+.Ar argument Ns Sy _cmd
+or the default method for
+.Ar argument .
+If this returns a non-zero exit code, the main method is not performed.
+If the default method is being executed, this check is performed after
+the
+.Sy required_*
+checks and process (non-)existence checks.
+.It Ar argument Ns Sy _postcmd
+Shell commands to run if running
+.Ar argument Ns Sy _cmd
+or the default method for
+.Ar argument
+returned a zero exit code.
+.It Sy sig_stop
+Signal to send the processes to stop in the default
+.Sy stop
+method.
+Defaults to
+.Dv SIGTERM .
+.It Sy sig_reload
+Signal to send the processes to reload in the default
+.Sy reload
+method.
+Defaults to
+.Dv SIGHUP .
+.El
+.Pp
+For a given method
+.Ar argument ,
+if
+.Ar argument Ns Sy _cmd
+is not defined, then a default method is provided by
+.Sy run_rc_command :
+.Bl -tag -width "argument" -offset indent
+.It Sy Argument
+.Sy Default method
+.It Sy start
+If
+.Sy command
+is not running and
+.Ic checkyesno Sy rcvar
+succeeds, start
+.Sy command .
+.It Sy stop
+Determine the PIDs of
+.Sy command
+with
+.Ic check_pidfile
+or
+.Ic check_process
+(as appropriate),
+.Ic kill Sy sig_stop
+those PIDs, and run
+.Ic wait_for_pids
+on those PIDs.
+.It Sy reload
+Similar to
+.Sy stop ,
+except that it uses
+.Sy sig_reload
+instead, and doesn't run
+.Ic wait_for_pids .
+.It Sy restart
+Runs the
+.Sy stop
+method, then the
+.Sy start
+method.
+.It Sy status
+Show the PID of
+.Sy command ,
+or some other script specific status operation.
+.It Sy poll
+Wait for
+.Sy command
+to exit.
+.It Sy rcvar
+Display which
+.Xr rc.conf 5
+variable is used (if any).
+This method always works, even if the appropriate
+.Xr rc.conf 5
+variable is set to
+.Sq NO .
+.El
+.Pp
+The following variables are available to the methods
+(such as
+.Ar argument Ns Sy _cmd )
+as well as after
+.Ic run_rc_command
+has completed:
+.Bl -tag -width "rc_flags" -offset indent
+.It Sy rc_arg
+Argument provided to
+.Sy run_rc_command ,
+after fast and force processing has been performed.
+.It Sy rc_flags
+Flags to start the default command with.
+Defaults to
+.Sy ${name}_flags ,
+unless overridden by the environment variable
+.Sq Ev flags .
+This variable may be changed by the
+.Ar argument Ns Sy _precmd
+method.
+.It Sy rc_pid
+PID of
+.Sy command
+(if appropriate).
+.It Sy rc_fast
+Not empty if
+.Dq fast
+prefix was used.
+.It Sy rc_force
+Not empty if
+.Dq force
+prefix was used.
+.El
+.It Ic run_rc_script Ar file Ar argument
+Start the script
+.Ar file
+with an argument of
+.Ar argument ,
+and handle the return value from the script.
+.Pp
+Various shell variables are unset before
+.Ar file
+is started:
+.Bd -ragged -offset indent
+.Sy name ,
+.Sy command ,
+.Sy command_args ,
+.Sy command_interpreter ,
+.Sy extra_commands ,
+.Sy pidfile ,
+.Sy rcvar ,
+.Sy required_dirs ,
+.Sy required_files ,
+.Sy required_vars ,
+.Ar argument Ns Sy _cmd ,
+.Ar argument Ns Sy _precmd .
+.Ar argument Ns Sy _postcmd .
+.Ed
+.Pp
+The startup behaviour of
+.Ar file
+depends upon the following checks:
+.Bl -enum
+.It
+If
+.Ar file
+ends in
+.Pa .sh ,
+it is sourced into the current shell.
+.It
+If
+.Ar file
+appears to be a backup or scratch file
+(e.g., with a suffix of
+.Sq ~ ,
+.Sq # ,
+.Sq .OLD ,
+or
+.Sq .orig ) ,
+ignore it.
+.It
+If
+.Ar file
+is not executable, ignore it.
+.It
+If the
+.Xr rc.conf 5
+variable
+.Sy rc_fast_and_loose
+is empty,
+source
+.Ar file
+in a sub shell,
+otherwise source
+.Ar file
+into the current shell.
+.It
+If
+.Ar file
+contains the
+.Xr rcorder 8
+keyword
+.Dq interactive ,
+then the command is executed using
+.Ic no_rc_postprocess .
+.El
+.It Ic stop_boot
+Prevent booting to multiuser mode.
+If the
+.Sy autoboot
+variable is
+.Sq yes ,
+then a
+.Sy SIGTERM
+signal is sent to the parent
+process (which is assumed to be
+.Xr rc 8 ) .
+Otherwise, the shell exits with status
+.Li 1 .
+.It Ic twiddle
+Display one of the characters
+.Sq \&/ , \&- , \&\e , \&| ,
+followed by a backspace.
+Repeated calls to this function will create the appearance of a spinning
+symbol, as a different character is displayed on each call.
+Output is to
+.Pa /dev/tty ,
+so this function may be useful even inside a script whose output
+has been redirected.
+.It Ic wait_for_pids Op Ar pid Op Ar ...
+Wait until all of the provided
+.Ar pids
+don't exist any more, printing the list of outstanding
+.Ar pids
+every two seconds.
+.It Ic warn Ar message
+Display a warning message to
+.Em stderr
+and log it to the system log
+using
+.Xr logger 1 .
+The warning message consists of the script name
+(from
+.Sy $0 ) ,
+followed by
+.Dq ": WARNING: " ,
+and then
+.Ar message .
+.It Ic yesno_to_truefalse Ar var
+Change the value of the specified variable from any of the
+forms acceptable to the
+.Ic checkyesno
+function, to
+.Dq true
+or
+.Dq false .
+.El
+.Sh FILES
+.Bl -tag -width /etc/rc.subr -compact
+.It Pa /etc/rc.subr
+The
+.Nm
+file resides in
+.Pa /etc .
+.El
+.Sh SEE ALSO
+.Xr rc.conf 5 ,
+.Xr rc 8
+.Sh HISTORY
+.Nm
+appeared in
+.Nx 1.3 .
+The
+.Xr rc.d 8
+support functions appeared in
+.Nx 1.5 .
+Support for the
+.Xr rc 8
+post-processor appeared in
+.Nx 6.0 .