Commit Graph

338 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
7bd5b79de4 Add a dummy script, FILESYSTEMS, which depends on root and mountcritlocal
and takes over mountcritlocal's role as the early / late divider.  This
makes it far easier to add rc scripts which need to run early, such as a
startup script for zfs, which is right around the corner.

This change should be a no-op; I have verified that the only change in
rcorder's output is the insertion of FILESYSTEMS immediately after
mountcritlocal.

MFC after:	3 weeks
2007-04-02 22:53:07 +00:00
Doug Barton
2a723c89f8 Attempt to make running the new rc in a jail more automatic by
resetting of early_late_divider to a more appropriate value if
the admin has not modified the default.

Reviewed by:	brooks
2006-02-20 21:54:30 +00:00
Doug Barton
57e561c083 Remove rcconf.sh from /etc/rc.d, and instead load the configuration
as part of rc. Doing this, and the sourcing of rc.subr after we have
determined if we are booting diskless (and correspondingly run
rc.initdiskless if necessary) are safe, and actually allow fewer files
to be needed on the diskless box. This also allows variables from
the configuration to be available to rc itself, such as ...

Add a variable to rc.conf, early_late_divider, which designates the
script which separates the early and late stages of the boot process.
Default this to mountcritlocal, and add text to etc/defaults/rc.conf,
rc.conf(5) and diskless(8) which describes how and why one might want
to change this.

Reviewed by:	brooks
2005-12-10 20:21:46 +00:00
Doug Barton
0f3ce2b32c Introduce startup scripts from the local_startup directories to
the base rcorder. This is accomplished by running rcorder twice,
first to get all the disks mounted (through mountcritremote),
then again to include the local_startup directories.

This dramatically changes the behavior of rc.d/localpkg, as
all "local" scripts that have the new rc.d semantics are now
run in the base rcorder, so only scripts that have not been
converted yet will run in rc.d/localpkg.

Make a similar change in rc.shutdown, and add some functions in
rc.subr to support these changes.

Bump __FreeBSD_version to reflect this change.
2005-12-02 20:06:07 +00:00
Brooks Davis
2af94c5d1d To allow /etc to be as minimal as possible in a diskless setup, we need
to run initdiskless before we run rcorder on /etc/rc.d.  To allow this,
move /etc/rc.d/initdiskless to /etc/rc.initdiskless and run it directly
from /etc/rc.

Remove /etc/rc.d/preseedrandom as it is no longer necessicary (we start
with entropy unblocked) and was only used by initdiskless when it
was needed.

Discussed on:	freebsd-rc
Repocopy by:	peter
2005-04-29 23:02:56 +00:00
Mike Makonnen
d7052481cd Remove an unused variable.
Submitted by: Pawel Worach <pawel.worach@telia.com>
2004-10-08 14:23:49 +00:00
Mike Makonnen
337338ee00 Remove the requirement for the FreeBSD keyword as it no longer
makes any sense.

Discussed with: dougb, brooks
MFC after: 3 days
2004-10-07 13:55:26 +00:00
Mike Makonnen
8f5490f5fe Correct typo.
Submitted by: eik (and probably many others)
2004-07-24 16:30:31 +00:00
Mike Makonnen
30e2462c71 Restore pre-rcNG behaviour:
SIGINT (Ctrl-c) kills the current script
SIGQUIT (Ctrl-\) kills /etc/rc (dropping you into single-user)

Prodded by:	harti
2004-06-06 18:06:09 +00:00
Pawel Jakub Dawidek
01b373bed7 Fix skipping scripts with given keywords.
Proper syntax is '-s keyword1 -s keyword2', not '-s keyword1 keyword2'.
2004-03-08 12:02:07 +00:00
Mike Makonnen
e0aca24352 o Add support for detecting a jailed environment. If a script
cannot or does not want to be executed in a jail the
  KEYWORDS line should contain the nojail keyword.
o Update Copyright

# I suggest people who use jails more extensively than I do
# make commits to the appropriate files.
2004-02-27 10:44:33 +00:00
Doug Barton
4b065e2ce1 Per previous announcement, remove the old version of the rc system.
All functionality from the previous system has been preserved, and
users should still customize their system boot with the familiar
methods, rc.conf, rc.conf.local, rc.firewall, sysctl.conf, etc.

