History log of /netbsd-current/etc/rc
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.175 08-Sep-2020 martin

Ooops, overlooked one MOUNTCRITLOCAL reference in the rename to
CRITLOCALMOUNTED.


# 1.174 22-Jul-2020 martin

Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.173 20-Mar-2017 christos

set cloexec to the rc postprocessor fd (rudolf in tech-userlevel)


Revision tags: pgoyette-localcount-20170320
# 1.172 02-Feb-2017 christos

add +


# 1.171 02-Feb-2017 christos

set 7 and 8 to close on exec.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.170 29-Jul-2014 apb

branches: 1.170.6; 1.170.10;
In the background subshell that flushes partial output every few
seconds, detach from the controlling terminal. Without this, pressing
control-T (to send SIGINFO from the terminal) would almost always result
in the sleep process printing "about N seconds left of the original 3",
which is useless information.


# 1.169 27-Jul-2014 apb

In rc.subr, add _have_rc_postprocessor function and use it instead of
inline tests like [ -n "${_rc_postprocessor_fd}" ]. The new function
performs a few new tests, including verifying that /etc/rc is still
running (using a new _rc_pid variable set by /etc/rc).

This is intended to deal with the case that a script run from /etc/rc
spawns a background process, then /etc/rc exits, but the background
process still has environment variables inherited from /etc/rc.

Fixes PR 46546.


Revision tags: yamt-pagecache-base9
# 1.168 09-Apr-2014 apb

Send a "nop" metadata message to the postprocessor every few seconds,
to flush partial output lines. This should help with PR 48714.


# 1.167 09-Apr-2014 apb

Add comments about the intended use of each type of metadata message.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.166 11-Aug-2011 apb

branches: 1.166.2; 1.166.8; 1.166.20;
Allow "echo -n" to work as expected in rc.d scripts that are executed
by /etc/rc. Similarly for printf with a format that does not end with
"\n". Previously, the partial line would not be visible on the console
until a newline was printed, possibly after an annoying delay.

This is done by adding echo() and printf() shell functions to rc.subr,
so that naive use of the echo and printf commands in rc.d scripts will
call these functions instead of the underlying commands. These shell
functions send a new "nop" metadata message after the partial line, and
the rc_postprocess function in /etc/rc disentangles the partial line of
plain output from the metadata "nop".

Also add a "-n" option to the print_rc_normal function in rc.subr,
and make some cosmetic changes.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.165 04-Jun-2010 christos

print human readable exit code.


Revision tags: matt-premerge-20091211
# 1.164 11-Sep-2009 apb

Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
and which can suppress output in silent mode. Silent mode is enabled
via the new rc_silent variable, which defaults to a value that depends
on the kern.boothowto sysctl.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.163 10-Apr-2009 joerg

Add rc_directories to specify where to look for rc scripts.
For the moment all scripts must be in /root and non-existent directories
are skipped.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base mjf-devfs2-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.162 04-Jan-2003 lukem

branches: 1.162.42;
Change how internal boolean variables are used to:
if ! ${_somevar:-false}; then
_somevar=true
fi
(Consisent, slightly quicker, and slightly cleaner)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.161 19-May-2002 lukem

Add two new rc.conf(5) variables:
rc_rcorder_flags extra flags to rcorder(8) in /etc/rc
rcshutdown_rcorder_flags extra flags to rcorder(8) in /etc/rc.shutdown

This can be used to specify extra directories to search for rc.d scripts in.
For example, adding the following to rc.conf(5):
rc_rcorder_flags="/usr/pkg/etc/rc.d/*"
rcshutdown_rcorder_flags="/usr/pkg/etc/rc.d/*"
will add the files in /usr/pkg/etc/rc.d to the list of files that rcorder(8)
uses to build the list of scripts to start or stop.

I proposed this functionality on tech-userlevel@ over one month ago.
Closes the recent [misc/16888], which asked for a similar feature.


# 1.160 18-Apr-2002 lukem

consistently set rc_(fast|force)=yes


# 1.159 22-Mar-2002 lukem

- Rename a bunch of "internal" run_rc_command() variables and officially
make them "externally" available:
Previous Current Purpose
-------- ------- -------
_arg rc_arg Argument to command, after fast/force
processing performed (and prefix
removed)

_flags rc_flags Flags to start the default command
with. Defaults to ${name}_flags,
unless overridden by $flags from the
environment. This variable may be
changed by the precmd method.

_pid rc_pid PID of command (if appropriate).

_rc_run_fast rc_fast Not empty is "fast" was provided.

_rc_run_force rc_force Not empty is "force" was provided.

- Use rc_flags instead of _flags or ${name}_flags in various rc.d scripts,
so that $flags from the environment overrides ${name}_flags from rc.conf(5).
Fixes [bin/15800].


# 1.158 14-Jun-2001 lukem

use symbolic signal names instead of numbers


# 1.157 09-May-2001 lukem

explicitly set the umask to 022 to be safe


# 1.156 12-Mar-2001 lukem

move date before rcorder


# 1.155 28-Feb-2001 lukem

various speed-ups (and related work):
- only load rc.conf if $_rc_conf_loaded is not set
- use case instead of if for various string comparisons
- print the date at the start of the boot as well as at the end
- if $rc_fast_and_loose is set, always run the rc.d scripts in the
current shell rather than in a subshell. this is not on by default
because it's potentially dangerous (a rogue command could terminate
the boot), but it is provided as an optional speedup for people
with slow machines that have an expensive fork


# 1.154 15-Dec-2000 lukem

- describe what rc.shutdown does, and what invokes it
- remove `.sh' suffix on script name in description


# 1.153 21-Aug-2000 lukem

don't start rc.d scripts with a `nostart' keyword


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.152 22-Apr-2000 lukem