Users who have customized versions of scripts that have been removed
should take great care when upgrading, since the compatibility code
that used those old scripts has also been removed.
2003-05-02 05:27:35 +00:00
Doug Barton
4bc6a70cad Add a dire warning about the impending demise of the old rc system.
Suggested by:	scottl
2003-04-27 07:08:07 +00:00
Makoto Matsushita
7172e3d4bf Set appropriate tag "fsck" to logger(1) for background fsck messages.
PR:		51174
Submitted by:	Alex Popa <razor@ldc.ro>
2003-04-23 15:38:02 +00:00
Matthew Dillon
cc1dfa653e Redo the initial rc_ng check to avoid rc.conf pollution occuring too early,
initdiskless may retarget /etc and various rc.conf files.  The initial check
is now done in a subshell.
Reviewed by:	Mike Makonnen <mtm@identd.net>
2002-12-23 07:09:44 +00:00
Matthew Dillon
eb7bf00306 Do not unconditionally load the configuration files for the RCNG case.
Instead, load them as part of the rc.d system.  This allows us to prioritize
the initidiskless script so it runs before the configuration files are loaded
and allows us to get rid of the exit 2 hack in /etc/rc.  The exit 2 never
worked anyway since it did not unset the prior configuration, causing the
diskless code to not operate properly.

Do a major cleanup and revamping of the diskless code for RCNG.  This will
be backported to the non-RCNG scripts as well as -stable.

With suggestions from: Mike Makonnen <mtm@identd.net>
MFC after:	7 days
2002-12-22 22:18:41 +00:00
Kirk McKusick
123a5dff98 Delay an optional amount of time after booting before starting a
background fsck. The delay defaults to sixty seconds to allow
large applications such as the X server to start before disk I/O
bandwidth is monopolized by fsck.

Submitted by:	Brooks Davis <brooks@one-eyed-alien.net>
Sponsored by:   DARPA & NAI Labs.
2002-12-18 07:21:31 +00:00
Robert Watson
881a0ee9b5 Update rc scripts to load mac_lomac instead of lomac.
Approved by:	re
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-11-26 17:51:03 +00:00
Dima Dorfman
605cf4c8a3 Aesthetics: Most (all?) other messages output at boot time have
trailing periods, so why shouldn't this one?
2002-10-12 07:21:18 +00:00
Jens Schweikhardt
d539c53b01 Fix all whitespace style bugs where spaces have been used
where tabs should have been. Cut & paste disease?

Spotted by:	vi(1) tabstop=4
MFC after:	2 weeks
2002-10-03 20:39:29 +00:00
Dima Dorfman
2ca85e3d5e In a diskless setup, rc.d/initdiskless may overwrite parts of /etc on
a per-machine or per-cluster (with different ways of expressing what's
part of a cluster) basis.  In order for this to be effective, rc.conf
has to be reread after initdiskless is finished.  Implement this by
adding a hook to etc/rc which rereads rc.conf by request.  This can
also be implemented by renaming initdiskless to initdiskless.sh and
sourcing rc.conf there manually, but it was decided that, that would
be uglier than a hook in etc/rc.

Developed in concert with:	gordon
2002-10-02 00:59:14 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Gordon Tetlow
8e05457085 Quiet warnings about non-existent scripts. My own fault for not testing my
own patches as well as I should.
2002-09-11 01:00:57 +00:00
Gordon Tetlow
5b572aec21 Remove an accidental double chkdepend that snuck in during the last commit.
Submitted by:	Mike Makonnen <makonnen@pacbell.net>
2002-08-15 03:24:47 +00:00
Gordon Tetlow
8987faac82 Don't export variables from /etc/rc when doing rc_ng because the scripts
are sourced in a subshell.

Submitted by:	Mike Makonnen <makonnen@pacbell.net>
2002-08-14 05:58:44 +00:00
Gordon Tetlow
2ee93c5780 Clean up some variables that should have been done before:
xntpd_* -> ntpd_*
portmap_* -> rpcbind_*

Also change single_mountd_enable to mountd_enable.

We also include shims for all the old variable names.

Submitted by:	Mike Makonnen <makonnen@pacbell.net>
2002-08-14 05:37:15 +00:00
Gordon Tetlow
825bb04125 Add the final bits that allow the use of rc.d. Note that you can toggle
between rc.d and the classic boot scripts based on the rcng variable in
your rc.conf. Defaults to classic boot scripts.

Submitted by:	Mike Makonnen
2002-06-13 22:30:02 +00:00
Tom Rhodes
db4f576472 Consistancy, file system > filesystem 2002-05-16 02:10:03 +00:00
Jacques Vidrine
dfc4c48df7 It is dangerous to use globbing like so in startup scripts:
rm -f /tmp/.X11-unix/*

If /tmp/.X11-unix didn't already exist, a user could symlink it to a directory
with files that he wants to wipe out, and wait for next reboot.

Reported by:	lumpy <lumpy@the.whole.net>
2002-05-08 14:47:44 +00:00
Wes Peters
8373917257 Rename the file used to specify the nextboot to make it clear that this
is a loader configuration file and can be used for more than just a
kernel name.

Submitted by:	Gordon Tetlow <gordont@gnf.org>
2002-04-26 22:32:15 +00:00
Wes Peters
1de372dcd4 Add a -k option to reboot to specify the kernel to boot next time
around.  If the kernel boots successfully, the record of this kernel
is erased, it is intended to be a one-shot option for testing
kernels.

This could be improved by having the loader remove the record of
the next kernel to boot, it is currently removed in /etc/rc immediately
after disks are mounted r/w.

I'd like to MFC this before the 4.6 freeze unless there is violent
objection.

Reviewed by:	Several on IRC
MFC after:	4 days
2002-04-26 07:31:04 +00:00
David E. O'Brien
8a57f7e245 Do not use 'ps -e' for entropy gathering. It uses /proc/*/mem to rummage
around *user* memory to extract the environment variable strings.  This
is problematic for us.

Submitted by:	peter
2002-04-23 00:05:48 +00:00
Gregory Neil Shapiro
619b80c4e6 Quoting Peter Wemm, "At great personal risk, touch the sendmail startup
again."

As an alternative to sendmail_enable=NONE, solve the boot time problem
for non-sendmail users completely by moving all of the sendmail startup
code from /etc/rc to /etc/rc.sendmail.  The source for that script will
be kept in src/etc/sendmail/rc.sendmail so make.conf's NO_SENDMAIL will
prevent it from being installed.  A new rc.conf variable,
mta_start_script specifies the script to run to start the user's
preferred MTA.  For backward compatibility, it will default to
/etc/rc.sendmail.  The specified script is called out of /etc/rc after
checking to make sure it exists.  A new rc.sendmail.8 man page has also
been added which now houses the sendmail_* variable descriptions
formerly in rc.conf.5.

Use /etc/rc.sendmail in /etc/mail/Makefile to reduce code duplication.

Reviewed by:	-current, -stable, obrien, peter, ru
MFC after:	1 week
2002-04-05 02:30:49 +00:00
Gregory Neil Shapiro
4bfef13db0 Provide a way for users to completely prevent sendmail from trying to start
at boot time.

Instead of rc.conf's sendmail_enable only accepting YES or NO, it can now
also accept NONE.  If set to NONE, none of the other sendmail related
startup items will be done.

Remove an extra queue running daemon might be started that wasn't necessary
(it didn't hurt anything but it wasn't needed).

The new logic is:

# MTA
if ${sendmail_enable} == NONE
        # Do nothing
else if ${sendmail_enable} == YES
        start sendmail with ${sendmail_flags}
else if ${sendmail_submit_enable} == YES
        start sendmail with ${sendmail_submit_flags}
else if ${sendmail_outbound_enable} == YES
        start sendmail with ${sendmail_outbound_flags}
endif
# MSP Queue Runner
if ${sendmail_enable} != NONE &&
   [ -r /etc/mail/submit.cf] && ${sendmail_msp_queue_enable} == YES
        start sendmail with ${sendmail_msp_queue_flags}
endif

Discussed with: Thomas Quinot <Thomas.Quinot@Cuivre.FR.EU.ORG>,
		Christopher Schulte <schulte+freebsd@nospam.schulte.org>
MFC after:	1 week
2002-03-28 03:29:22 +00:00
David E. O'Brien
1004420008 Don't start any sendmail process in the back ground.
Requested by:	gshapiro
2002-03-26 02:38:08 +00:00
David E. O'Brien
0ef30ec620 Don't background the sendmail-clientmqueue process -- can give:
sm-queue[181]: NOQUEUE: SYSERR(root): fill_fd: before readcf: fd 1 not open: Bad file descriptor
2002-03-25 20:53:48 +00:00
David E. O'Brien
68141defd1 Sendmail can be slow to startup.
So start it in the background to speed up booting.
2002-03-22 23:45:13 +00:00
Doug Barton
3f9ff585ed Make sure that rc.syctl gets its own version of positional parameters
Submitted by:	cjc
2002-03-18 00:56:51 +00:00
Doug Barton
c84f8c0e17 Distinguish between first and last passes of rc.sysctl, and only set
mibs whose values are not already what is specified in sysctl.conf.
2002-03-17 20:14:11 +00:00
Doug Barton
f7699dd6a4 Add a late rc.sysctl pass to catch sysctl's for things that were
not loaded yet on the first pass.