branches: 1.152.4;
revert previous; the fast-start functionality already existed, and
works at multi-user boot. (starting /etc/rc after single user boot
doesn't exhibit this fast start behaviour).


# 1.151 19-Apr-2000 simonb

Add an "rc_fastboot" variable check in rc.subr, that if set adds
"fast" to the start of the run_rc_command arg.

/etc/rc calls each rc.d script with rc_fastboot=yes so that rc.subr
aware scripts to use "faststart" to skip the process running check.


# 1.150 29-Mar-2000 enami

Check rc_configured also here, and bail out if it isn't set to yes.


# 1.149 10-Mar-2000 lukem

run scripts in /etc/rc.d/* in the order returned by rcorder


# 1.148 07-Mar-2000 jdolecek

make clearing of /tmp after reboot configurable (default on), as per recent
discussion on current-users


# 1.147 09-Feb-2000 itojun

ip6forwarding -> ip6mode change (somehow i forgot to commit...)
PR: 9375


# 1.146 05-Feb-2000 itojun

change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.


# 1.145 31-Jan-2000 jdc

Allow NFS servers to start up.


# 1.144 19-Jan-2000 tron

Start automount daemon even if NFS client is not activated. This makes
sense for system where "amd" is used to mount local devices like e.g.
CD-ROM drives. Fixes PR misc/9126 by Bjoern Labitzke.


# 1.143 19-Jan-2000 enami

Make some warning message consistient with others.


# 1.142 07-Jan-2000 enami

Since the logger(1) puts space between its arguments, there is no need
to pass it explicitly.


# 1.141 07-Jan-2000 enami

Make sure that warning message starts from the beginning of line. Some
warning recently added didn't care about it.


# 1.140 07-Jan-2000 enami

Cosmetic changes; folding long lines, using tab instead of spaces where
appropriate and fixing some indentation.


# 1.139 04-Jan-2000 lukem

don't need to background xfs now that it auto-backgrounds itself...


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.138 23-Nov-1999 hubertf

Add some boot time warnings:
- if ypserv=yes but portmap=no
- if yppasswdd=yes but ypserv=no
- if nfs_server=yes but portmap=no

Per discussion on tech-userlevel@netbsd.org.


# 1.137 23-Nov-1999 lukem

accounting should be controllable via $accounting=YES in rc.conf...


# 1.136 15-Nov-1999 fvdl

Remove update, it's no longer used.


Revision tags: comdex-fall-1999-base
# 1.135 30-Oct-1999 frueauf

Use checkyesno to check the state of $rc_configured like for any other
variable set in /etc/rc.conf. Pointed out by Erik Bertelsen
<erik@mediator.uni-c.dk> in pr 8522.


# 1.134 05-Oct-1999 darrenr

move old dev_mkdb and "kvm_mkdb /netbsd" up into the section which builds
kvm_mkdb based on machdep.boot_kernel. also failover to "kvm_mkdb /netbsd".


# 1.133 05-Oct-1999 darrenr

send sysctl machdep errors to /dev/null
merge in patches to implement multiple bootup configurations (look for
/etc/etc.current, /etc/etc.default and friends)
only start up NFS services if either nfs_client or nfs_server is yes.


# 1.132 28-Sep-1999 bouyer

Add support for $defcorename


# 1.131 16-Sep-1999 darrenr

branches: 1.131.2;
If machdep.booted_kernel can be found in sysctl output, feed that name into
kvm_mkdb so that when we boot we always have an upto-date kvm db, allowing
dmesg and friends to run without error when we do "boot netbsd.fun" to test
kernels, etc.


# 1.130 03-Sep-1999 itojun

add sanity check on rtadvd invocation (allowed on IPv6 routers only).
add rc.conf entry for rtsold.


# 1.129 28-Aug-1999 christos

check if vi recovery files are regular files before trying to e-mail them.
Stops a denial of service attack where the user can put a named pipe or
any other device that blocks i/o in /var/tmp/vi.recover/recover.*
[from dynamo@ime.net]


# 1.128 05-Aug-1999 christos

Create temp _motd file in /etc


# 1.127 03-Jul-1999 itojun

add IPv6 configuration (ip6forwarding, rtsol, route6d and rtadvd).
Right now netsetart does not bother you even if you do not have
"options INET6" in the kernel.


# 1.126 30-Jun-1999 augustss

usbd is dead.


# 1.125 13-Apr-1999 tron

Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.


Revision tags: netbsd-1-4-base
# 1.124 01-Apr-1999 cjs

branches: 1.124.2;
Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.


# 1.123 26-Mar-1999 drochner

start xdm after wscons configuration - the X server might want an own
virtual screen


# 1.122 26-Mar-1999 sommerfe

Add dhcrelay startup (allow only if dhcpd isn't started)


# 1.121 26-Mar-1999 oster

Nuke the line 'raidctl -r raid$dev'. a) The '-r' option is now '-i', and
b) with component labels and clean-bits working, this shouldn't be
required at all on each boot! Thanks to Andrew Gillham for pointing this out.


# 1.120 24-Mar-1999 mellon

- Move critical filesystem mounting code into a shell function and put
that in rc.subr.
- Support critfs_require_network rc.conf variable.


# 1.119 19-Mar-1999 perry

change to new syslog socket. make symlink from old to new location, too.


# 1.118 17-Mar-1999 drochner

rc.wscons can take arguments, so we shouldn't simply source it but exec in
a subshell. Being here, add a prototype wscons_flags variable.


# 1.117 14-Mar-1999 drochner

introduce a "wscons" rc.conf flag and run /etc/rc.wscons from /etc/rc
if it is set


# 1.116 07-Feb-1999 frueauf

No need to involve awk in the securelevel part, since sysctl has the -n switch.
Pointed out by NAKAJIMA Yoshihiro.


# 1.115 07-Feb-1999 bad

Use peers too when setting the time via ntpdate.


# 1.114 06-Feb-1999 frueauf

Add missing '' for awk in the securelevel part.


# 1.113 01-Feb-1999 mrg

oops, that's -n not -z. pointed out by hubert...


# 1.112 31-Jan-1999 mrg

increase the securelevel (using the same rules as before) much earlier in the
boot process. before cron, sendmail, inetd, etc, are run, but after lkms are
loaded. this avoids the chances of `@reboot', mail .forwards, remote logins,
etc., happening before the securelevel has been raised.


# 1.111 12-Jan-1999 mrg

support dmesg=NO and dmesg_flags, and do not cut the old boot messages..they might be useful. fix a typo (rbootd is not rarpd)


# 1.110 12-Jan-1999 jwise

Enable cron to be turned on and off from rc.conf, like other daemons.
From Soren S. Jorvang <soren@t.dk>, closes his PR bin/5250.


# 1.109 11-Jan-1999 jwise

Add $portmap_flags variable, now that portmap has optional flags, and
by default, pass '-l' flag (libwrap logging) by analogy with inetd


# 1.108 06-Jan-1999 abs

save a copy of the boot messages. Closes 6398 from msanders@confusion.net


# 1.107 04-Jan-1999 tron

Add support for RAIDframe configuration as suggested by Eric S. Hvozda
in PR install/6676.


# 1.106 21-Nov-1998 hubertf

allow /var/crash to be a symlink to a directory


# 1.105 12-Jul-1998 augustss

Add USB support. Supported so far:
* UHCI and OHCI host controllers on PCI
* Hubs
* HID devices withe special drivers for mouse and keyboard
* Printers


# 1.104 21-Jun-1998 tron

Strip comments from "${amd_master}".


# 1.103 07-Apr-1998 mrg

add "screenblank" support.


# 1.102 24-Feb-1998 lukem

send ntpdate output to syslog rather than stdout (with -s).
suggested by "Soren S. Jorvang" <soren@t.dk>


# 1.101 23-Feb-1998 lukem

exclude 127.127 servers when automagically determining ntpdate hosts


# 1.100 26-Jan-1998 lukem

include rc.subr and use appropriately


# 1.99 24-Jan-1998 veego

Move ipnat from /etc/netstart to /etc/rc after /usr is mounted.


# 1.98 09-Jan-1998 perry

Fix pr 4587 (from Matthias Scheler) -- pause slightly after xfs starts.


# 1.97 23-Nov-1997 mrg

print a warning if no swap devices are configured and "no_swap" is not YES.


# 1.96 11-Nov-1997 jonathan

Add options to rc.conf and rc to start xfs (x font server) and xdm.
Add entries to rc.conf.5.
While we're here, note that the domestic kerberos damons are still
Kerberos IV, not kerberos version 5.


Revision tags: netbsd-1-3-base
# 1.95 10-Oct-1997 drochner

branches: 1.95.2;
Replace the (slightly broken) check to avoid double mounting of
filesystems by a correct one. (too bad that there was no agreement
about a mount option doing the same...)
Introduce a new rc.conf variable to mount user-defined filesystems
early in startup (eg for syslog, crashdumps, ...).


# 1.94 07-Oct-1997 lukem

add $ipmon and $ipmon_flags, to control startup of ipmon(8)


# 1.93 12-Sep-1997 drochner

fix an rc.conf flag check which was broken with the "checkyesno" changes


# 1.92 12-Sep-1997 drochner

avoid to mount /usr twice if LKM load already did it


# 1.91 08-Sep-1997 mikel

no more DEFAULT for $ntpdate_hosts; from Geoff Wing in PR bin/4073


# 1.90 29-Aug-1997 veego

Curt, what is in rc.func ?
I only see rc.subr so I renamed rc.func to rc.subr.


# 1.89 29-Aug-1997 cjs

Split rc.conf variables for starting programs into two: an on/off
switch and a set of flags. Get rid of DEFAULT flags entirely. Print
warnings if on/off switches are not set, or are set incorrectly.
Add a shell function to simplify this on/off switch testing.


# 1.88 26-Aug-1997 thorpej

ldconfig processes /etc/ld.so.conf internally; run it without cat'ing
the contents into an argument vector.


# 1.87 05-Aug-1997 cjs

Move ntpdate before `starting network daemons' to get cleaner output
during boot. Besides, it's not a daemon anyway.


# 1.86 03-Aug-1997 perry

add apmd to /etc/rc and /etc/rc.conf per Lennart Augstsson in pr 3313


# 1.85 31-Jul-1997 perry

Fix boot time vi recovery as reported by NAKAJIMA Yoshihiro in pr-3430
Really weird bug. On inspection, the shell code in rc looked fine, but
when tested, sure enough, the semantics of the shell were not what I
thought they were. Very unexpected to me, and obviously to the
hundreds of people who must have read those lines without seeing that
they were broken.


# 1.84 15-Jul-1997 veego

Move savecore up before named to get a dump on low memory systems and
move 'mount -a' between yp and nfs daemons.


# 1.83 14-Jul-1997 drochner

Take 2 to get the mount order "right", taking care of possible LKM
loads before netstart this time.
LKMs can be loaded at 3 strategic places in /etc/rc - before netstart,
before "mount -a" and after all. "before netstart" works only if
the /usr filesystem is local (or on NFS, if root is too).
An additional field ("when") in lkm.conf controls when the LKM is
loaded.


# 1.82 11-Jul-1997 veego

Back out the last two commits for now till we find a better way to fix
the mount problems.


# 1.81 11-Jul-1997 veego

rc.lkm needs /usr/bin/ld, so try to mount it with -t nonfs before rc.lkm.


# 1.80 10-Jul-1997 drochner

Mount only "/" at the beginning (instead of all non-NFS filesystems).
This makes that the ordering of fstab is used for mounts which is
a) more intuitive and b) needed if {mfs,union,...} on top of NFS
is wanted.


# 1.79 25-Jun-1997 thorpej

Before disk checks are performed, do a "swapctl -A -t blk" so that
block-type devices are available during disk checks, which may consume
large amounts of memory if large file systems are present. Once "critical"
file systems (e.g. /usr and /var) are mounted, perform a "swapctl -A -t noblk"
to enable swapping on any swap files that may be listed in /etc/fstab.


# 1.78 12-Jun-1997 mrg

use swapctl instead of swapon


# 1.77 11-May-1997 cjs

Make xntpd put its pid in /var/run/xntpd.pid.


# 1.76 29-Apr-1997 scottr

Spawn a separate shell for netstart, making sure to check the return value
and exit with error if appropriate.


# 1.75 27-Apr-1997 perry

Add support for an ntpdate_hosts variable.
settings:
NO: don't run ntpdate on boot
DEFAULT:extract a list of hosts from /etc/ntp.conf
otherwise, a list of hosts to poll with ntpdate


# 1.74 23-Apr-1997 perry

make motd update conditional on an rc.conf variable (update_motd), and
move it before interactive logins are possible (just in case).


# 1.73 19-Apr-1997 perry

move last items from rc.local to rc; rc.local is now actually for local stuff.


# 1.72 17-Mar-1997 cjs

Added mopd.


# 1.71 12-Mar-1997 mycroft

When displaying the names for statd and lockd, include the `rpc.'.


# 1.70 12-Mar-1997 mycroft

Add . GC , which isn't used.


# 1.69 10-Mar-1997 mycroft

Do the DEFAULT thing with mountd_flags. Don't output an extra
newline for statd and lockd.


# 1.68 10-Mar-1997 mycroft

Minor cleanup.


# 1.67 10-Mar-1997 mycroft

If foo_flags is DEFAULT, run the program with a default set of flags. Most
users will use this, and therefore will never have to worry about flags
changing between releases. It's also a bit less error-prone.


# 1.66 10-Mar-1997 scottr

Add configuration flags for lockd/statd, and start them if an
NFS server or client is configured and the flags are not NO.


# 1.65 15-Feb-1997 mikel

cleanup Lite-1 merge


# 1.64 07-Feb-1997 mrg

oops; use $savecore_flags. from kilbi@rad.rwth-aachen.de


# 1.63 05-Jan-1997 mrg

move start-time configuration from netstart, rc, rc.local into
the new /etc/rc.conf. this also includes the following changes:

netstart: ifaliases now includes a netmask, to ensure
aliases work.

rc/rc.local: make _everything_ based on configuration
in rc.conf. also move things around such that DNS and
YP are started early enough that other daemons needing
their services also exist. move ldconfig from rc.local
here, and also make it use /etc/ld.so.conf if it exists.
run /etc/rc.lkm if it exists, a boot time.


# 1.62 04-Dec-1996 mrg

add inetd_flags, mostly from <jbernard@tater.Mines.EDU> in pr#2987


# 1.61 03-Oct-1996 mrg

add dhcpd startup; disabled by default


# 1.60 26-Aug-1996 tls

move rpc daemon startup to after network startup so that if the machine is a DNS server and wants to resolve via itself, one doesn't have to wait for all the DNS queries to time out as each rpc daemon starts. This was particularly ugly with mountd.


# 1.59 09-Aug-1996 thorpej

Quote the YP daemon flags variables.


# 1.58 09-Aug-1996 thorpej

Change how the YP daemons are started. Previously, ypbind was always
started if the directory /var/yp exists. Now, ypbind, ypserv, and
rpc.yppasswdd are started like other daemons; there are flags variables
for these programs. To disable them, set the variables to "NO", otherwise,
their contents are passed as flags.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.57 22-Mar-1996 mrg

add note about why we use /usr/sbin/sendmail.


# 1.56 22-Mar-1996 mrg

now that sendmail supports SIGHUP, call sendmail with full path.


# 1.55 30-Dec-1995 thorpej

Add $mrouted_flags to netstart and use it in rc to start mrouted in a manner
similar (well, identical, really) to how $routed_flags is used to start
routed.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.54 08-Oct-1995 thorpej

New-style RCS ids.


# 1.53 16-Sep-1995 jtc

fix typo in comment


# 1.52 02-Sep-1995 thorpej

Conditionally start rbootd like rarpd and rpc.bootparamd, and disable
it by default.


# 1.51 02-Sep-1995 thorpej

Fix typos in two comments.


# 1.50 27-Aug-1995 thorpej

Configure ccd devices before the filesystem checks, as suggested by
Thomas Eberhardt in PR #1408.


# 1.49 04-Nov-1994 briggs

Actually pass all the arguments to amd that we meant to. Reported by
Dave Leonard (D.Leonard@pleiades.newcastle.edu.au).


# 1.48 16-Sep-1994 mycroft

Create an empty mountdtab after removing it, to avoid getting a warning
from mountd on startup. Change $name_server to $named_flags.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.47 27-Jun-1994 deraadt

always check quotas (there is no reason not to try)


# 1.46 24-Jun-1994 deraadt

quotas file(s) changed name in 4.4-lite


# 1.45 18-Jun-1994 cgd

if install will do the trick, why not use it\?


# 1.44 08-Jun-1994 mycroft

Update nfsd and nfsiod invocations.


# 1.43 03-Jun-1994 jtc

Move building of link editor cache from rc to rc.local, like in SunOS,
because the end user may need to add local directories to be searched.
And rc.local is a much more appropriate place for local changes.

I emailed pk on this matter, and he said that the overhead of not
having linker hints for the daemons started by rc would not be
significant.

This change also closes bug #217.


# 1.42 29-May-1994 mycroft

Attempt to make sure /var is mounted before futzing with it.


# 1.41 29-May-1994 jtc

Move code that cleans /var/run so that it is before the automount deamon
startup puts its pid file there (This addressess most of bug #217).


# 1.40 10-Apr-1994 cgd

add ttyflags -a, early on in rc.


# 1.39 28-Mar-1994 cgd

keep amd pid in /var/run/amd.pid


# 1.38 18-Mar-1994 cgd

punctuation


# 1.37 17-Mar-1994 cgd

kill uucp lock files. from Mike Long <mike.long@analog.com>


# 1.36 14-Mar-1994 cgd

slight change to the way AMD is invoked, to make it sensible for most uses


# 1.35 09-Mar-1994 cgd

make booting comments a bit cleaner


# 1.34 26-Feb-1994 cgd

automatically enable accounting and rotate logs


# 1.33 01-Feb-1994 cgd

don't delete preserve files!


# 1.32 30-Jan-1994 mycroft

Do the right thing for nvi.


# 1.31 13-Jan-1994 jtc

The cron daemon now lives in /usr/sbin


# 1.30 10-Jan-1994 mycroft

Add bootparamd gunk.


# 1.29 10-Jan-1994 mycroft

Add rarpd gunk.


# 1.28 05-Jan-1994 jtc

The cron daemon has been renamed from crond to cron. This name change
is from Vixie Cron 3.0, to make it like the 4.3BSD cron.


# 1.27 05-Jan-1994 deraadt

start amd if requested
do nfs mounting after mountd has been started (so two machines can cross-mount
nfs from each other, else they hang if booted simultaneously)


# 1.26 16-Dec-1993 deraadt

initialize rpc services in proper order


# 1.25 15-Dec-1993 mycroft

Use `.' to run rc.local, rather than starting another shell, so that variables
from netstart are passed on.


# 1.24 01-Dec-1993 cgd

fix comment, add check


# 1.23 26-Nov-1993 mycroft

Put ldconfig later so it doesn't get wiped when reaping /var/run.


# 1.22 21-Nov-1993 mycroft

Build ld.so.hints on each boot.


# 1.21 17-Nov-1993 cgd

more flags


# 1.20 17-Nov-1993 cgd

quote sendmail_flags test, from Patrick Bridges <patrick@buffy.cs.msstate.edu>


# 1.19 07-Nov-1993 cgd

(1) clean up lots (rename fooflags -> foo_flags, etc.)
(2) implement suggestion made by Garrett Wollman of "sendmail flags"
to set flags passed to sendmail and/or turn it off
(3) document origins of variables


# 1.18 20-Oct-1993 cgd

never rotate accounting logs, and turn on accounting the way done in net/2


# 1.17 05-Sep-1993 mycroft

Use `-e fastboot', not `-r fastboot'.


# 1.16 01-Sep-1993 deraadt

it's clear that mountd started from inetd doesn't work


# 1.15 25-Aug-1993 brezak

mountd is now started by inetd.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.14 11-Jun-1993 brezak

Don't start rwalld - now started by inetd.


# 1.13 03-May-1993 cgd

prune dirs rm'd when cleaning tmp


# 1.12 03-May-1993 cgd

turn on accounting if /var/account exists


# 1.11 28-Apr-1993 cgd

bsd->netbsd


# 1.10 28-Apr-1993 cgd

new kernel is bsd


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.9 10-Apr-1993 glass

fixes for nfs_client, nfs_server division.


# 1.8 10-Apr-1993 cgd

always run portmap


# 1.7 10-Apr-1993 glass

mountd's log of who has what filesystem mounted should not persist across
reboots.


# 1.6 09-Apr-1993 cgd

rwalld should be run *after* the portmapper.


# 1.5 05-Apr-1993 cgd

screwed it up again... = vs ==.


# 1.4 05-Apr-1993 cgd

screwed up comparison for rwalld and rwhod...


# 1.3 04-Apr-1993 cgd

updated for addition of rwalld


# 1.2 02-Apr-1993 cgd

got rid of damned highlight characters, and changed
method to turn on rwhod.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.174 22-Jul-2020 martin

Split the local disk availability step into two phases to allow scripts
that pre-populate parts of the system (e.g. a tmpfs based /var) an
easy place to plug in like:

# REQUIRE: mountcritlocal
# BEFORE: MOUNTCRITLOCAL

This also cleans up the existing special handling a bit by separating it
into new scripts. All later scripts now depend on MOUNTCRITLOCAL.
Discussed on tech-userlevel some time ago.


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.173 20-Mar-2017 christos

set cloexec to the rc postprocessor fd (rudolf in tech-userlevel)


Revision tags: pgoyette-localcount-20170320
# 1.172 02-Feb-2017 christos

add +


# 1.171 02-Feb-2017 christos

set 7 and 8 to close on exec.


Revision tags: netbsd-7-2-RELEASE netbsd-7-1-2-RELEASE netbsd-7-1-1-RELEASE netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.170 29-Jul-2014 apb

branches: 1.170.6; 1.170.10;
In the background subshell that flushes partial output every few
seconds, detach from the controlling terminal. Without this, pressing
control-T (to send SIGINFO from the terminal) would almost always result
in the sleep process printing "about N seconds left of the original 3",
which is useless information.


# 1.169 27-Jul-2014 apb

In rc.subr, add _have_rc_postprocessor function and use it instead of
inline tests like [ -n "${_rc_postprocessor_fd}" ]. The new function
performs a few new tests, including verifying that /etc/rc is still
running (using a new _rc_pid variable set by /etc/rc).

This is intended to deal with the case that a script run from /etc/rc
spawns a background process, then /etc/rc exits, but the background
process still has environment variables inherited from /etc/rc.

Fixes PR 46546.


Revision tags: yamt-pagecache-base9
# 1.168 09-Apr-2014 apb

Send a "nop" metadata message to the postprocessor every few seconds,
to flush partial output lines. This should help with PR 48714.


# 1.167 09-Apr-2014 apb

Add comments about the intended use of each type of metadata message.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.166 11-Aug-2011 apb

branches: 1.166.2; 1.166.8; 1.166.20;
Allow "echo -n" to work as expected in rc.d scripts that are executed
by /etc/rc. Similarly for printf with a format that does not end with
"\n". Previously, the partial line would not be visible on the console
until a newline was printed, possibly after an annoying delay.

This is done by adding echo() and printf() shell functions to rc.subr,
so that naive use of the echo and printf commands in rc.d scripts will
call these functions instead of the underlying commands. These shell
functions send a new "nop" metadata message after the partial line, and
the rc_postprocess function in /etc/rc disentangles the partial line of
plain output from the metadata "nop".

Also add a "-n" option to the print_rc_normal function in rc.subr,
and make some cosmetic changes.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.165 04-Jun-2010 christos

print human readable exit code.


Revision tags: matt-premerge-20091211
# 1.164 11-Sep-2009 apb

Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
and which can suppress output in silent mode. Silent mode is enabled
via the new rc_silent variable, which defaults to a value that depends
on the kern.boothowto sysctl.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.163 10-Apr-2009 joerg

Add rc_directories to specify where to look for rc scripts.
For the moment all scripts must be in /root and non-existent directories
are skipped.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base mjf-devfs2-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.162 04-Jan-2003 lukem

branches: 1.162.42;
Change how internal boolean variables are used to:
if ! ${_somevar:-false}; then
_somevar=true
fi
(Consisent, slightly quicker, and slightly cleaner)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.161 19-May-2002 lukem

Add two new rc.conf(5) variables:
rc_rcorder_flags extra flags to rcorder(8) in /etc/rc
rcshutdown_rcorder_flags extra flags to rcorder(8) in /etc/rc.shutdown

This can be used to specify extra directories to search for rc.d scripts in.
For example, adding the following to rc.conf(5):
rc_rcorder_flags="/usr/pkg/etc/rc.d/*"
rcshutdown_rcorder_flags="/usr/pkg/etc/rc.d/*"
will add the files in /usr/pkg/etc/rc.d to the list of files that rcorder(8)
uses to build the list of scripts to start or stop.

I proposed this functionality on tech-userlevel@ over one month ago.
Closes the recent [misc/16888], which asked for a similar feature.


# 1.160 18-Apr-2002 lukem

consistently set rc_(fast|force)=yes


# 1.159 22-Mar-2002 lukem

- Rename a bunch of "internal" run_rc_command() variables and officially
make them "externally" available:
Previous Current Purpose
-------- ------- -------
_arg rc_arg Argument to command, after fast/force
processing performed (and prefix
removed)

_flags rc_flags Flags to start the default command
with. Defaults to ${name}_flags,
unless overridden by $flags from the
environment. This variable may be
changed by the precmd method.

_pid rc_pid PID of command (if appropriate).

_rc_run_fast rc_fast Not empty is "fast" was provided.

_rc_run_force rc_force Not empty is "force" was provided.

- Use rc_flags instead of _flags or ${name}_flags in various rc.d scripts,
so that $flags from the environment overrides ${name}_flags from rc.conf(5).
Fixes [bin/15800].


# 1.158 14-Jun-2001 lukem

use symbolic signal names instead of numbers


# 1.157 09-May-2001 lukem

explicitly set the umask to 022 to be safe


# 1.156 12-Mar-2001 lukem

move date before rcorder


# 1.155 28-Feb-2001 lukem

various speed-ups (and related work):
- only load rc.conf if $_rc_conf_loaded is not set
- use case instead of if for various string comparisons
- print the date at the start of the boot as well as at the end
- if $rc_fast_and_loose is set, always run the rc.d scripts in the
current shell rather than in a subshell. this is not on by default
because it's potentially dangerous (a rogue command could terminate
the boot), but it is provided as an optional speedup for people
with slow machines that have an expensive fork


# 1.154 15-Dec-2000 lukem

- describe what rc.shutdown does, and what invokes it
- remove `.sh' suffix on script name in description


# 1.153 21-Aug-2000 lukem

don't start rc.d scripts with a `nostart' keyword


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.152 22-Apr-2000 lukem

branches: 1.152.4;
revert previous; the fast-start functionality already existed, and
works at multi-user boot. (starting /etc/rc after single user boot
doesn't exhibit this fast start behaviour).


# 1.151 19-Apr-2000 simonb

Add an "rc_fastboot" variable check in rc.subr, that if set adds
"fast" to the start of the run_rc_command arg.

/etc/rc calls each rc.d script with rc_fastboot=yes so that rc.subr
aware scripts to use "faststart" to skip the process running check.


# 1.150 29-Mar-2000 enami

Check rc_configured also here, and bail out if it isn't set to yes.


# 1.149 10-Mar-2000 lukem

run scripts in /etc/rc.d/* in the order returned by rcorder


# 1.148 07-Mar-2000 jdolecek

make clearing of /tmp after reboot configurable (default on), as per recent
discussion on current-users


# 1.147 09-Feb-2000 itojun

ip6forwarding -> ip6mode change (somehow i forgot to commit...)
PR: 9375


# 1.146 05-Feb-2000 itojun

change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.


# 1.145 31-Jan-2000 jdc

Allow NFS servers to start up.


# 1.144 19-Jan-2000 tron

Start automount daemon even if NFS client is not activated. This makes
sense for system where "amd" is used to mount local devices like e.g.
CD-ROM drives. Fixes PR misc/9126 by Bjoern Labitzke.


# 1.143 19-Jan-2000 enami

Make some warning message consistient with others.


# 1.142 07-Jan-2000 enami

Since the logger(1) puts space between its arguments, there is no need
to pass it explicitly.


# 1.141 07-Jan-2000 enami

Make sure that warning message starts from the beginning of line. Some
warning recently added didn't care about it.


# 1.140 07-Jan-2000 enami

Cosmetic changes; folding long lines, using tab instead of spaces where
appropriate and fixing some indentation.


# 1.139 04-Jan-2000 lukem

don't need to background xfs now that it auto-backgrounds itself...


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.138 23-Nov-1999 hubertf

Add some boot time warnings:
- if ypserv=yes but portmap=no
- if yppasswdd=yes but ypserv=no
- if nfs_server=yes but portmap=no

Per discussion on tech-userlevel@netbsd.org.


# 1.137 23-Nov-1999 lukem

accounting should be controllable via $accounting=YES in rc.conf...


# 1.136 15-Nov-1999 fvdl

Remove update, it's no longer used.


Revision tags: comdex-fall-1999-base
# 1.135 30-Oct-1999 frueauf

Use checkyesno to check the state of $rc_configured like for any other
variable set in /etc/rc.conf. Pointed out by Erik Bertelsen
<erik@mediator.uni-c.dk> in pr 8522.


# 1.134 05-Oct-1999 darrenr

move old dev_mkdb and "kvm_mkdb /netbsd" up into the section which builds
kvm_mkdb based on machdep.boot_kernel. also failover to "kvm_mkdb /netbsd".


# 1.133 05-Oct-1999 darrenr

send sysctl machdep errors to /dev/null
merge in patches to implement multiple bootup configurations (look for
/etc/etc.current, /etc/etc.default and friends)
only start up NFS services if either nfs_client or nfs_server is yes.


# 1.132 28-Sep-1999 bouyer

Add support for $defcorename


# 1.131 16-Sep-1999 darrenr

branches: 1.131.2;
If machdep.booted_kernel can be found in sysctl output, feed that name into
kvm_mkdb so that when we boot we always have an upto-date kvm db, allowing
dmesg and friends to run without error when we do "boot netbsd.fun" to test
kernels, etc.


# 1.130 03-Sep-1999 itojun

add sanity check on rtadvd invocation (allowed on IPv6 routers only).
add rc.conf entry for rtsold.


# 1.129 28-Aug-1999 christos

check if vi recovery files are regular files before trying to e-mail them.
Stops a denial of service attack where the user can put a named pipe or
any other device that blocks i/o in /var/tmp/vi.recover/recover.*
[from dynamo@ime.net]


# 1.128 05-Aug-1999 christos

Create temp _motd file in /etc


# 1.127 03-Jul-1999 itojun

add IPv6 configuration (ip6forwarding, rtsol, route6d and rtadvd).
Right now netsetart does not bother you even if you do not have
"options INET6" in the kernel.


# 1.126 30-Jun-1999 augustss

usbd is dead.


# 1.125 13-Apr-1999 tron

Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.


Revision tags: netbsd-1-4-base
# 1.124 01-Apr-1999 cjs

branches: 1.124.2;
Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.


# 1.123 26-Mar-1999 drochner

start xdm after wscons configuration - the X server might want an own
virtual screen


# 1.122 26-Mar-1999 sommerfe

Add dhcrelay startup (allow only if dhcpd isn't started)


# 1.121 26-Mar-1999 oster

Nuke the line 'raidctl -r raid$dev'. a) The '-r' option is now '-i', and
b) with component labels and clean-bits working, this shouldn't be
required at all on each boot! Thanks to Andrew Gillham for pointing this out.


# 1.120 24-Mar-1999 mellon

- Move critical filesystem mounting code into a shell function and put
that in rc.subr.
- Support critfs_require_network rc.conf variable.


# 1.119 19-Mar-1999 perry

change to new syslog socket. make symlink from old to new location, too.


# 1.118 17-Mar-1999 drochner

rc.wscons can take arguments, so we shouldn't simply source it but exec in
a subshell. Being here, add a prototype wscons_flags variable.


# 1.117 14-Mar-1999 drochner

introduce a "wscons" rc.conf flag and run /etc/rc.wscons from /etc/rc
if it is set


# 1.116 07-Feb-1999 frueauf

No need to involve awk in the securelevel part, since sysctl has the -n switch.
Pointed out by NAKAJIMA Yoshihiro.


# 1.115 07-Feb-1999 bad

Use peers too when setting the time via ntpdate.


# 1.114 06-Feb-1999 frueauf

Add missing '' for awk in the securelevel part.


# 1.113 01-Feb-1999 mrg

oops, that's -n not -z. pointed out by hubert...


# 1.112 31-Jan-1999 mrg

increase the securelevel (using the same rules as before) much earlier in the
boot process. before cron, sendmail, inetd, etc, are run, but after lkms are
loaded. this avoids the chances of `@reboot', mail .forwards, remote logins,
etc., happening before the securelevel has been raised.


# 1.111 12-Jan-1999 mrg

support dmesg=NO and dmesg_flags, and do not cut the old boot messages..they might be useful. fix a typo (rbootd is not rarpd)


# 1.110 12-Jan-1999 jwise

Enable cron to be turned on and off from rc.conf, like other daemons.
From Soren S. Jorvang <soren@t.dk>, closes his PR bin/5250.


# 1.109 11-Jan-1999 jwise

Add $portmap_flags variable, now that portmap has optional flags, and
by default, pass '-l' flag (libwrap logging) by analogy with inetd


# 1.108 06-Jan-1999 abs

save a copy of the boot messages. Closes 6398 from msanders@confusion.net


# 1.107 04-Jan-1999 tron

Add support for RAIDframe configuration as suggested by Eric S. Hvozda
in PR install/6676.


# 1.106 21-Nov-1998 hubertf

allow /var/crash to be a symlink to a directory


# 1.105 12-Jul-1998 augustss

Add USB support. Supported so far:
* UHCI and OHCI host controllers on PCI
* Hubs
* HID devices withe special drivers for mouse and keyboard
* Printers


# 1.104 21-Jun-1998 tron

Strip comments from "${amd_master}".


# 1.103 07-Apr-1998 mrg

add "screenblank" support.


# 1.102 24-Feb-1998 lukem

send ntpdate output to syslog rather than stdout (with -s).
suggested by "Soren S. Jorvang" <soren@t.dk>


# 1.101 23-Feb-1998 lukem

exclude 127.127 servers when automagically determining ntpdate hosts


# 1.100 26-Jan-1998 lukem

include rc.subr and use appropriately


# 1.99 24-Jan-1998 veego

Move ipnat from /etc/netstart to /etc/rc after /usr is mounted.


# 1.98 09-Jan-1998 perry

Fix pr 4587 (from Matthias Scheler) -- pause slightly after xfs starts.


# 1.97 23-Nov-1997 mrg

print a warning if no swap devices are configured and "no_swap" is not YES.


# 1.96 11-Nov-1997 jonathan

Add options to rc.conf and rc to start xfs (x font server) and xdm.
Add entries to rc.conf.5.
While we're here, note that the domestic kerberos damons are still
Kerberos IV, not kerberos version 5.


Revision tags: netbsd-1-3-base
# 1.95 10-Oct-1997 drochner

branches: 1.95.2;
Replace the (slightly broken) check to avoid double mounting of
filesystems by a correct one. (too bad that there was no agreement
about a mount option doing the same...)
Introduce a new rc.conf variable to mount user-defined filesystems
early in startup (eg for syslog, crashdumps, ...).


# 1.94 07-Oct-1997 lukem

add $ipmon and $ipmon_flags, to control startup of ipmon(8)


# 1.93 12-Sep-1997 drochner

fix an rc.conf flag check which was broken with the "checkyesno" changes


# 1.92 12-Sep-1997 drochner

avoid to mount /usr twice if LKM load already did it


# 1.91 08-Sep-1997 mikel

no more DEFAULT for $ntpdate_hosts; from Geoff Wing in PR bin/4073


# 1.90 29-Aug-1997 veego

Curt, what is in rc.func ?
I only see rc.subr so I renamed rc.func to rc.subr.


# 1.89 29-Aug-1997 cjs

Split rc.conf variables for starting programs into two: an on/off
switch and a set of flags. Get rid of DEFAULT flags entirely. Print
warnings if on/off switches are not set, or are set incorrectly.
Add a shell function to simplify this on/off switch testing.


# 1.88 26-Aug-1997 thorpej

ldconfig processes /etc/ld.so.conf internally; run it without cat'ing
the contents into an argument vector.


# 1.87 05-Aug-1997 cjs

Move ntpdate before `starting network daemons' to get cleaner output
during boot. Besides, it's not a daemon anyway.


# 1.86 03-Aug-1997 perry

add apmd to /etc/rc and /etc/rc.conf per Lennart Augstsson in pr 3313


# 1.85 31-Jul-1997 perry

Fix boot time vi recovery as reported by NAKAJIMA Yoshihiro in pr-3430
Really weird bug. On inspection, the shell code in rc looked fine, but
when tested, sure enough, the semantics of the shell were not what I
thought they were. Very unexpected to me, and obviously to the
hundreds of people who must have read those lines without seeing that
they were broken.


# 1.84 15-Jul-1997 veego

Move savecore up before named to get a dump on low memory systems and
move 'mount -a' between yp and nfs daemons.


# 1.83 14-Jul-1997 drochner

Take 2 to get the mount order "right", taking care of possible LKM
loads before netstart this time.
LKMs can be loaded at 3 strategic places in /etc/rc - before netstart,
before "mount -a" and after all. "before netstart" works only if
the /usr filesystem is local (or on NFS, if root is too).
An additional field ("when") in lkm.conf controls when the LKM is
loaded.


# 1.82 11-Jul-1997 veego

Back out the last two commits for now till we find a better way to fix
the mount problems.


# 1.81 11-Jul-1997 veego

rc.lkm needs /usr/bin/ld, so try to mount it with -t nonfs before rc.lkm.


# 1.80 10-Jul-1997 drochner

Mount only "/" at the beginning (instead of all non-NFS filesystems).
This makes that the ordering of fstab is used for mounts which is
a) more intuitive and b) needed if {mfs,union,...} on top of NFS
is wanted.


# 1.79 25-Jun-1997 thorpej

Before disk checks are performed, do a "swapctl -A -t blk" so that
block-type devices are available during disk checks, which may consume
large amounts of memory if large file systems are present. Once "critical"
file systems (e.g. /usr and /var) are mounted, perform a "swapctl -A -t noblk"
to enable swapping on any swap files that may be listed in /etc/fstab.


# 1.78 12-Jun-1997 mrg

use swapctl instead of swapon


# 1.77 11-May-1997 cjs

Make xntpd put its pid in /var/run/xntpd.pid.


# 1.76 29-Apr-1997 scottr

Spawn a separate shell for netstart, making sure to check the return value
and exit with error if appropriate.


# 1.75 27-Apr-1997 perry

Add support for an ntpdate_hosts variable.
settings:
NO: don't run ntpdate on boot
DEFAULT:extract a list of hosts from /etc/ntp.conf
otherwise, a list of hosts to poll with ntpdate


# 1.74 23-Apr-1997 perry

make motd update conditional on an rc.conf variable (update_motd), and
move it before interactive logins are possible (just in case).


# 1.73 19-Apr-1997 perry

move last items from rc.local to rc; rc.local is now actually for local stuff.


# 1.72 17-Mar-1997 cjs

Added mopd.


# 1.71 12-Mar-1997 mycroft

When displaying the names for statd and lockd, include the `rpc.'.


# 1.70 12-Mar-1997 mycroft

Add . GC , which isn't used.


# 1.69 10-Mar-1997 mycroft

Do the DEFAULT thing with mountd_flags. Don't output an extra
newline for statd and lockd.


# 1.68 10-Mar-1997 mycroft

Minor cleanup.


# 1.67 10-Mar-1997 mycroft

If foo_flags is DEFAULT, run the program with a default set of flags. Most
users will use this, and therefore will never have to worry about flags
changing between releases. It's also a bit less error-prone.


# 1.66 10-Mar-1997 scottr

Add configuration flags for lockd/statd, and start them if an
NFS server or client is configured and the flags are not NO.


# 1.65 15-Feb-1997 mikel

cleanup Lite-1 merge


# 1.64 07-Feb-1997 mrg

oops; use $savecore_flags. from kilbi@rad.rwth-aachen.de


# 1.63 05-Jan-1997 mrg

move start-time configuration from netstart, rc, rc.local into
the new /etc/rc.conf. this also includes the following changes:

netstart: ifaliases now includes a netmask, to ensure
aliases work.

rc/rc.local: make _everything_ based on configuration
in rc.conf. also move things around such that DNS and
YP are started early enough that other daemons needing
their services also exist. move ldconfig from rc.local
here, and also make it use /etc/ld.so.conf if it exists.
run /etc/rc.lkm if it exists, a boot time.


# 1.62 04-Dec-1996 mrg

add inetd_flags, mostly from <jbernard@tater.Mines.EDU> in pr#2987


# 1.61 03-Oct-1996 mrg

add dhcpd startup; disabled by default


# 1.60 26-Aug-1996 tls

move rpc daemon startup to after network startup so that if the machine is a DNS server and wants to resolve via itself, one doesn't have to wait for all the DNS queries to time out as each rpc daemon starts. This was particularly ugly with mountd.


# 1.59 09-Aug-1996 thorpej

Quote the YP daemon flags variables.


# 1.58 09-Aug-1996 thorpej

Change how the YP daemons are started. Previously, ypbind was always
started if the directory /var/yp exists. Now, ypbind, ypserv, and
rpc.yppasswdd are started like other daemons; there are flags variables
for these programs. To disable them, set the variables to "NO", otherwise,
their contents are passed as flags.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.57 22-Mar-1996 mrg

add note about why we use /usr/sbin/sendmail.


# 1.56 22-Mar-1996 mrg

now that sendmail supports SIGHUP, call sendmail with full path.


# 1.55 30-Dec-1995 thorpej

Add $mrouted_flags to netstart and use it in rc to start mrouted in a manner
similar (well, identical, really) to how $routed_flags is used to start
routed.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.54 08-Oct-1995 thorpej

New-style RCS ids.


# 1.53 16-Sep-1995 jtc

fix typo in comment


# 1.52 02-Sep-1995 thorpej

Conditionally start rbootd like rarpd and rpc.bootparamd, and disable
it by default.


# 1.51 02-Sep-1995 thorpej

Fix typos in two comments.


# 1.50 27-Aug-1995 thorpej

Configure ccd devices before the filesystem checks, as suggested by
Thomas Eberhardt in PR #1408.


# 1.49 04-Nov-1994 briggs

Actually pass all the arguments to amd that we meant to. Reported by
Dave Leonard (D.Leonard@pleiades.newcastle.edu.au).


# 1.48 16-Sep-1994 mycroft

Create an empty mountdtab after removing it, to avoid getting a warning
from mountd on startup. Change $name_server to $named_flags.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.47 27-Jun-1994 deraadt

always check quotas (there is no reason not to try)


# 1.46 24-Jun-1994 deraadt

quotas file(s) changed name in 4.4-lite


# 1.45 18-Jun-1994 cgd

if install will do the trick, why not use it\?


# 1.44 08-Jun-1994 mycroft

Update nfsd and nfsiod invocations.


# 1.43 03-Jun-1994 jtc

Move building of link editor cache from rc to rc.local, like in SunOS,
because the end user may need to add local directories to be searched.
And rc.local is a much more appropriate place for local changes.

I emailed pk on this matter, and he said that the overhead of not
having linker hints for the daemons started by rc would not be
significant.

This change also closes bug #217.


# 1.42 29-May-1994 mycroft

Attempt to make sure /var is mounted before futzing with it.


# 1.41 29-May-1994 jtc

Move code that cleans /var/run so that it is before the automount deamon
startup puts its pid file there (This addressess most of bug #217).


# 1.40 10-Apr-1994 cgd

add ttyflags -a, early on in rc.


# 1.39 28-Mar-1994 cgd

keep amd pid in /var/run/amd.pid


# 1.38 18-Mar-1994 cgd

punctuation


# 1.37 17-Mar-1994 cgd

kill uucp lock files. from Mike Long <mike.long@analog.com>


# 1.36 14-Mar-1994 cgd

slight change to the way AMD is invoked, to make it sensible for most uses


# 1.35 09-Mar-1994 cgd

make booting comments a bit cleaner


# 1.34 26-Feb-1994 cgd

automatically enable accounting and rotate logs


# 1.33 01-Feb-1994 cgd

don't delete preserve files!


# 1.32 30-Jan-1994 mycroft

Do the right thing for nvi.


# 1.31 13-Jan-1994 jtc

The cron daemon now lives in /usr/sbin


# 1.30 10-Jan-1994 mycroft

Add bootparamd gunk.


# 1.29 10-Jan-1994 mycroft

Add rarpd gunk.


# 1.28 05-Jan-1994 jtc

The cron daemon has been renamed from crond to cron. This name change
is from Vixie Cron 3.0, to make it like the 4.3BSD cron.


# 1.27 05-Jan-1994 deraadt

start amd if requested
do nfs mounting after mountd has been started (so two machines can cross-mount
nfs from each other, else they hang if booted simultaneously)


# 1.26 16-Dec-1993 deraadt

initialize rpc services in proper order


# 1.25 15-Dec-1993 mycroft

Use `.' to run rc.local, rather than starting another shell, so that variables
from netstart are passed on.


# 1.24 01-Dec-1993 cgd

fix comment, add check


# 1.23 26-Nov-1993 mycroft

Put ldconfig later so it doesn't get wiped when reaping /var/run.


# 1.22 21-Nov-1993 mycroft

Build ld.so.hints on each boot.


# 1.21 17-Nov-1993 cgd

more flags


# 1.20 17-Nov-1993 cgd

quote sendmail_flags test, from Patrick Bridges <patrick@buffy.cs.msstate.edu>


# 1.19 07-Nov-1993 cgd

(1) clean up lots (rename fooflags -> foo_flags, etc.)
(2) implement suggestion made by Garrett Wollman of "sendmail flags"
to set flags passed to sendmail and/or turn it off
(3) document origins of variables


# 1.18 20-Oct-1993 cgd

never rotate accounting logs, and turn on accounting the way done in net/2


# 1.17 05-Sep-1993 mycroft

Use `-e fastboot', not `-r fastboot'.


# 1.16 01-Sep-1993 deraadt

it's clear that mountd started from inetd doesn't work


# 1.15 25-Aug-1993 brezak

mountd is now started by inetd.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.14 11-Jun-1993 brezak

Don't start rwalld - now started by inetd.


# 1.13 03-May-1993 cgd

prune dirs rm'd when cleaning tmp


# 1.12 03-May-1993 cgd

turn on accounting if /var/account exists


# 1.11 28-Apr-1993 cgd

bsd->netbsd


# 1.10 28-Apr-1993 cgd

new kernel is bsd


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.9 10-Apr-1993 glass

fixes for nfs_client, nfs_server division.


# 1.8 10-Apr-1993 cgd

always run portmap


# 1.7 10-Apr-1993 glass

mountd's log of who has what filesystem mounted should not persist across
reboots.


# 1.6 09-Apr-1993 cgd

rwalld should be run *after* the portmapper.


# 1.5 05-Apr-1993 cgd

screwed it up again... = vs ==.


# 1.4 05-Apr-1993 cgd

screwed up comparison for rwalld and rwhod...


# 1.3 04-Apr-1993 cgd

updated for addition of rwalld


# 1.2 02-Apr-1993 cgd

got rid of damned highlight characters, and changed
method to turn on rwhod.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


Revision tags: prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1
# 1.173 20-Mar-2017 christos

set cloexec to the rc postprocessor fd (rudolf in tech-userlevel)


Revision tags: pgoyette-localcount-20170320
# 1.172 02-Feb-2017 christos

add +


# 1.171 02-Feb-2017 christos

set 7 and 8 to close on exec.


Revision tags: netbsd-7-1-RELEASE netbsd-7-1-RC2 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.170 29-Jul-2014 apb

branches: 1.170.6; 1.170.10;
In the background subshell that flushes partial output every few
seconds, detach from the controlling terminal. Without this, pressing
control-T (to send SIGINFO from the terminal) would almost always result
in the sleep process printing "about N seconds left of the original 3",
which is useless information.


# 1.169 27-Jul-2014 apb

In rc.subr, add _have_rc_postprocessor function and use it instead of
inline tests like [ -n "${_rc_postprocessor_fd}" ]. The new function
performs a few new tests, including verifying that /etc/rc is still
running (using a new _rc_pid variable set by /etc/rc).

This is intended to deal with the case that a script run from /etc/rc
spawns a background process, then /etc/rc exits, but the background
process still has environment variables inherited from /etc/rc.

Fixes PR 46546.


Revision tags: yamt-pagecache-base9
# 1.168 09-Apr-2014 apb

Send a "nop" metadata message to the postprocessor every few seconds,
to flush partial output lines. This should help with PR 48714.


# 1.167 09-Apr-2014 apb

Add comments about the intended use of each type of metadata message.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.166 11-Aug-2011 apb

branches: 1.166.2; 1.166.8; 1.166.20;
Allow "echo -n" to work as expected in rc.d scripts that are executed
by /etc/rc. Similarly for printf with a format that does not end with
"\n". Previously, the partial line would not be visible on the console
until a newline was printed, possibly after an annoying delay.

This is done by adding echo() and printf() shell functions to rc.subr,
so that naive use of the echo and printf commands in rc.d scripts will
call these functions instead of the underlying commands. These shell
functions send a new "nop" metadata message after the partial line, and
the rc_postprocess function in /etc/rc disentangles the partial line of
plain output from the metadata "nop".

Also add a "-n" option to the print_rc_normal function in rc.subr,
and make some cosmetic changes.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.165 04-Jun-2010 christos

print human readable exit code.


Revision tags: matt-premerge-20091211
# 1.164 11-Sep-2009 apb

Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
and which can suppress output in silent mode. Silent mode is enabled
via the new rc_silent variable, which defaults to a value that depends
on the kern.boothowto sysctl.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.163 10-Apr-2009 joerg

Add rc_directories to specify where to look for rc scripts.
For the moment all scripts must be in /root and non-existent directories
are skipped.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base mjf-devfs2-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.162 04-Jan-2003 lukem

branches: 1.162.42;
Change how internal boolean variables are used to:
if ! ${_somevar:-false}; then
_somevar=true
fi
(Consisent, slightly quicker, and slightly cleaner)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.161 19-May-2002 lukem

Add two new rc.conf(5) variables:
rc_rcorder_flags extra flags to rcorder(8) in /etc/rc
rcshutdown_rcorder_flags extra flags to rcorder(8) in /etc/rc.shutdown

This can be used to specify extra directories to search for rc.d scripts in.
For example, adding the following to rc.conf(5):
rc_rcorder_flags="/usr/pkg/etc/rc.d/*"
rcshutdown_rcorder_flags="/usr/pkg/etc/rc.d/*"
will add the files in /usr/pkg/etc/rc.d to the list of files that rcorder(8)
uses to build the list of scripts to start or stop.

I proposed this functionality on tech-userlevel@ over one month ago.
Closes the recent [misc/16888], which asked for a similar feature.


# 1.160 18-Apr-2002 lukem

consistently set rc_(fast|force)=yes


# 1.159 22-Mar-2002 lukem

- Rename a bunch of "internal" run_rc_command() variables and officially
make them "externally" available:
Previous Current Purpose
-------- ------- -------
_arg rc_arg Argument to command, after fast/force
processing performed (and prefix
removed)

_flags rc_flags Flags to start the default command
with. Defaults to ${name}_flags,
unless overridden by $flags from the
environment. This variable may be
changed by the precmd method.

_pid rc_pid PID of command (if appropriate).

_rc_run_fast rc_fast Not empty is "fast" was provided.

_rc_run_force rc_force Not empty is "force" was provided.

- Use rc_flags instead of _flags or ${name}_flags in various rc.d scripts,
so that $flags from the environment overrides ${name}_flags from rc.conf(5).
Fixes [bin/15800].


# 1.158 14-Jun-2001 lukem

use symbolic signal names instead of numbers


# 1.157 09-May-2001 lukem

explicitly set the umask to 022 to be safe


# 1.156 12-Mar-2001 lukem

move date before rcorder


# 1.155 28-Feb-2001 lukem

various speed-ups (and related work):
- only load rc.conf if $_rc_conf_loaded is not set
- use case instead of if for various string comparisons
- print the date at the start of the boot as well as at the end
- if $rc_fast_and_loose is set, always run the rc.d scripts in the
current shell rather than in a subshell. this is not on by default
because it's potentially dangerous (a rogue command could terminate
the boot), but it is provided as an optional speedup for people
with slow machines that have an expensive fork


# 1.154 15-Dec-2000 lukem

- describe what rc.shutdown does, and what invokes it
- remove `.sh' suffix on script name in description


# 1.153 21-Aug-2000 lukem

don't start rc.d scripts with a `nostart' keyword


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.152 22-Apr-2000 lukem

branches: 1.152.4;
revert previous; the fast-start functionality already existed, and
works at multi-user boot. (starting /etc/rc after single user boot
doesn't exhibit this fast start behaviour).


# 1.151 19-Apr-2000 simonb

Add an "rc_fastboot" variable check in rc.subr, that if set adds
"fast" to the start of the run_rc_command arg.

/etc/rc calls each rc.d script with rc_fastboot=yes so that rc.subr
aware scripts to use "faststart" to skip the process running check.


# 1.150 29-Mar-2000 enami

Check rc_configured also here, and bail out if it isn't set to yes.


# 1.149 10-Mar-2000 lukem

run scripts in /etc/rc.d/* in the order returned by rcorder


# 1.148 07-Mar-2000 jdolecek

make clearing of /tmp after reboot configurable (default on), as per recent
discussion on current-users


# 1.147 09-Feb-2000 itojun

ip6forwarding -> ip6mode change (somehow i forgot to commit...)
PR: 9375


# 1.146 05-Feb-2000 itojun

change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.


# 1.145 31-Jan-2000 jdc

Allow NFS servers to start up.


# 1.144 19-Jan-2000 tron

Start automount daemon even if NFS client is not activated. This makes
sense for system where "amd" is used to mount local devices like e.g.
CD-ROM drives. Fixes PR misc/9126 by Bjoern Labitzke.


# 1.143 19-Jan-2000 enami

Make some warning message consistient with others.


# 1.142 07-Jan-2000 enami

Since the logger(1) puts space between its arguments, there is no need
to pass it explicitly.


# 1.141 07-Jan-2000 enami

Make sure that warning message starts from the beginning of line. Some
warning recently added didn't care about it.


# 1.140 07-Jan-2000 enami

Cosmetic changes; folding long lines, using tab instead of spaces where
appropriate and fixing some indentation.


# 1.139 04-Jan-2000 lukem

don't need to background xfs now that it auto-backgrounds itself...


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.138 23-Nov-1999 hubertf

Add some boot time warnings:
- if ypserv=yes but portmap=no
- if yppasswdd=yes but ypserv=no
- if nfs_server=yes but portmap=no

Per discussion on tech-userlevel@netbsd.org.


# 1.137 23-Nov-1999 lukem

accounting should be controllable via $accounting=YES in rc.conf...


# 1.136 15-Nov-1999 fvdl

Remove update, it's no longer used.


Revision tags: comdex-fall-1999-base
# 1.135 30-Oct-1999 frueauf

Use checkyesno to check the state of $rc_configured like for any other
variable set in /etc/rc.conf. Pointed out by Erik Bertelsen
<erik@mediator.uni-c.dk> in pr 8522.


# 1.134 05-Oct-1999 darrenr

move old dev_mkdb and "kvm_mkdb /netbsd" up into the section which builds
kvm_mkdb based on machdep.boot_kernel. also failover to "kvm_mkdb /netbsd".


# 1.133 05-Oct-1999 darrenr

send sysctl machdep errors to /dev/null
merge in patches to implement multiple bootup configurations (look for
/etc/etc.current, /etc/etc.default and friends)
only start up NFS services if either nfs_client or nfs_server is yes.


# 1.132 28-Sep-1999 bouyer

Add support for $defcorename


# 1.131 16-Sep-1999 darrenr

branches: 1.131.2;
If machdep.booted_kernel can be found in sysctl output, feed that name into
kvm_mkdb so that when we boot we always have an upto-date kvm db, allowing
dmesg and friends to run without error when we do "boot netbsd.fun" to test
kernels, etc.


# 1.130 03-Sep-1999 itojun

add sanity check on rtadvd invocation (allowed on IPv6 routers only).
add rc.conf entry for rtsold.


# 1.129 28-Aug-1999 christos

check if vi recovery files are regular files before trying to e-mail them.
Stops a denial of service attack where the user can put a named pipe or
any other device that blocks i/o in /var/tmp/vi.recover/recover.*
[from dynamo@ime.net]


# 1.128 05-Aug-1999 christos

Create temp _motd file in /etc


# 1.127 03-Jul-1999 itojun

add IPv6 configuration (ip6forwarding, rtsol, route6d and rtadvd).
Right now netsetart does not bother you even if you do not have
"options INET6" in the kernel.


# 1.126 30-Jun-1999 augustss

usbd is dead.


# 1.125 13-Apr-1999 tron

Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.


Revision tags: netbsd-1-4-base
# 1.124 01-Apr-1999 cjs

branches: 1.124.2;
Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.


# 1.123 26-Mar-1999 drochner

start xdm after wscons configuration - the X server might want an own
virtual screen


# 1.122 26-Mar-1999 sommerfe

Add dhcrelay startup (allow only if dhcpd isn't started)


# 1.121 26-Mar-1999 oster

Nuke the line 'raidctl -r raid$dev'. a) The '-r' option is now '-i', and
b) with component labels and clean-bits working, this shouldn't be
required at all on each boot! Thanks to Andrew Gillham for pointing this out.


# 1.120 24-Mar-1999 mellon

- Move critical filesystem mounting code into a shell function and put
that in rc.subr.
- Support critfs_require_network rc.conf variable.


# 1.119 19-Mar-1999 perry

change to new syslog socket. make symlink from old to new location, too.


# 1.118 17-Mar-1999 drochner

rc.wscons can take arguments, so we shouldn't simply source it but exec in
a subshell. Being here, add a prototype wscons_flags variable.


# 1.117 14-Mar-1999 drochner

introduce a "wscons" rc.conf flag and run /etc/rc.wscons from /etc/rc
if it is set


# 1.116 07-Feb-1999 frueauf

No need to involve awk in the securelevel part, since sysctl has the -n switch.
Pointed out by NAKAJIMA Yoshihiro.


# 1.115 07-Feb-1999 bad

Use peers too when setting the time via ntpdate.


# 1.114 06-Feb-1999 frueauf

Add missing '' for awk in the securelevel part.


# 1.113 01-Feb-1999 mrg

oops, that's -n not -z. pointed out by hubert...


# 1.112 31-Jan-1999 mrg

increase the securelevel (using the same rules as before) much earlier in the
boot process. before cron, sendmail, inetd, etc, are run, but after lkms are
loaded. this avoids the chances of `@reboot', mail .forwards, remote logins,
etc., happening before the securelevel has been raised.


# 1.111 12-Jan-1999 mrg

support dmesg=NO and dmesg_flags, and do not cut the old boot messages..they might be useful. fix a typo (rbootd is not rarpd)


# 1.110 12-Jan-1999 jwise

Enable cron to be turned on and off from rc.conf, like other daemons.
From Soren S. Jorvang <soren@t.dk>, closes his PR bin/5250.


# 1.109 11-Jan-1999 jwise

Add $portmap_flags variable, now that portmap has optional flags, and
by default, pass '-l' flag (libwrap logging) by analogy with inetd


# 1.108 06-Jan-1999 abs

save a copy of the boot messages. Closes 6398 from msanders@confusion.net


# 1.107 04-Jan-1999 tron

Add support for RAIDframe configuration as suggested by Eric S. Hvozda
in PR install/6676.


# 1.106 21-Nov-1998 hubertf

allow /var/crash to be a symlink to a directory


# 1.105 12-Jul-1998 augustss

Add USB support. Supported so far:
* UHCI and OHCI host controllers on PCI
* Hubs
* HID devices withe special drivers for mouse and keyboard
* Printers


# 1.104 21-Jun-1998 tron

Strip comments from "${amd_master}".


# 1.103 07-Apr-1998 mrg

add "screenblank" support.


# 1.102 24-Feb-1998 lukem

send ntpdate output to syslog rather than stdout (with -s).
suggested by "Soren S. Jorvang" <soren@t.dk>


# 1.101 23-Feb-1998 lukem

exclude 127.127 servers when automagically determining ntpdate hosts


# 1.100 26-Jan-1998 lukem

include rc.subr and use appropriately


# 1.99 24-Jan-1998 veego

Move ipnat from /etc/netstart to /etc/rc after /usr is mounted.


# 1.98 09-Jan-1998 perry

Fix pr 4587 (from Matthias Scheler) -- pause slightly after xfs starts.


# 1.97 23-Nov-1997 mrg

print a warning if no swap devices are configured and "no_swap" is not YES.


# 1.96 11-Nov-1997 jonathan

Add options to rc.conf and rc to start xfs (x font server) and xdm.
Add entries to rc.conf.5.
While we're here, note that the domestic kerberos damons are still
Kerberos IV, not kerberos version 5.


Revision tags: netbsd-1-3-base
# 1.95 10-Oct-1997 drochner

branches: 1.95.2;
Replace the (slightly broken) check to avoid double mounting of
filesystems by a correct one. (too bad that there was no agreement
about a mount option doing the same...)
Introduce a new rc.conf variable to mount user-defined filesystems
early in startup (eg for syslog, crashdumps, ...).


# 1.94 07-Oct-1997 lukem

add $ipmon and $ipmon_flags, to control startup of ipmon(8)


# 1.93 12-Sep-1997 drochner

fix an rc.conf flag check which was broken with the "checkyesno" changes


# 1.92 12-Sep-1997 drochner

avoid to mount /usr twice if LKM load already did it


# 1.91 08-Sep-1997 mikel

no more DEFAULT for $ntpdate_hosts; from Geoff Wing in PR bin/4073


# 1.90 29-Aug-1997 veego

Curt, what is in rc.func ?
I only see rc.subr so I renamed rc.func to rc.subr.


# 1.89 29-Aug-1997 cjs

Split rc.conf variables for starting programs into two: an on/off
switch and a set of flags. Get rid of DEFAULT flags entirely. Print
warnings if on/off switches are not set, or are set incorrectly.
Add a shell function to simplify this on/off switch testing.


# 1.88 26-Aug-1997 thorpej

ldconfig processes /etc/ld.so.conf internally; run it without cat'ing
the contents into an argument vector.


# 1.87 05-Aug-1997 cjs

Move ntpdate before `starting network daemons' to get cleaner output
during boot. Besides, it's not a daemon anyway.


# 1.86 03-Aug-1997 perry

add apmd to /etc/rc and /etc/rc.conf per Lennart Augstsson in pr 3313


# 1.85 31-Jul-1997 perry

Fix boot time vi recovery as reported by NAKAJIMA Yoshihiro in pr-3430
Really weird bug. On inspection, the shell code in rc looked fine, but
when tested, sure enough, the semantics of the shell were not what I
thought they were. Very unexpected to me, and obviously to the
hundreds of people who must have read those lines without seeing that
they were broken.


# 1.84 15-Jul-1997 veego

Move savecore up before named to get a dump on low memory systems and
move 'mount -a' between yp and nfs daemons.


# 1.83 14-Jul-1997 drochner

Take 2 to get the mount order "right", taking care of possible LKM
loads before netstart this time.
LKMs can be loaded at 3 strategic places in /etc/rc - before netstart,
before "mount -a" and after all. "before netstart" works only if
the /usr filesystem is local (or on NFS, if root is too).
An additional field ("when") in lkm.conf controls when the LKM is
loaded.


# 1.82 11-Jul-1997 veego

Back out the last two commits for now till we find a better way to fix
the mount problems.


# 1.81 11-Jul-1997 veego

rc.lkm needs /usr/bin/ld, so try to mount it with -t nonfs before rc.lkm.


# 1.80 10-Jul-1997 drochner

Mount only "/" at the beginning (instead of all non-NFS filesystems).
This makes that the ordering of fstab is used for mounts which is
a) more intuitive and b) needed if {mfs,union,...} on top of NFS
is wanted.


# 1.79 25-Jun-1997 thorpej

Before disk checks are performed, do a "swapctl -A -t blk" so that
block-type devices are available during disk checks, which may consume
large amounts of memory if large file systems are present. Once "critical"
file systems (e.g. /usr and /var) are mounted, perform a "swapctl -A -t noblk"
to enable swapping on any swap files that may be listed in /etc/fstab.


# 1.78 12-Jun-1997 mrg

use swapctl instead of swapon


# 1.77 11-May-1997 cjs

Make xntpd put its pid in /var/run/xntpd.pid.


# 1.76 29-Apr-1997 scottr

Spawn a separate shell for netstart, making sure to check the return value
and exit with error if appropriate.


# 1.75 27-Apr-1997 perry

Add support for an ntpdate_hosts variable.
settings:
NO: don't run ntpdate on boot
DEFAULT:extract a list of hosts from /etc/ntp.conf
otherwise, a list of hosts to poll with ntpdate


# 1.74 23-Apr-1997 perry

make motd update conditional on an rc.conf variable (update_motd), and
move it before interactive logins are possible (just in case).


# 1.73 19-Apr-1997 perry

move last items from rc.local to rc; rc.local is now actually for local stuff.


# 1.72 17-Mar-1997 cjs

Added mopd.


# 1.71 12-Mar-1997 mycroft

When displaying the names for statd and lockd, include the `rpc.'.


# 1.70 12-Mar-1997 mycroft

Add . GC , which isn't used.


# 1.69 10-Mar-1997 mycroft

Do the DEFAULT thing with mountd_flags. Don't output an extra
newline for statd and lockd.


# 1.68 10-Mar-1997 mycroft

Minor cleanup.


# 1.67 10-Mar-1997 mycroft

If foo_flags is DEFAULT, run the program with a default set of flags. Most
users will use this, and therefore will never have to worry about flags
changing between releases. It's also a bit less error-prone.


# 1.66 10-Mar-1997 scottr

Add configuration flags for lockd/statd, and start them if an
NFS server or client is configured and the flags are not NO.


# 1.65 15-Feb-1997 mikel

cleanup Lite-1 merge


# 1.64 07-Feb-1997 mrg

oops; use $savecore_flags. from kilbi@rad.rwth-aachen.de


# 1.63 05-Jan-1997 mrg

move start-time configuration from netstart, rc, rc.local into
the new /etc/rc.conf. this also includes the following changes:

netstart: ifaliases now includes a netmask, to ensure
aliases work.

rc/rc.local: make _everything_ based on configuration
in rc.conf. also move things around such that DNS and
YP are started early enough that other daemons needing
their services also exist. move ldconfig from rc.local
here, and also make it use /etc/ld.so.conf if it exists.
run /etc/rc.lkm if it exists, a boot time.


# 1.62 04-Dec-1996 mrg

add inetd_flags, mostly from <jbernard@tater.Mines.EDU> in pr#2987


# 1.61 03-Oct-1996 mrg

add dhcpd startup; disabled by default


# 1.60 26-Aug-1996 tls

move rpc daemon startup to after network startup so that if the machine is a DNS server and wants to resolve via itself, one doesn't have to wait for all the DNS queries to time out as each rpc daemon starts. This was particularly ugly with mountd.


# 1.59 09-Aug-1996 thorpej

Quote the YP daemon flags variables.


# 1.58 09-Aug-1996 thorpej

Change how the YP daemons are started. Previously, ypbind was always
started if the directory /var/yp exists. Now, ypbind, ypserv, and
rpc.yppasswdd are started like other daemons; there are flags variables
for these programs. To disable them, set the variables to "NO", otherwise,
their contents are passed as flags.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.57 22-Mar-1996 mrg

add note about why we use /usr/sbin/sendmail.


# 1.56 22-Mar-1996 mrg

now that sendmail supports SIGHUP, call sendmail with full path.


# 1.55 30-Dec-1995 thorpej

Add $mrouted_flags to netstart and use it in rc to start mrouted in a manner
similar (well, identical, really) to how $routed_flags is used to start
routed.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.54 08-Oct-1995 thorpej

New-style RCS ids.


# 1.53 16-Sep-1995 jtc

fix typo in comment


# 1.52 02-Sep-1995 thorpej

Conditionally start rbootd like rarpd and rpc.bootparamd, and disable
it by default.


# 1.51 02-Sep-1995 thorpej

Fix typos in two comments.


# 1.50 27-Aug-1995 thorpej

Configure ccd devices before the filesystem checks, as suggested by
Thomas Eberhardt in PR #1408.


# 1.49 04-Nov-1994 briggs

Actually pass all the arguments to amd that we meant to. Reported by
Dave Leonard (D.Leonard@pleiades.newcastle.edu.au).


# 1.48 16-Sep-1994 mycroft

Create an empty mountdtab after removing it, to avoid getting a warning
from mountd on startup. Change $name_server to $named_flags.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.47 27-Jun-1994 deraadt

always check quotas (there is no reason not to try)


# 1.46 24-Jun-1994 deraadt

quotas file(s) changed name in 4.4-lite


# 1.45 18-Jun-1994 cgd

if install will do the trick, why not use it\?


# 1.44 08-Jun-1994 mycroft

Update nfsd and nfsiod invocations.


# 1.43 03-Jun-1994 jtc

Move building of link editor cache from rc to rc.local, like in SunOS,
because the end user may need to add local directories to be searched.
And rc.local is a much more appropriate place for local changes.

I emailed pk on this matter, and he said that the overhead of not
having linker hints for the daemons started by rc would not be
significant.

This change also closes bug #217.


# 1.42 29-May-1994 mycroft

Attempt to make sure /var is mounted before futzing with it.


# 1.41 29-May-1994 jtc

Move code that cleans /var/run so that it is before the automount deamon
startup puts its pid file there (This addressess most of bug #217).


# 1.40 10-Apr-1994 cgd

add ttyflags -a, early on in rc.


# 1.39 28-Mar-1994 cgd

keep amd pid in /var/run/amd.pid


# 1.38 18-Mar-1994 cgd

punctuation


# 1.37 17-Mar-1994 cgd

kill uucp lock files. from Mike Long <mike.long@analog.com>


# 1.36 14-Mar-1994 cgd

slight change to the way AMD is invoked, to make it sensible for most uses


# 1.35 09-Mar-1994 cgd

make booting comments a bit cleaner


# 1.34 26-Feb-1994 cgd

automatically enable accounting and rotate logs


# 1.33 01-Feb-1994 cgd

don't delete preserve files!


# 1.32 30-Jan-1994 mycroft

Do the right thing for nvi.


# 1.31 13-Jan-1994 jtc

The cron daemon now lives in /usr/sbin


# 1.30 10-Jan-1994 mycroft

Add bootparamd gunk.


# 1.29 10-Jan-1994 mycroft

Add rarpd gunk.


# 1.28 05-Jan-1994 jtc

The cron daemon has been renamed from crond to cron. This name change
is from Vixie Cron 3.0, to make it like the 4.3BSD cron.


# 1.27 05-Jan-1994 deraadt

start amd if requested
do nfs mounting after mountd has been started (so two machines can cross-mount
nfs from each other, else they hang if booted simultaneously)


# 1.26 16-Dec-1993 deraadt

initialize rpc services in proper order


# 1.25 15-Dec-1993 mycroft

Use `.' to run rc.local, rather than starting another shell, so that variables
from netstart are passed on.


# 1.24 01-Dec-1993 cgd

fix comment, add check


# 1.23 26-Nov-1993 mycroft

Put ldconfig later so it doesn't get wiped when reaping /var/run.


# 1.22 21-Nov-1993 mycroft

Build ld.so.hints on each boot.


# 1.21 17-Nov-1993 cgd

more flags


# 1.20 17-Nov-1993 cgd

quote sendmail_flags test, from Patrick Bridges <patrick@buffy.cs.msstate.edu>


# 1.19 07-Nov-1993 cgd

(1) clean up lots (rename fooflags -> foo_flags, etc.)
(2) implement suggestion made by Garrett Wollman of "sendmail flags"
to set flags passed to sendmail and/or turn it off
(3) document origins of variables


# 1.18 20-Oct-1993 cgd

never rotate accounting logs, and turn on accounting the way done in net/2


# 1.17 05-Sep-1993 mycroft

Use `-e fastboot', not `-r fastboot'.


# 1.16 01-Sep-1993 deraadt

it's clear that mountd started from inetd doesn't work


# 1.15 25-Aug-1993 brezak

mountd is now started by inetd.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.14 11-Jun-1993 brezak

Don't start rwalld - now started by inetd.


# 1.13 03-May-1993 cgd

prune dirs rm'd when cleaning tmp


# 1.12 03-May-1993 cgd

turn on accounting if /var/account exists


# 1.11 28-Apr-1993 cgd

bsd->netbsd


# 1.10 28-Apr-1993 cgd

new kernel is bsd


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.9 10-Apr-1993 glass

fixes for nfs_client, nfs_server division.


# 1.8 10-Apr-1993 cgd

always run portmap


# 1.7 10-Apr-1993 glass

mountd's log of who has what filesystem mounted should not persist across
reboots.


# 1.6 09-Apr-1993 cgd

rwalld should be run *after* the portmapper.


# 1.5 05-Apr-1993 cgd

screwed it up again... = vs ==.


# 1.4 05-Apr-1993 cgd

screwed up comparison for rwalld and rwhod...


# 1.3 04-Apr-1993 cgd

updated for addition of rwalld


# 1.2 02-Apr-1993 cgd

got rid of damned highlight characters, and changed
method to turn on rwhod.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.172 02-Feb-2017 christos

add +


# 1.171 02-Feb-2017 christos

set 7 and 8 to close on exec.


Revision tags: netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.170 29-Jul-2014 apb

In the background subshell that flushes partial output every few
seconds, detach from the controlling terminal. Without this, pressing
control-T (to send SIGINFO from the terminal) would almost always result
in the sleep process printing "about N seconds left of the original 3",
which is useless information.


# 1.169 27-Jul-2014 apb

In rc.subr, add _have_rc_postprocessor function and use it instead of
inline tests like [ -n "${_rc_postprocessor_fd}" ]. The new function
performs a few new tests, including verifying that /etc/rc is still
running (using a new _rc_pid variable set by /etc/rc).

This is intended to deal with the case that a script run from /etc/rc
spawns a background process, then /etc/rc exits, but the background
process still has environment variables inherited from /etc/rc.

Fixes PR 46546.


Revision tags: yamt-pagecache-base9
# 1.168 09-Apr-2014 apb

Send a "nop" metadata message to the postprocessor every few seconds,
to flush partial output lines. This should help with PR 48714.


# 1.167 09-Apr-2014 apb

Add comments about the intended use of each type of metadata message.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.166 11-Aug-2011 apb

branches: 1.166.2; 1.166.8; 1.166.20;
Allow "echo -n" to work as expected in rc.d scripts that are executed
by /etc/rc. Similarly for printf with a format that does not end with
"\n". Previously, the partial line would not be visible on the console
until a newline was printed, possibly after an annoying delay.

This is done by adding echo() and printf() shell functions to rc.subr,
so that naive use of the echo and printf commands in rc.d scripts will
call these functions instead of the underlying commands. These shell
functions send a new "nop" metadata message after the partial line, and
the rc_postprocess function in /etc/rc disentangles the partial line of
plain output from the metadata "nop".

Also add a "-n" option to the print_rc_normal function in rc.subr,
and make some cosmetic changes.


Revision tags: cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base matt-mips64-premerge-20101231
# 1.165 04-Jun-2010 christos

print human readable exit code.


Revision tags: matt-premerge-20091211
# 1.164 11-Sep-2009 apb

Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
and which can suppress output in silent mode. Silent mode is enabled
via the new rc_silent variable, which defaults to a value that depends
on the kern.boothowto sysctl.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.


Revision tags: jym-xensuspend-nbase jym-xensuspend-base
# 1.163 10-Apr-2009 joerg

Add rc_directories to specify where to look for rc scripts.
For the moment all scripts must be in /root and non-existent directories
are skipped.


Revision tags: netbsd-5-2-3-RELEASE netbsd-5-1-5-RELEASE netbsd-5-2-2-RELEASE netbsd-5-1-4-RELEASE netbsd-5-2-1-RELEASE netbsd-5-1-3-RELEASE netbsd-5-2-RELEASE netbsd-5-2-RC1 netbsd-5-1-2-RELEASE netbsd-5-1-1-RELEASE matt-nb5-mips64-premerge-20101231 matt-nb5-pq3-base netbsd-5-1-RELEASE netbsd-5-1-RC4 matt-nb5-mips64-k15 netbsd-5-1-RC3 netbsd-5-1-RC2 netbsd-5-1-RC1 netbsd-5-0-2-RELEASE matt-nb5-mips64-premerge-20091211 matt-nb5-mips64-u2-k2-k4-k7-k8-k9 matt-nb4-mips64-k7-u2a-k9b matt-nb5-mips64-u1-k1-k5 netbsd-5-0-1-RELEASE netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 netbsd-5-0-RC2 netbsd-5-0-RC1 mjf-devfs2-base2 netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base mjf-devfs2-base keiichi-mipv6-base mjf-devfs-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE wrstuden-fixsa-base abandoned-netbsd-4-base netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-4-base netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-3-base netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.162 04-Jan-2003 lukem

branches: 1.162.42;
Change how internal boolean variables are used to:
if ! ${_somevar:-false}; then
_somevar=true
fi
(Consisent, slightly quicker, and slightly cleaner)


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 fvdl_fs64_base netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base
# 1.161 19-May-2002 lukem

Add two new rc.conf(5) variables:
rc_rcorder_flags extra flags to rcorder(8) in /etc/rc
rcshutdown_rcorder_flags extra flags to rcorder(8) in /etc/rc.shutdown

This can be used to specify extra directories to search for rc.d scripts in.
For example, adding the following to rc.conf(5):
rc_rcorder_flags="/usr/pkg/etc/rc.d/*"
rcshutdown_rcorder_flags="/usr/pkg/etc/rc.d/*"
will add the files in /usr/pkg/etc/rc.d to the list of files that rcorder(8)
uses to build the list of scripts to start or stop.

I proposed this functionality on tech-userlevel@ over one month ago.
Closes the recent [misc/16888], which asked for a similar feature.


# 1.160 18-Apr-2002 lukem

consistently set rc_(fast|force)=yes


# 1.159 22-Mar-2002 lukem

- Rename a bunch of "internal" run_rc_command() variables and officially
make them "externally" available:
Previous Current Purpose
-------- ------- -------
_arg rc_arg Argument to command, after fast/force
processing performed (and prefix
removed)

_flags rc_flags Flags to start the default command
with. Defaults to ${name}_flags,
unless overridden by $flags from the
environment. This variable may be
changed by the precmd method.

_pid rc_pid PID of command (if appropriate).

_rc_run_fast rc_fast Not empty is "fast" was provided.

_rc_run_force rc_force Not empty is "force" was provided.

- Use rc_flags instead of _flags or ${name}_flags in various rc.d scripts,
so that $flags from the environment overrides ${name}_flags from rc.conf(5).
Fixes [bin/15800].


# 1.158 14-Jun-2001 lukem

use symbolic signal names instead of numbers


# 1.157 09-May-2001 lukem

explicitly set the umask to 022 to be safe


# 1.156 12-Mar-2001 lukem

move date before rcorder


# 1.155 28-Feb-2001 lukem

various speed-ups (and related work):
- only load rc.conf if $_rc_conf_loaded is not set
- use case instead of if for various string comparisons
- print the date at the start of the boot as well as at the end
- if $rc_fast_and_loose is set, always run the rc.d scripts in the
current shell rather than in a subshell. this is not on by default
because it's potentially dangerous (a rogue command could terminate
the boot), but it is provided as an optional speedup for people
with slow machines that have an expensive fork


# 1.154 15-Dec-2000 lukem

- describe what rc.shutdown does, and what invokes it
- remove `.sh' suffix on script name in description


# 1.153 21-Aug-2000 lukem

don't start rc.d scripts with a `nostart' keyword


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base
# 1.152 22-Apr-2000 lukem

branches: 1.152.4;
revert previous; the fast-start functionality already existed, and
works at multi-user boot. (starting /etc/rc after single user boot
doesn't exhibit this fast start behaviour).


# 1.151 19-Apr-2000 simonb

Add an "rc_fastboot" variable check in rc.subr, that if set adds
"fast" to the start of the run_rc_command arg.

/etc/rc calls each rc.d script with rc_fastboot=yes so that rc.subr
aware scripts to use "faststart" to skip the process running check.


# 1.150 29-Mar-2000 enami

Check rc_configured also here, and bail out if it isn't set to yes.


# 1.149 10-Mar-2000 lukem

run scripts in /etc/rc.d/* in the order returned by rcorder


# 1.148 07-Mar-2000 jdolecek

make clearing of /tmp after reboot configurable (default on), as per recent
discussion on current-users


# 1.147 09-Feb-2000 itojun

ip6forwarding -> ip6mode change (somehow i forgot to commit...)
PR: 9375


# 1.146 05-Feb-2000 itojun

change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.


# 1.145 31-Jan-2000 jdc

Allow NFS servers to start up.


# 1.144 19-Jan-2000 tron

Start automount daemon even if NFS client is not activated. This makes
sense for system where "amd" is used to mount local devices like e.g.
CD-ROM drives. Fixes PR misc/9126 by Bjoern Labitzke.


# 1.143 19-Jan-2000 enami

Make some warning message consistient with others.


# 1.142 07-Jan-2000 enami

Since the logger(1) puts space between its arguments, there is no need
to pass it explicitly.


# 1.141 07-Jan-2000 enami

Make sure that warning message starts from the beginning of line. Some
warning recently added didn't care about it.


# 1.140 07-Jan-2000 enami

Cosmetic changes; folding long lines, using tab instead of spaces where
appropriate and fixing some indentation.


# 1.139 04-Jan-2000 lukem

don't need to background xfs now that it auto-backgrounds itself...


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base
# 1.138 23-Nov-1999 hubertf

Add some boot time warnings:
- if ypserv=yes but portmap=no
- if yppasswdd=yes but ypserv=no
- if nfs_server=yes but portmap=no

Per discussion on tech-userlevel@netbsd.org.


# 1.137 23-Nov-1999 lukem

accounting should be controllable via $accounting=YES in rc.conf...


# 1.136 15-Nov-1999 fvdl

Remove update, it's no longer used.


Revision tags: comdex-fall-1999-base
# 1.135 30-Oct-1999 frueauf

Use checkyesno to check the state of $rc_configured like for any other
variable set in /etc/rc.conf. Pointed out by Erik Bertelsen
<erik@mediator.uni-c.dk> in pr 8522.


# 1.134 05-Oct-1999 darrenr

move old dev_mkdb and "kvm_mkdb /netbsd" up into the section which builds
kvm_mkdb based on machdep.boot_kernel. also failover to "kvm_mkdb /netbsd".


# 1.133 05-Oct-1999 darrenr

send sysctl machdep errors to /dev/null
merge in patches to implement multiple bootup configurations (look for
/etc/etc.current, /etc/etc.default and friends)
only start up NFS services if either nfs_client or nfs_server is yes.


# 1.132 28-Sep-1999 bouyer

Add support for $defcorename


# 1.131 16-Sep-1999 darrenr

branches: 1.131.2;
If machdep.booted_kernel can be found in sysctl output, feed that name into
kvm_mkdb so that when we boot we always have an upto-date kvm db, allowing
dmesg and friends to run without error when we do "boot netbsd.fun" to test
kernels, etc.


# 1.130 03-Sep-1999 itojun

add sanity check on rtadvd invocation (allowed on IPv6 routers only).
add rc.conf entry for rtsold.


# 1.129 28-Aug-1999 christos

check if vi recovery files are regular files before trying to e-mail them.
Stops a denial of service attack where the user can put a named pipe or
any other device that blocks i/o in /var/tmp/vi.recover/recover.*
[from dynamo@ime.net]


# 1.128 05-Aug-1999 christos

Create temp _motd file in /etc


# 1.127 03-Jul-1999 itojun

add IPv6 configuration (ip6forwarding, rtsol, route6d and rtadvd).
Right now netsetart does not bother you even if you do not have
"options INET6" in the kernel.


# 1.126 30-Jun-1999 augustss

usbd is dead.


# 1.125 13-Apr-1999 tron

Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.


Revision tags: netbsd-1-4-base
# 1.124 01-Apr-1999 cjs

branches: 1.124.2;
Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.


# 1.123 26-Mar-1999 drochner

start xdm after wscons configuration - the X server might want an own
virtual screen


# 1.122 26-Mar-1999 sommerfe

Add dhcrelay startup (allow only if dhcpd isn't started)


# 1.121 26-Mar-1999 oster

Nuke the line 'raidctl -r raid$dev'. a) The '-r' option is now '-i', and
b) with component labels and clean-bits working, this shouldn't be
required at all on each boot! Thanks to Andrew Gillham for pointing this out.


# 1.120 24-Mar-1999 mellon

- Move critical filesystem mounting code into a shell function and put
that in rc.subr.
- Support critfs_require_network rc.conf variable.


# 1.119 19-Mar-1999 perry

change to new syslog socket. make symlink from old to new location, too.


# 1.118 17-Mar-1999 drochner

rc.wscons can take arguments, so we shouldn't simply source it but exec in
a subshell. Being here, add a prototype wscons_flags variable.


# 1.117 14-Mar-1999 drochner

introduce a "wscons" rc.conf flag and run /etc/rc.wscons from /etc/rc
if it is set


# 1.116 07-Feb-1999 frueauf

No need to involve awk in the securelevel part, since sysctl has the -n switch.
Pointed out by NAKAJIMA Yoshihiro.


# 1.115 07-Feb-1999 bad

Use peers too when setting the time via ntpdate.


# 1.114 06-Feb-1999 frueauf

Add missing '' for awk in the securelevel part.


# 1.113 01-Feb-1999 mrg

oops, that's -n not -z. pointed out by hubert...


# 1.112 31-Jan-1999 mrg

increase the securelevel (using the same rules as before) much earlier in the
boot process. before cron, sendmail, inetd, etc, are run, but after lkms are
loaded. this avoids the chances of `@reboot', mail .forwards, remote logins,
etc., happening before the securelevel has been raised.


# 1.111 12-Jan-1999 mrg

support dmesg=NO and dmesg_flags, and do not cut the old boot messages..they might be useful. fix a typo (rbootd is not rarpd)


# 1.110 12-Jan-1999 jwise

Enable cron to be turned on and off from rc.conf, like other daemons.
From Soren S. Jorvang <soren@t.dk>, closes his PR bin/5250.


# 1.109 11-Jan-1999 jwise

Add $portmap_flags variable, now that portmap has optional flags, and
by default, pass '-l' flag (libwrap logging) by analogy with inetd


# 1.108 06-Jan-1999 abs

save a copy of the boot messages. Closes 6398 from msanders@confusion.net


# 1.107 04-Jan-1999 tron

Add support for RAIDframe configuration as suggested by Eric S. Hvozda
in PR install/6676.


# 1.106 21-Nov-1998 hubertf

allow /var/crash to be a symlink to a directory


# 1.105 12-Jul-1998 augustss

Add USB support. Supported so far:
* UHCI and OHCI host controllers on PCI
* Hubs
* HID devices withe special drivers for mouse and keyboard
* Printers


# 1.104 21-Jun-1998 tron

Strip comments from "${amd_master}".


# 1.103 07-Apr-1998 mrg

add "screenblank" support.


# 1.102 24-Feb-1998 lukem

send ntpdate output to syslog rather than stdout (with -s).
suggested by "Soren S. Jorvang" <soren@t.dk>


# 1.101 23-Feb-1998 lukem

exclude 127.127 servers when automagically determining ntpdate hosts


# 1.100 26-Jan-1998 lukem

include rc.subr and use appropriately


# 1.99 24-Jan-1998 veego

Move ipnat from /etc/netstart to /etc/rc after /usr is mounted.


# 1.98 09-Jan-1998 perry

Fix pr 4587 (from Matthias Scheler) -- pause slightly after xfs starts.


# 1.97 23-Nov-1997 mrg

print a warning if no swap devices are configured and "no_swap" is not YES.


# 1.96 11-Nov-1997 jonathan

Add options to rc.conf and rc to start xfs (x font server) and xdm.
Add entries to rc.conf.5.
While we're here, note that the domestic kerberos damons are still
Kerberos IV, not kerberos version 5.


Revision tags: netbsd-1-3-base
# 1.95 10-Oct-1997 drochner

branches: 1.95.2;
Replace the (slightly broken) check to avoid double mounting of
filesystems by a correct one. (too bad that there was no agreement
about a mount option doing the same...)
Introduce a new rc.conf variable to mount user-defined filesystems
early in startup (eg for syslog, crashdumps, ...).


# 1.94 07-Oct-1997 lukem

add $ipmon and $ipmon_flags, to control startup of ipmon(8)


# 1.93 12-Sep-1997 drochner

fix an rc.conf flag check which was broken with the "checkyesno" changes


# 1.92 12-Sep-1997 drochner

avoid to mount /usr twice if LKM load already did it


# 1.91 08-Sep-1997 mikel

no more DEFAULT for $ntpdate_hosts; from Geoff Wing in PR bin/4073


# 1.90 29-Aug-1997 veego

Curt, what is in rc.func ?
I only see rc.subr so I renamed rc.func to rc.subr.


# 1.89 29-Aug-1997 cjs

Split rc.conf variables for starting programs into two: an on/off
switch and a set of flags. Get rid of DEFAULT flags entirely. Print
warnings if on/off switches are not set, or are set incorrectly.
Add a shell function to simplify this on/off switch testing.


# 1.88 26-Aug-1997 thorpej

ldconfig processes /etc/ld.so.conf internally; run it without cat'ing
the contents into an argument vector.


# 1.87 05-Aug-1997 cjs

Move ntpdate before `starting network daemons' to get cleaner output
during boot. Besides, it's not a daemon anyway.


# 1.86 03-Aug-1997 perry

add apmd to /etc/rc and /etc/rc.conf per Lennart Augstsson in pr 3313


# 1.85 31-Jul-1997 perry

Fix boot time vi recovery as reported by NAKAJIMA Yoshihiro in pr-3430
Really weird bug. On inspection, the shell code in rc looked fine, but
when tested, sure enough, the semantics of the shell were not what I
thought they were. Very unexpected to me, and obviously to the
hundreds of people who must have read those lines without seeing that
they were broken.


# 1.84 15-Jul-1997 veego

Move savecore up before named to get a dump on low memory systems and
move 'mount -a' between yp and nfs daemons.


# 1.83 14-Jul-1997 drochner

Take 2 to get the mount order "right", taking care of possible LKM
loads before netstart this time.
LKMs can be loaded at 3 strategic places in /etc/rc - before netstart,
before "mount -a" and after all. "before netstart" works only if
the /usr filesystem is local (or on NFS, if root is too).
An additional field ("when") in lkm.conf controls when the LKM is
loaded.


# 1.82 11-Jul-1997 veego

Back out the last two commits for now till we find a better way to fix
the mount problems.


# 1.81 11-Jul-1997 veego

rc.lkm needs /usr/bin/ld, so try to mount it with -t nonfs before rc.lkm.


# 1.80 10-Jul-1997 drochner

Mount only "/" at the beginning (instead of all non-NFS filesystems).
This makes that the ordering of fstab is used for mounts which is
a) more intuitive and b) needed if {mfs,union,...} on top of NFS
is wanted.


# 1.79 25-Jun-1997 thorpej

Before disk checks are performed, do a "swapctl -A -t blk" so that
block-type devices are available during disk checks, which may consume
large amounts of memory if large file systems are present. Once "critical"
file systems (e.g. /usr and /var) are mounted, perform a "swapctl -A -t noblk"
to enable swapping on any swap files that may be listed in /etc/fstab.


# 1.78 12-Jun-1997 mrg

use swapctl instead of swapon


# 1.77 11-May-1997 cjs

Make xntpd put its pid in /var/run/xntpd.pid.


# 1.76 29-Apr-1997 scottr

Spawn a separate shell for netstart, making sure to check the return value
and exit with error if appropriate.


# 1.75 27-Apr-1997 perry

Add support for an ntpdate_hosts variable.
settings:
NO: don't run ntpdate on boot
DEFAULT:extract a list of hosts from /etc/ntp.conf
otherwise, a list of hosts to poll with ntpdate


# 1.74 23-Apr-1997 perry

make motd update conditional on an rc.conf variable (update_motd), and
move it before interactive logins are possible (just in case).


# 1.73 19-Apr-1997 perry

move last items from rc.local to rc; rc.local is now actually for local stuff.


# 1.72 17-Mar-1997 cjs

Added mopd.


# 1.71 12-Mar-1997 mycroft

When displaying the names for statd and lockd, include the `rpc.'.


# 1.70 12-Mar-1997 mycroft

Add . GC , which isn't used.


# 1.69 10-Mar-1997 mycroft

Do the DEFAULT thing with mountd_flags. Don't output an extra
newline for statd and lockd.


# 1.68 10-Mar-1997 mycroft

Minor cleanup.


# 1.67 10-Mar-1997 mycroft

If foo_flags is DEFAULT, run the program with a default set of flags. Most
users will use this, and therefore will never have to worry about flags
changing between releases. It's also a bit less error-prone.


# 1.66 10-Mar-1997 scottr

Add configuration flags for lockd/statd, and start them if an
NFS server or client is configured and the flags are not NO.


# 1.65 15-Feb-1997 mikel

cleanup Lite-1 merge


# 1.64 07-Feb-1997 mrg

oops; use $savecore_flags. from kilbi@rad.rwth-aachen.de


# 1.63 05-Jan-1997 mrg

move start-time configuration from netstart, rc, rc.local into
the new /etc/rc.conf. this also includes the following changes:

netstart: ifaliases now includes a netmask, to ensure
aliases work.

rc/rc.local: make _everything_ based on configuration
in rc.conf. also move things around such that DNS and
YP are started early enough that other daemons needing
their services also exist. move ldconfig from rc.local
here, and also make it use /etc/ld.so.conf if it exists.
run /etc/rc.lkm if it exists, a boot time.


# 1.62 04-Dec-1996 mrg

add inetd_flags, mostly from <jbernard@tater.Mines.EDU> in pr#2987


# 1.61 03-Oct-1996 mrg

add dhcpd startup; disabled by default


# 1.60 26-Aug-1996 tls

move rpc daemon startup to after network startup so that if the machine is a DNS server and wants to resolve via itself, one doesn't have to wait for all the DNS queries to time out as each rpc daemon starts. This was particularly ugly with mountd.


# 1.59 09-Aug-1996 thorpej

Quote the YP daemon flags variables.


# 1.58 09-Aug-1996 thorpej

Change how the YP daemons are started. Previously, ypbind was always
started if the directory /var/yp exists. Now, ypbind, ypserv, and
rpc.yppasswdd are started like other daemons; there are flags variables
for these programs. To disable them, set the variables to "NO", otherwise,
their contents are passed as flags.


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.57 22-Mar-1996 mrg

add note about why we use /usr/sbin/sendmail.


# 1.56 22-Mar-1996 mrg

now that sendmail supports SIGHUP, call sendmail with full path.


# 1.55 30-Dec-1995 thorpej

Add $mrouted_flags to netstart and use it in rc to start mrouted in a manner
similar (well, identical, really) to how $routed_flags is used to start
routed.


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.54 08-Oct-1995 thorpej

New-style RCS ids.


# 1.53 16-Sep-1995 jtc

fix typo in comment


# 1.52 02-Sep-1995 thorpej

Conditionally start rbootd like rarpd and rpc.bootparamd, and disable
it by default.


# 1.51 02-Sep-1995 thorpej

Fix typos in two comments.


# 1.50 27-Aug-1995 thorpej

Configure ccd devices before the filesystem checks, as suggested by
Thomas Eberhardt in PR #1408.


# 1.49 04-Nov-1994 briggs

Actually pass all the arguments to amd that we meant to. Reported by
Dave Leonard (D.Leonard@pleiades.newcastle.edu.au).


# 1.48 16-Sep-1994 mycroft

Create an empty mountdtab after removing it, to avoid getting a warning
from mountd on startup. Change $name_server to $named_flags.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.47 27-Jun-1994 deraadt

always check quotas (there is no reason not to try)


# 1.46 24-Jun-1994 deraadt

quotas file(s) changed name in 4.4-lite


# 1.45 18-Jun-1994 cgd

if install will do the trick, why not use it\?


# 1.44 08-Jun-1994 mycroft

Update nfsd and nfsiod invocations.


# 1.43 03-Jun-1994 jtc

Move building of link editor cache from rc to rc.local, like in SunOS,
because the end user may need to add local directories to be searched.
And rc.local is a much more appropriate place for local changes.

I emailed pk on this matter, and he said that the overhead of not
having linker hints for the daemons started by rc would not be
significant.

This change also closes bug #217.


# 1.42 29-May-1994 mycroft

Attempt to make sure /var is mounted before futzing with it.


# 1.41 29-May-1994 jtc

Move code that cleans /var/run so that it is before the automount deamon
startup puts its pid file there (This addressess most of bug #217).


# 1.40 10-Apr-1994 cgd

add ttyflags -a, early on in rc.


# 1.39 28-Mar-1994 cgd

keep amd pid in /var/run/amd.pid


# 1.38 18-Mar-1994 cgd

punctuation


# 1.37 17-Mar-1994 cgd

kill uucp lock files. from Mike Long <mike.long@analog.com>


# 1.36 14-Mar-1994 cgd

slight change to the way AMD is invoked, to make it sensible for most uses


# 1.35 09-Mar-1994 cgd

make booting comments a bit cleaner


# 1.34 26-Feb-1994 cgd

automatically enable accounting and rotate logs


# 1.33 01-Feb-1994 cgd

don't delete preserve files!


# 1.32 30-Jan-1994 mycroft

Do the right thing for nvi.


# 1.31 13-Jan-1994 jtc

The cron daemon now lives in /usr/sbin


# 1.30 10-Jan-1994 mycroft

Add bootparamd gunk.


# 1.29 10-Jan-1994 mycroft

Add rarpd gunk.


# 1.28 05-Jan-1994 jtc

The cron daemon has been renamed from crond to cron. This name change
is from Vixie Cron 3.0, to make it like the 4.3BSD cron.


# 1.27 05-Jan-1994 deraadt

start amd if requested
do nfs mounting after mountd has been started (so two machines can cross-mount
nfs from each other, else they hang if booted simultaneously)


# 1.26 16-Dec-1993 deraadt

initialize rpc services in proper order


# 1.25 15-Dec-1993 mycroft

Use `.' to run rc.local, rather than starting another shell, so that variables
from netstart are passed on.


# 1.24 01-Dec-1993 cgd

fix comment, add check


# 1.23 26-Nov-1993 mycroft

Put ldconfig later so it doesn't get wiped when reaping /var/run.


# 1.22 21-Nov-1993 mycroft

Build ld.so.hints on each boot.


# 1.21 17-Nov-1993 cgd

more flags


# 1.20 17-Nov-1993 cgd

quote sendmail_flags test, from Patrick Bridges <patrick@buffy.cs.msstate.edu>


# 1.19 07-Nov-1993 cgd

(1) clean up lots (rename fooflags -> foo_flags, etc.)
(2) implement suggestion made by Garrett Wollman of "sendmail flags"
to set flags passed to sendmail and/or turn it off
(3) document origins of variables


# 1.18 20-Oct-1993 cgd

never rotate accounting logs, and turn on accounting the way done in net/2


# 1.17 05-Sep-1993 mycroft

Use `-e fastboot', not `-r fastboot'.


# 1.16 01-Sep-1993 deraadt

it's clear that mountd started from inetd doesn't work


# 1.15 25-Aug-1993 brezak

mountd is now started by inetd.


Revision tags: netbsd-0-9-RELEASE netbsd-0-9-BETA netbsd-0-9-ALPHA2 netbsd-0-9-ALPHA netbsd-0-9-base
# 1.14 11-Jun-1993 brezak

Don't start rwalld - now started by inetd.


# 1.13 03-May-1993 cgd

prune dirs rm'd when cleaning tmp


# 1.12 03-May-1993 cgd

turn on accounting if /var/account exists


# 1.11 28-Apr-1993 cgd

bsd->netbsd


# 1.10 28-Apr-1993 cgd

new kernel is bsd


Revision tags: netbsd-0-8 netbsd-alpha-1
# 1.9 10-Apr-1993 glass

fixes for nfs_client, nfs_server division.


# 1.8 10-Apr-1993 cgd

always run portmap


# 1.7 10-Apr-1993 glass

mountd's log of who has what filesystem mounted should not persist across
reboots.


# 1.6 09-Apr-1993 cgd

rwalld should be run *after* the portmapper.


# 1.5 05-Apr-1993 cgd

screwed it up again... = vs ==.


# 1.4 05-Apr-1993 cgd

screwed up comparison for rwalld and rwhod...


# 1.3 04-Apr-1993 cgd

updated for addition of rwalld


# 1.2 02-Apr-1993 cgd

got rid of damned highlight characters, and changed
method to turn on rwhod.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.170 29-Jul-2014 apb

In the background subshell that flushes partial output every few
seconds, detach from the controlling terminal. Without this, pressing
control-T (to send SIGINFO from the terminal) would almost always result
in the sleep process printing "about N seconds left of the original 3",
which is useless information.


# 1.169 27-Jul-2014 apb

In rc.subr, add _have_rc_postprocessor function and use it instead of
inline tests like [ -n "${_rc_postprocessor_fd}" ]. The new function
performs a few new tests, including verifying that /etc/rc is still
running (using a new _rc_pid variable set by /etc/rc).

This is intended to deal with the case that a script run from /etc/rc
spawns a background process, then /etc/rc exits, but the background
process still has environment variables inherited from /etc/rc.

Fixes PR 46546.


# 1.168 09-Apr-2014 apb

Send a "nop" metadata message to the postprocessor every few seconds,
to flush partial output lines. This should help with PR 48714.


# 1.167 09-Apr-2014 apb

Add comments about the intended use of each type of metadata message.


# 1.166 11-Aug-2011 apb

branches: 1.166.2; 1.166.8; 1.166.20;
Allow "echo -n" to work as expected in rc.d scripts that are executed
by /etc/rc. Similarly for printf with a format that does not end with
"\n". Previously, the partial line would not be visible on the console
until a newline was printed, possibly after an annoying delay.

This is done by adding echo() and printf() shell functions to rc.subr,
so that naive use of the echo and printf commands in rc.d scripts will
call these functions instead of the underlying commands. These shell
functions send a new "nop" metadata message after the partial line, and
the rc_postprocess function in /etc/rc disentangles the partial line of
plain output from the metadata "nop".

Also add a "-n" option to the print_rc_normal function in rc.subr,
and make some cosmetic changes.


# 1.165 04-Jun-2010 christos

print human readable exit code.


# 1.164 11-Sep-2009 apb

Add a postprocessor to /etc/rc, which logs messages to /var/run/rc.log,
and which can suppress output in silent mode. Silent mode is enabled
via the new rc_silent variable, which defaults to a value that depends
on the kern.boothowto sysctl.

Part of the /etc/rc silent changes requested in PR 41946
and proposed in tech-userlevel.


# 1.163 09-Apr-2009 joerg

Add rc_directories to specify where to look for rc scripts.
For the moment all scripts must be in /root and non-existent directories
are skipped.


# 1.162 04-Jan-2003 lukem

branches: 1.162.42;
Change how internal boolean variables are used to:
if ! ${_somevar:-false}; then
_somevar=true
fi
(Consisent, slightly quicker, and slightly cleaner)


# 1.161 18-May-2002 lukem

Add two new rc.conf(5) variables:
rc_rcorder_flags extra flags to rcorder(8) in /etc/rc
rcshutdown_rcorder_flags extra flags to rcorder(8) in /etc/rc.shutdown

This can be used to specify extra directories to search for rc.d scripts in.
For example, adding the following to rc.conf(5):
rc_rcorder_flags="/usr/pkg/etc/rc.d/*"
rcshutdown_rcorder_flags="/usr/pkg/etc/rc.d/*"
will add the files in /usr/pkg/etc/rc.d to the list of files that rcorder(8)
uses to build the list of scripts to start or stop.

I proposed this functionality on tech-userlevel@ over one month ago.
Closes the recent [misc/16888], which asked for a similar feature.


# 1.160 18-Apr-2002 lukem

consistently set rc_(fast|force)=yes


# 1.159 21-Mar-2002 lukem

- Rename a bunch of "internal" run_rc_command() variables and officially
make them "externally" available:
Previous Current Purpose
-------- ------- -------
_arg rc_arg Argument to command, after fast/force
processing performed (and prefix
removed)

_flags rc_flags Flags to start the default command
with. Defaults to ${name}_flags,
unless overridden by $flags from the
environment. This variable may be
changed by the precmd method.

_pid rc_pid PID of command (if appropriate).

_rc_run_fast rc_fast Not empty is "fast" was provided.

_rc_run_force rc_force Not empty is "force" was provided.

- Use rc_flags instead of _flags or ${name}_flags in various rc.d scripts,
so that $flags from the environment overrides ${name}_flags from rc.conf(5).
Fixes [bin/15800].


# 1.158 14-Jun-2001 lukem

use symbolic signal names instead of numbers


# 1.157 08-May-2001 lukem

explicitly set the umask to 022 to be safe


# 1.156 12-Mar-2001 lukem

move date before rcorder


# 1.155 28-Feb-2001 lukem

various speed-ups (and related work):
- only load rc.conf if $_rc_conf_loaded is not set
- use case instead of if for various string comparisons
- print the date at the start of the boot as well as at the end
- if $rc_fast_and_loose is set, always run the rc.d scripts in the
current shell rather than in a subshell. this is not on by default
because it's potentially dangerous (a rogue command could terminate
the boot), but it is provided as an optional speedup for people
with slow machines that have an expensive fork


# 1.154 14-Dec-2000 lukem

- describe what rc.shutdown does, and what invokes it
- remove `.sh' suffix on script name in description


# 1.153 21-Aug-2000 lukem

don't start rc.d scripts with a `nostart' keyword


# 1.152 21-Apr-2000 lukem

branches: 1.152.4;
revert previous; the fast-start functionality already existed, and
works at multi-user boot. (starting /etc/rc after single user boot
doesn't exhibit this fast start behaviour).


# 1.151 18-Apr-2000 simonb

Add an "rc_fastboot" variable check in rc.subr, that if set adds
"fast" to the start of the run_rc_command arg.

/etc/rc calls each rc.d script with rc_fastboot=yes so that rc.subr
aware scripts to use "faststart" to skip the process running check.


# 1.150 28-Mar-2000 enami

Check rc_configured also here, and bail out if it isn't set to yes.


# 1.149 10-Mar-2000 lukem

run scripts in /etc/rc.d/* in the order returned by rcorder


# 1.148 07-Mar-2000 jdolecek

make clearing of /tmp after reboot configurable (default on), as per recent
discussion on current-users


# 1.147 09-Feb-2000 itojun

ip6forwarding -> ip6mode change (somehow i forgot to commit...)
PR: 9375


# 1.146 04-Feb-2000 itojun

change IPv6 configuration syntax to avoid ambiguity.
ip6mode=host: IPv6 host
ip6mode=autohost: IPv6 host, with autoconfig
ip6mode=router: IPv6 router

backward compatibility to "ip6forwading" is provided.


# 1.145 31-Jan-2000 jdc

Allow NFS servers to start up.


# 1.144 19-Jan-2000 tron

Start automount daemon even if NFS client is not activated. This makes
sense for system where "amd" is used to mount local devices like e.g.
CD-ROM drives. Fixes PR misc/9126 by Bjoern Labitzke.


# 1.143 18-Jan-2000 enami

Make some warning message consistient with others.


# 1.142 06-Jan-2000 enami

Since the logger(1) puts space between its arguments, there is no need
to pass it explicitly.


# 1.141 06-Jan-2000 enami

Make sure that warning message starts from the beginning of line. Some
warning recently added didn't care about it.


# 1.140 06-Jan-2000 enami

Cosmetic changes; folding long lines, using tab instead of spaces where
appropriate and fixing some indentation.


# 1.139 03-Jan-2000 lukem

don't need to background xfs now that it auto-backgrounds itself...


# 1.138 23-Nov-1999 hubertf

Add some boot time warnings:
- if ypserv=yes but portmap=no
- if yppasswdd=yes but ypserv=no
- if nfs_server=yes but portmap=no

Per discussion on tech-userlevel@netbsd.org.


# 1.137 23-Nov-1999 lukem

accounting should be controllable via $accounting=YES in rc.conf...


# 1.136 15-Nov-1999 fvdl

Remove update, it's no longer used.


# 1.135 30-Oct-1999 frueauf

Use checkyesno to check the state of $rc_configured like for any other
variable set in /etc/rc.conf. Pointed out by Erik Bertelsen
<erik@mediator.uni-c.dk> in pr 8522.


# 1.134 05-Oct-1999 darrenr

move old dev_mkdb and "kvm_mkdb /netbsd" up into the section which builds
kvm_mkdb based on machdep.boot_kernel. also failover to "kvm_mkdb /netbsd".


# 1.133 05-Oct-1999 darrenr

send sysctl machdep errors to /dev/null
merge in patches to implement multiple bootup configurations (look for
/etc/etc.current, /etc/etc.default and friends)
only start up NFS services if either nfs_client or nfs_server is yes.


# 1.132 28-Sep-1999 bouyer

Add support for $defcorename


# 1.131 16-Sep-1999 darrenr

branches: 1.131.2;
If machdep.booted_kernel can be found in sysctl output, feed that name into
kvm_mkdb so that when we boot we always have an upto-date kvm db, allowing
dmesg and friends to run without error when we do "boot netbsd.fun" to test
kernels, etc.


# 1.130 03-Sep-1999 itojun

add sanity check on rtadvd invocation (allowed on IPv6 routers only).
add rc.conf entry for rtsold.


# 1.129 27-Aug-1999 christos

check if vi recovery files are regular files before trying to e-mail them.
Stops a denial of service attack where the user can put a named pipe or
any other device that blocks i/o in /var/tmp/vi.recover/recover.*
[from dynamo@ime.net]


# 1.128 05-Aug-1999 christos

Create temp _motd file in /etc


# 1.127 02-Jul-1999 itojun

add IPv6 configuration (ip6forwarding, rtsol, route6d and rtadvd).
Right now netsetart does not bother you even if you do not have
"options INET6" in the kernel.


# 1.126 30-Jun-1999 augustss

usbd is dead.


# 1.125 13-Apr-1999 tron

Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.


# 1.124 31-Mar-1999 cjs

branches: 1.124.2;
Change mount_critical_filesystems() so that if given an argument
of "local" it will not mount filesystem types it identifies as
network file systems (currently just nfs). Call the function twice,
before networking starts with arg "local", after networking starts
with arg "network". Remove critfs_require_network as is now redundant.


# 1.123 26-Mar-1999 drochner

start xdm after wscons configuration - the X server might want an own
virtual screen


# 1.122 26-Mar-1999 sommerfe

Add dhcrelay startup (allow only if dhcpd isn't started)


# 1.121 25-Mar-1999 oster

Nuke the line 'raidctl -r raid$dev'. a) The '-r' option is now '-i', and
b) with component labels and clean-bits working, this shouldn't be
required at all on each boot! Thanks to Andrew Gillham for pointing this out.


# 1.120 24-Mar-1999 mellon

- Move critical filesystem mounting code into a shell function and put
that in rc.subr.
- Support critfs_require_network rc.conf variable.


# 1.119 18-Mar-1999 perry

change to new syslog socket. make symlink from old to new location, too.


# 1.118 17-Mar-1999 drochner

rc.wscons can take arguments, so we shouldn't simply source it but exec in
a subshell. Being here, add a prototype wscons_flags variable.


# 1.117 14-Mar-1999 drochner

introduce a "wscons" rc.conf flag and run /etc/rc.wscons from /etc/rc
if it is set


# 1.116 07-Feb-1999 frueauf

No need to involve awk in the securelevel part, since sysctl has the -n switch.
Pointed out by NAKAJIMA Yoshihiro.


# 1.115 06-Feb-1999 bad

Use peers too when setting the time via ntpdate.


# 1.114 06-Feb-1999 frueauf

Add missing '' for awk in the securelevel part.


# 1.113 31-Jan-1999 mrg

oops, that's -n not -z. pointed out by hubert...


# 1.112 31-Jan-1999 mrg

increase the securelevel (using the same rules as before) much earlier in the
boot process. before cron, sendmail, inetd, etc, are run, but after lkms are
loaded. this avoids the chances of `@reboot', mail .forwards, remote logins,
etc., happening before the securelevel has been raised.


# 1.111 12-Jan-1999 mrg

support dmesg=NO and dmesg_flags, and do not cut the old boot messages..they might be useful. fix a typo (rbootd is not rarpd)


# 1.110 11-Jan-1999 jwise

Enable cron to be turned on and off from rc.conf, like other daemons.
From Soren S. Jorvang <soren@t.dk>, closes his PR bin/5250.


# 1.109 11-Jan-1999 jwise

Add $portmap_flags variable, now that portmap has optional flags, and
by default, pass '-l' flag (libwrap logging) by analogy with inetd


# 1.108 05-Jan-1999 abs

save a copy of the boot messages. Closes 6398 from msanders@confusion.net


# 1.107 03-Jan-1999 tron

Add support for RAIDframe configuration as suggested by Eric S. Hvozda
in PR install/6676.


# 1.106 20-Nov-1998 hubertf

allow /var/crash to be a symlink to a directory


# 1.105 12-Jul-1998 augustss

Add USB support. Supported so far:
* UHCI and OHCI host controllers on PCI
* Hubs
* HID devices withe special drivers for mouse and keyboard
* Printers


# 1.104 20-Jun-1998 tron

Strip comments from "${amd_master}".


# 1.103 06-Apr-1998 mrg

add "screenblank" support.


# 1.102 23-Feb-1998 lukem

send ntpdate output to syslog rather than stdout (with -s).
suggested by "Soren S. Jorvang" <soren@t.dk>


# 1.101 22-Feb-1998 lukem

exclude 127.127 servers when automagically determining ntpdate hosts


# 1.100 26-Jan-1998 lukem

include rc.subr and use appropriately


# 1.99 24-Jan-1998 veego

Move ipnat from /etc/netstart to /etc/rc after /usr is mounted.


# 1.98 09-Jan-1998 perry

Fix pr 4587 (from Matthias Scheler) -- pause slightly after xfs starts.


# 1.97 22-Nov-1997 mrg

print a warning if no swap devices are configured and "no_swap" is not YES.


# 1.96 10-Nov-1997 jonathan

Add options to rc.conf and rc to start xfs (x font server) and xdm.
Add entries to rc.conf.5.
While we're here, note that the domestic kerberos damons are still
Kerberos IV, not kerberos version 5.


# 1.95 10-Oct-1997 drochner

branches: 1.95.2;
Replace the (slightly broken) check to avoid double mounting of
filesystems by a correct one. (too bad that there was no agreement
about a mount option doing the same...)
Introduce a new rc.conf variable to mount user-defined filesystems
early in startup (eg for syslog, crashdumps, ...).


# 1.94 07-Oct-1997 lukem

add $ipmon and $ipmon_flags, to control startup of ipmon(8)


# 1.93 12-Sep-1997 drochner

fix an rc.conf flag check which was broken with the "checkyesno" changes


# 1.92 12-Sep-1997 drochner

avoid to mount /usr twice if LKM load already did it


# 1.91 07-Sep-1997 mikel

no more DEFAULT for $ntpdate_hosts; from Geoff Wing in PR bin/4073


# 1.90 29-Aug-1997 veego

Curt, what is in rc.func ?
I only see rc.subr so I renamed rc.func to rc.subr.


# 1.89 28-Aug-1997 cjs

Split rc.conf variables for starting programs into two: an on/off
switch and a set of flags. Get rid of DEFAULT flags entirely. Print
warnings if on/off switches are not set, or are set incorrectly.
Add a shell function to simplify this on/off switch testing.


# 1.88 26-Aug-1997 thorpej

ldconfig processes /etc/ld.so.conf internally; run it without cat'ing
the contents into an argument vector.


# 1.87 04-Aug-1997 cjs

Move ntpdate before `starting network daemons' to get cleaner output
during boot. Besides, it's not a daemon anyway.


# 1.86 03-Aug-1997 perry

add apmd to /etc/rc and /etc/rc.conf per Lennart Augstsson in pr 3313


# 1.85 30-Jul-1997 perry

Fix boot time vi recovery as reported by NAKAJIMA Yoshihiro in pr-3430
Really weird bug. On inspection, the shell code in rc looked fine, but
when tested, sure enough, the semantics of the shell were not what I
thought they were. Very unexpected to me, and obviously to the
hundreds of people who must have read those lines without seeing that
they were broken.


# 1.84 15-Jul-1997 veego

Move savecore up before named to get a dump on low memory systems and
move 'mount -a' between yp and nfs daemons.


# 1.83 14-Jul-1997 drochner

Take 2 to get the mount order "right", taking care of possible LKM
loads before netstart this time.
LKMs can be loaded at 3 strategic places in /etc/rc - before netstart,
before "mount -a" and after all. "before netstart" works only if
the /usr filesystem is local (or on NFS, if root is too).
An additional field ("when") in lkm.conf controls when the LKM is
loaded.


# 1.82 11-Jul-1997 veego

Back out the last two commits for now till we find a better way to fix
the mount problems.


# 1.81 11-Jul-1997 veego

rc.lkm needs /usr/bin/ld, so try to mount it with -t nonfs before rc.lkm.


# 1.80 10-Jul-1997 drochner

Mount only "/" at the beginning (instead of all non-NFS filesystems).
This makes that the ordering of fstab is used for mounts which is
a) more intuitive and b) needed if {mfs,union,...} on top of NFS
is wanted.


# 1.79 25-Jun-1997 thorpej

Before disk checks are performed, do a "swapctl -A -t blk" so that
block-type devices are available during disk checks, which may consume
large amounts of memory if large file systems are present. Once "critical"
file systems (e.g. /usr and /var) are mounted, perform a "swapctl -A -t noblk"
to enable swapping on any swap files that may be listed in /etc/fstab.


# 1.78 12-Jun-1997 mrg

use swapctl instead of swapon


# 1.77 10-May-1997 cjs

Make xntpd put its pid in /var/run/xntpd.pid.


# 1.76 28-Apr-1997 scottr

Spawn a separate shell for netstart, making sure to check the return value
and exit with error if appropriate.


# 1.75 27-Apr-1997 perry

Add support for an ntpdate_hosts variable.
settings:
NO: don't run ntpdate on boot
DEFAULT:extract a list of hosts from /etc/ntp.conf
otherwise, a list of hosts to poll with ntpdate


# 1.74 22-Apr-1997 perry

make motd update conditional on an rc.conf variable (update_motd), and
move it before interactive logins are possible (just in case).


# 1.73 18-Apr-1997 perry

move last items from rc.local to rc; rc.local is now actually for local stuff.


# 1.72 16-Mar-1997 cjs

Added mopd.


# 1.71 12-Mar-1997 mycroft

When displaying the names for statd and lockd, include the `rpc.'.


# 1.70 12-Mar-1997 mycroft

Add . GC , which isn't used.


# 1.69 10-Mar-1997 mycroft

Do the DEFAULT thing with mountd_flags. Don't output an extra
newline for statd and lockd.


# 1.68 10-Mar-1997 mycroft

Minor cleanup.


# 1.67 10-Mar-1997 mycroft

If foo_flags is DEFAULT, run the program with a default set of flags. Most
users will use this, and therefore will never have to worry about flags
changing between releases. It's also a bit less error-prone.


# 1.66 09-Mar-1997 scottr

Add configuration flags for lockd/statd, and start them if an
NFS server or client is configured and the flags are not NO.


# 1.65 15-Feb-1997 mikel

cleanup Lite-1 merge


# 1.64 07-Feb-1997 mrg

oops; use $savecore_flags. from kilbi@rad.rwth-aachen.de


# 1.63 05-Jan-1997 mrg

move start-time configuration from netstart, rc, rc.local into
the new /etc/rc.conf. this also includes the following changes:

netstart: ifaliases now includes a netmask, to ensure
aliases work.

rc/rc.local: make _everything_ based on configuration
in rc.conf. also move things around such that DNS and
YP are started early enough that other daemons needing
their services also exist. move ldconfig from rc.local
here, and also make it use /etc/ld.so.conf if it exists.
run /etc/rc.lkm if it exists, a boot time.


# 1.62 04-Dec-1996 mrg

add inetd_flags, mostly from <jbernard@tater.Mines.EDU> in pr#2987


# 1.61 03-Oct-1996 mrg

add dhcpd startup; disabled by default


# 1.60 26-Aug-1996 tls

move rpc daemon startup to after network startup so that if the machine is a DNS server and wants to resolve via itself, one doesn't have to wait for all the DNS queries to time out as each rpc daemon starts. This was particularly ugly with mountd.


# 1.59 08-Aug-1996 thorpej

Quote the YP daemon flags variables.


# 1.58 09-Aug-1996 thorpej

Change how the YP daemons are started. Previously, ypbind was always
started if the directory /var/yp exists. Now, ypbind, ypserv, and
rpc.yppasswdd are started like other daemons; there are flags variables
for these programs. To disable them, set the variables to "NO", otherwise,
their contents are passed as flags.


# 1.57 21-Mar-1996 mrg

add note about why we use /usr/sbin/sendmail.


# 1.56 21-Mar-1996 mrg

now that sendmail supports SIGHUP, call sendmail with full path.


# 1.55 29-Dec-1995 thorpej

Add $mrouted_flags to netstart and use it in rc to start mrouted in a manner
similar (well, identical, really) to how $routed_flags is used to start
routed.


# 1.54 08-Oct-1995 thorpej

New-style RCS ids.


# 1.53 16-Sep-1995 jtc

fix typo in comment


# 1.52 02-Sep-1995 thorpej

Conditionally start rbootd like rarpd and rpc.bootparamd, and disable
it by default.


# 1.51 02-Sep-1995 thorpej

Fix typos in two comments.


# 1.50 27-Aug-1995 thorpej

Configure ccd devices before the filesystem checks, as suggested by
Thomas Eberhardt in PR #1408.


# 1.49 04-Nov-1994 briggs

Actually pass all the arguments to amd that we meant to. Reported by
Dave Leonard (D.Leonard@pleiades.newcastle.edu.au).


# 1.48 16-Sep-1994 mycroft

Create an empty mountdtab after removing it, to avoid getting a warning
from mountd on startup. Change $name_server to $named_flags.


# 1.47 27-Jun-1994 deraadt

always check quotas (there is no reason not to try)


# 1.46 24-Jun-1994 deraadt

quotas file(s) changed name in 4.4-lite


# 1.45 18-Jun-1994 cgd

if install will do the trick, why not use it\?


# 1.44 08-Jun-1994 mycroft

Update nfsd and nfsiod invocations.


# 1.43 02-Jun-1994 jtc

Move building of link editor cache from rc to rc.local, like in SunOS,
because the end user may need to add local directories to be searched.
And rc.local is a much more appropriate place for local changes.

I emailed pk on this matter, and he said that the overhead of not
having linker hints for the daemons started by rc would not be
significant.

This change also closes bug #217.


# 1.42 29-May-1994 mycroft

Attempt to make sure /var is mounted before futzing with it.


# 1.41 28-May-1994 jtc

Move code that cleans /var/run so that it is before the automount deamon
startup puts its pid file there (This addressess most of bug #217).


# 1.40 10-Apr-1994 cgd

add ttyflags -a, early on in rc.


# 1.39 27-Mar-1994 cgd

keep amd pid in /var/run/amd.pid


# 1.38 17-Mar-1994 cgd

punctuation


# 1.37 17-Mar-1994 cgd

kill uucp lock files. from Mike Long <mike.long@analog.com>


# 1.36 13-Mar-1994 cgd

slight change to the way AMD is invoked, to make it sensible for most uses


# 1.35 08-Mar-1994 cgd

make booting comments a bit cleaner


# 1.34 25-Feb-1994 cgd

automatically enable accounting and rotate logs


# 1.33 31-Jan-1994 cgd

don't delete preserve files!


# 1.32 29-Jan-1994 mycroft

Do the right thing for nvi.


# 1.31 13-Jan-1994 jtc

The cron daemon now lives in /usr/sbin


# 1.30 10-Jan-1994 mycroft

Add bootparamd gunk.


# 1.29 10-Jan-1994 mycroft

Add rarpd gunk.


# 1.28 05-Jan-1994 jtc

The cron daemon has been renamed from crond to cron. This name change
is from Vixie Cron 3.0, to make it like the 4.3BSD cron.


# 1.27 04-Jan-1994 deraadt

start amd if requested
do nfs mounting after mountd has been started (so two machines can cross-mount
nfs from each other, else they hang if booted simultaneously)


# 1.26 15-Dec-1993 deraadt

initialize rpc services in proper order


# 1.25 15-Dec-1993 mycroft

Use `.' to run rc.local, rather than starting another shell, so that variables
from netstart are passed on.


# 1.24 30-Nov-1993 cgd

fix comment, add check


# 1.23 26-Nov-1993 mycroft

Put ldconfig later so it doesn't get wiped when reaping /var/run.


# 1.22 21-Nov-1993 mycroft

Build ld.so.hints on each boot.


# 1.21 17-Nov-1993 cgd

more flags


# 1.20 17-Nov-1993 cgd

quote sendmail_flags test, from Patrick Bridges <patrick@buffy.cs.msstate.edu>


# 1.19 07-Nov-1993 cgd

(1) clean up lots (rename fooflags -> foo_flags, etc.)
(2) implement suggestion made by Garrett Wollman of "sendmail flags"
to set flags passed to sendmail and/or turn it off
(3) document origins of variables


# 1.18 19-Oct-1993 cgd

never rotate accounting logs, and turn on accounting the way done in net/2


# 1.17 05-Sep-1993 mycroft

Use `-e fastboot', not `-r fastboot'.


# 1.16 01-Sep-1993 deraadt

it's clear that mountd started from inetd doesn't work


# 1.15 24-Aug-1993 brezak

mountd is now started by inetd.


# 1.14 10-Jun-1993 brezak

Don't start rwalld - now started by inetd.


# 1.13 03-May-1993 cgd

prune dirs rm'd when cleaning tmp


# 1.12 02-May-1993 cgd

turn on accounting if /var/account exists


# 1.11 28-Apr-1993 cgd

bsd->netbsd


# 1.10 27-Apr-1993 cgd

new kernel is bsd


# 1.9 10-Apr-1993 glass

fixes for nfs_client, nfs_server division.


# 1.8 10-Apr-1993 cgd

always run portmap


# 1.7 10-Apr-1993 glass

mountd's log of who has what filesystem mounted should not persist across
reboots.


# 1.6 09-Apr-1993 cgd

rwalld should be run *after* the portmapper.


# 1.5 04-Apr-1993 cgd

screwed it up again... = vs ==.


# 1.4 04-Apr-1993 cgd

screwed up comparison for rwalld and rwhod...


# 1.3 04-Apr-1993 cgd

updated for addition of rwalld


# 1.2 02-Apr-1993 cgd

got rid of damned highlight characters, and changed
method to turn on rwhod.


# 1.1 21-Mar-1993 cgd

branches: 1.1.1;
Initial revision


# 1.1.1.2 14-Feb-1997 mikel

import 4.4BSD-Lite


# 1.1.1.1 21-Mar-1993 cgd

initial import of 386bsd-0.1 sources


# 1.95.2.2 28-Nov-1997 mellon

Pull rev 1.97 up from trunk (mrg)


# 1.95.2.1 12-Nov-1997 mellon

Pull rev 1.96 up from trunk (jonathan)


# 1.124.2.2 29-Aug-1999 he

Pull up revision 1.129:
Fix denial-of-service attack involving vi preserve. (christos)


# 1.124.2.1 13-Apr-1999 tron

Pull up revision 1.124:
Configure wscons much earlier so that a virtual console can e.g. be
used for "syslogd" output.


# 1.131.2.1 27-Dec-1999 wrstuden

Pull up to last week's -current.


# 1.152.4.1 23-Aug-2000 lukem

pull up rev 1.153 (approved by thorpej):
don't start rc.d scripts that have a `nostart' keyword


# 1.162.42.1 13-May-2009 jym

Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html


# 1.166.20.1 10-Aug-2014 tls

Rebase.


# 1.166.8.1 19-Aug-2014 tls

Rebase to HEAD as of a few days ago.


# 1.166.2.1 22-May-2014 yamt

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")