PR:		conf/19629
Submitted by:	Stephen J. Roznowski <sjr@home.com>
2002-03-17 08:38:03 +00:00
Crist J. Clark
903163ac3e Only put standard FreeBSD directories in the PATH. If the
administrator wishes to run commands outside of the PATH, he should
use a full pathname for the executable or set the PATH as appropriate
in any local startup scripts.

PR:		misc/35770
2002-03-16 20:01:25 +00:00
Robert Watson
cd2cc2c1a8 Allow LOMAC to be loaded as part of the boot scripts using "lomac_enable"
setting in rc.conf.

Extracted from the still clammy hands of:	green
Sponsored by:	DARPA, NAI Labs
2002-03-12 21:47:31 +00:00
Crist J. Clark
6abb238df8 Run dumpon(8) early so crashes during startup can be caught. In
addition, take out the checks on the $dumpdev. dumpon(8) behaves well
if given a non-existent filename. It gives a nice error message which
is better rather than the current silent failure.

Reviewed by:	des
2002-03-12 20:59:35 +00:00
Crist J. Clark
1e1d598496 Don't protect savecore(8) from being run with a bad dumpdir
argument. Don't fail silently, but let savecore(8) make noise. It
won't behave badly, it doesn't need protection.

At the same time, allow the administrator to have dumpdev enabled
while dumpdir (savecore(8)) is disabled and document how to do it.

PR:		conf/35725
2002-03-11 08:47:02 +00:00
Gregory Neil Shapiro
feb15b97ab Add infrastructure for sendmail 8.12. If users are not starting a daemon
at boot (sendmail_enable=NO), a localhost-only daemon may started
(sendmail_submit_enable) as it is needed to accept mail from command line
submissions.  If this isn't desired, see etc/mail/README for more hints.

Optionally (sendmail_msp_queue_enable) start a queue runner for the
submission queue in case a daemon isn't available to accept command line
submitted mail at submission time.

Note that the syslog labels for all of these sendmail processes have been
uniquified for easier log parsing.
2002-02-17 22:19:14 +00:00
Crist J. Clark
412c2bb7c1 Remove check for sendmail.conf before even trying to start sendmail.
Checking for the existence of sendmail.cf is rather silly when someone
is using the mailwrapper(8) to run a mail daemon that is not actually
sendmail(8). It is also probably better to let sendmail(8) actually
try to start and error out if the administrator has
'sendmail_enable="YES"' but no sendmail.conf. At present, it would
fail silently.

Reviewed by:	gshapiro
MFC after:	2 days
2002-02-17 02:01:15 +00:00
Yoshihiro Takahashi
f25125064b Use MACHINE_ARCH instead of MACHINE to check i386 arch.
MFC after:	3 days
2002-02-04 12:50:52 +00:00
Sheldon Hearn
3e38757beb Register amd's dependency on NFS.
This change was submitted to the freebsd-audit mailing list for review
but received no feedback.  Hindsight-enabled reviews are welcome.

PR:		conf/31358
Submitted:	Thomas Quinot <thomas@cuivre.fr.eu.org>
2002-01-28 11:05:01 +00:00
Sheldon Hearn
4a8eeedbb1 Don't require operators to override the list of network filesystem
types (networkfs_types) with a version that includes the original
list.

This increases the scope for user error and also means that systems with
networkfs_types set in /etc/rc.conf will not benefit from changes to the
list in /etc/defaults/rc.conf on upgrade.

Instead, store the default list in /etc/rc itself and allow the operator
to append to that list by specifying her own list in networkfs_types.

Rename networkfs_types to extra_netfs_types accordingly, as the new name
better describes the purpose of the variable.  Default the value to
'NO'.
2001-12-29 19:42:55 +00:00
Sheldon Hearn
d7fb353a43 Re-introduce the fix that delays mounting of network filesystems until
the network is initialized.  This was first implemented in rev 1.268
of src/etc/rc, but was backed out at wollman's request.

The objection was that the right place for the fix is in mount(8).
Having looked at that problem, I find it hard to believe that
the hoops one would have to jump through can be justified by the
desire for purity alone.

Note that there are reported issues surrounding nfsclient kernel
support and mount_nfs(8), which currently make NFS an ugly exception
to the general case.

With this change, systems with non-NFS network filesystems configured
for mounting on startup in /etc/fstab are no longer guaranteed to
fail on startup.
2001-12-27 13:41:27 +00:00