rc revision 77938
1#!/bin/sh
2#
3# Copyright (c) 2000  The FreeBSD Project
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14#
15# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25# SUCH DAMAGE.
26#
27# $FreeBSD: head/etc/rc 77938 2001-06-09 09:47:05Z sheldonh $
28#	From: @(#)rc	5.27 (Berkeley) 6/5/91
29#
30
31# System startup script run by init on autoboot
32# or after single-user.
33# Output and error are redirected to console by init,
34# and the console is the controlling terminal.
35
36# Note that almost all of the user-configurable behavior is no longer in
37# this file, but rather in /etc/defaults/rc.conf.  Please check that file
38# first before contemplating any changes here.  If you do need to change
39# this file for some reason, we would like to know about it.
40
41stty status '^T'
42
43# Set shell to ignore SIGINT (2), but not children;
44# shell catches SIGQUIT (3) and returns to single user after fsck.
45#
46trap : 2
47trap : 3	# shouldn't be needed
48
49bootmode=$1
50
51HOME=/
52PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
53export HOME PATH
54
55# BOOTP diskless boot.  We have to run the rc file early in order to
56# retarget various config files.
57#
58if [ -r /etc/rc.diskless1 ]; then
59	dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
60	if [ ${dlv:=0} != 0 ]; then
61		. /etc/rc.diskless1
62	fi
63fi
64
65# If there is a global system configuration file, suck it in.
66#
67if [ -r /etc/defaults/rc.conf ]; then
68	. /etc/defaults/rc.conf
69	source_rc_confs
70elif [ -r /etc/rc.conf ]; then
71	. /etc/rc.conf
72fi
73
74feed_dev_random() {
75	if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
76		echo "Using ${1} as an entropy file"
77		cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
78	fi
79}
80
81chkdepend() {
82	svc=$1
83	svc_var=$2
84	dep=$3
85	dep_var=$4
86
87	eval svc_val=\${$svc_var}
88	eval dep_val=\${$dep_var}
89
90	case ${svc_val} in
91	[Yy][Ee][Ss])
92		case ${dep_val} in
93		[Yy][Ee][Ss])
94		    ;;
95		*)
96		    eval ${dep_var}="YES"
97		    echo "DEPENDENCY NOTE: ${dep} will be enabled" \
98			 "to support ${svc}"
99		    ;;
100		esac
101		;;
102	esac
103}
104
105chkdepend amd amd_enable        portmap portmap_enable
106chkdepend NFS nfs_server_enable portmap portmap_enable
107chkdepend NIS nis_server_enable portmap portmap_enable
108chkdepend NIS nis_client_enable portmap portmap_enable
109
110# Enable harvesting of entropy via devices.  The sooner this happens the
111# better so that we can take advantage of the boot process.
112#
113echo -n 'Entropy harvesting:'
114
115case ${harvest_interrupt} in
116[Nn][Oo])
117	;;
118*)
119	if [ -w /dev/random ]; then
120		/sbin/sysctl -w kern.random.sys.harvest.interrupt=1 >/dev/null
121		echo -n ' interrupts'
122	fi
123	;;
124esac
125
126case ${harvest_ethernet} in
127[Nn][Oo])
128	;;
129*)
130	if [ -w /dev/random ]; then
131		/sbin/sysctl -w kern.random.sys.harvest.ethernet=1 >/dev/null
132		echo -n ' ethernet'
133	fi
134	;;
135esac
136
137case ${harvest_p_to_p} in
138[Nn][Oo])
139	;;
140*)
141	if [ -w /dev/random ]; then
142	/sbin/sysctl -w kern.random.sys.harvest.point_to_point=1 >/dev/null
143		echo -n ' point_to_point'
144	fi
145	;;
146esac
147
148echo '.'
149
150# First pass at reseeding /dev/random.
151#
152case ${entropy_file} in
153[Nn][Oo] | '')
154	;;
155*)
156	if [ -w /dev/random ]; then
157		feed_dev_random "${entropy_file}"
158	fi
159	;;
160esac
161
162# XXX temporary until we can get the entropy
163# harvesting rate up
164# Entropy below is not great,
165# but better than nothing.
166( ps -efauxww; sysctl -a; date; df -ib; dmesg; ps -efauxww; ) \
167    | dd of=/dev/random bs=8k 2>/dev/null
168cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null
169
170# Configure ccd devices.
171#
172if [ -r /etc/ccd.conf ]; then
173	ccdconfig -C
174fi
175
176case ${start_vinum} in
177[Yy][Ee][Ss])
178	vinum start
179	;;
180esac
181
182swapon -a
183
184case ${bootmode} in
185autoboot)
186	echo 'Automatic boot in progress...'
187	case ${background_fsck} in
188	[Yy][Ee][Ss])
189		fsck -F -p
190		;;
191	*)
192		fsck -p
193		;;
194	esac
195	case $? in
196	0)
197		;;
198	2)
199		exit 1
200		;;
201	4)
202		reboot
203		echo 'Reboot failed... help!'
204		exit 1
205		;;
206	8)
207		case ${fsck_y_enable} in
208		[Yy][Ee][Ss])
209			echo 'File system preen failed, trying fsck -y . . .'
210			fsck -y
211			case $? in
212			0)
213				;;
214			*)
215			echo 'Automatic file system check failed . . . help!'
216				exit 1
217				;;
218			esac
219			;;
220		*)
221			echo 'Automatic file system check failed . . . help!'
222			exit 1
223			;;
224		esac
225		;;
226	12)
227		echo 'Reboot interrupted'
228		exit 1
229		;;
230	130)
231		# interrupt before catcher installed
232		exit 1
233		;;
234	*)
235		echo 'Unknown error in reboot'
236		exit 1
237		;;
238	esac
239	;;
240*)
241	echo 'Skipping disk checks ...'
242	;;
243esac
244
245set -T
246trap "echo 'Reboot interrupted'; exit 1" 3
247
248# root normally must be read/write, but if this is a BOOTP NFS
249# diskless boot it does not have to be.
250#
251case ${root_rw_mount} in
252[Nn][Oo] | '')
253	;;
254*)
255	if ! mount -u -o rw / ; then
256		echo 'Mounting root filesystem rw failed, startup aborted'
257		exit 1
258	fi
259	;;
260esac
261
262umount -a >/dev/null 2>&1
263
264# Mount everything except remote filesystems.
265remotefs_types='nfs:NFS smbfs:SMB'
266mount_excludes='no'
267for i in ${remotefs_types}; do
268	fstype=${i%:*}
269	mount_excludes="${mount_excludes}${fstype},"
270done
271mount_excludes=${mount_excludes%,}
272mount -a -t ${mount_excludes}
273
274case $? in
2750)
276	;;
277*)
278	echo 'Mounting /etc/fstab filesystems failed, startup aborted'
279	exit 1
280	;;
281esac
282
283# Run custom disk mounting function here
284#
285if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
286		sh ${diskless_mount}
287fi
288
289# Reseed /dev/random with previously stored entropy.
290case ${entropy_dir} in
291[Nn][Oo])
292	;;
293*)
294	entropy_dir=${entropy_dir:-/var/db/entropy}
295	if [ -d "${entropy_dir}" ]; then
296		if [ -w /dev/random ]; then
297			for seedfile in ${entropy_dir}/*; do
298				feed_dev_random "${seedfile}"
299			done
300		fi
301	fi
302	;;
303esac
304
305case ${entropy_file} in
306[Nn][Oo] | '')
307	;;
308*)
309	if [ -w /dev/random ]; then
310		feed_dev_random "${entropy_file}"
311	fi
312	;;
313esac
314
315adjkerntz -i
316
317purgedir() {
318	local dir file
319
320	if [ $# -eq 0 ]; then
321		purgedir .
322	else
323		for dir
324		do
325		(
326			cd "$dir" && for file in .* *
327			do
328				[ ."$file" = .. -o ."$file" = ... ] && continue
329				if [ -d "$file" -a ! -L "$file" ]
330				then
331					purgedir "$file"
332				else
333					rm -f -- "$file"
334				fi
335			done
336		)
337		done
338	fi
339}
340
341clean_var() {
342	if [ ! -f /var/run/clean_var ]; then
343		purgedir /var/run /var/spool/lock
344		rm -rf /var/spool/uucp/.Temp/*
345		# Keep a copy of the boot messages around
346		dmesg >/var/run/dmesg.boot
347		# And an initial utmp file
348		(cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
349		>/var/run/clean_var
350	fi
351}
352
353if [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then
354	# network_pass1() *may* end up writing stuff to /var - we don't want to
355	# remove it immediately afterwards - *nor* to we want to fail to clean
356	# an nfs-mounted /var.
357	clean_var
358fi
359
360# Add additional swapfile, if configured.
361#
362case ${swapfile} in
363[Nn][Oo] | '')
364	;;
365*)
366	if [ -w "${swapfile}" -a -c /dev/mdctl ]; then
367		echo "Adding ${swapfile} as additional swap"
368		mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
369	fi
370	;;
371esac
372
373# Set sysctl variables as early as we can
374#
375if [ -r /etc/rc.sysctl ]; then
376	. /etc/rc.sysctl
377fi
378
379# Configure serial devices
380#
381if [ -r /etc/rc.serial ]; then
382	. /etc/rc.serial
383fi
384
385# Start up PC-card configuration
386#
387if [ -r /etc/rc.pccard ]; then
388	. /etc/rc.pccard
389fi
390
391# Start up the initial network configuration.
392#
393if [ -r /etc/rc.network ]; then
394	. /etc/rc.network	# We only need to do this once.
395	network_pass1
396fi
397
398case ${ipv6_enable} in
399[Yy][Ee][Ss])
400	if [ -r /etc/rc.network6 ]; then
401		. /etc/rc.network6	# We only need to do this once also.
402		network6_pass1
403	fi
404	;;
405esac
406
407# Mount remote filesystems if present in /etc/fstab
408for i in ${remotefs_types}; do
409	fstype=${i%:*}
410	fsdecr=${i#*:}
411	case "`mount -d -a -t ${fstype}`" in
412	*mount_${fstype}*)
413		echo -n "Mounting ${fsdecr} file systems:"
414		mount -a -t ${fstype}
415		echo '.'
416		;;
417	esac
418done
419
420# Whack the pty perms back into shape.
421#
422if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then
423	chflags 0 /dev/tty[pqrsPQRS]*
424	chmod 666 /dev/tty[pqrsPQRS]*
425	chown root:wheel /dev/tty[pqrsPQRS]*
426fi
427
428# Clean up left-over files
429#
430clean_var			# If it hasn't already been done
431rm /var/run/clean_var
432
433# Clearing /tmp at boot-time seems to have a long tradition.  It doesn't
434# help in any way for long-living systems, and it might accidentally
435# clobber files you would rather like to have preserved after a crash
436# (if not using mfs /tmp anyway).
437#
438# See also the example of another cleanup policy in /etc/periodic/daily.
439#
440case ${clear_tmp_enable} in
441[Yy][Ee][Ss])
442	echo -n 'Clearing /tmp:'
443	# prune quickly with one rm, then use find to clean up /tmp/[lq]*
444	# (not needed with mfs /tmp, but doesn't hurt there...)
445	(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
446		find -d . ! -name . ! -name lost+found ! -name quota.user \
447		! -name quota.group -exec rm -rf -- {} \;)
448	echo '.'
449	;;
450esac
451
452# Remove X lock files, since they will prevent you from restarting X11
453# after a system crash.
454#
455rm -f /tmp/.X*-lock /tmp/.X11-unix/*
456
457# Snapshot any kernel -c changes back to disk here <someday>.
458# This has changed with ELF and /kernel.config.
459
460echo -n 'Additional daemons:'
461
462# Start system logging and name service.  Named needs to start before syslogd
463# if you don't have a /etc/resolv.conf.
464#
465case ${syslogd_enable} in
466[Yy][Ee][Ss])
467	# Transitional symlink (for the next couple of years :) until all
468	# binaries have had a chance to move towards /var/run/log.
469	if [ ! -L /dev/log ]; then
470		# might complain for r/o root f/s
471		ln -sf /var/run/log /dev/log
472	fi
473
474	rm -f /var/run/log
475	echo -n ' syslogd';	syslogd ${syslogd_flags}
476	;;
477esac
478
479# Start disk checking daemon if required.
480#
481case ${diskcheckd_enable} in
482[Yy][Ee][Ss])
483	echo -n ' diskcheckd'; diskcheckd ${diskcheckd_flags}
484	;;
485esac
486
487echo '.'
488
489# Build device name databases if we are not using DEVFS
490#
491if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
492	rm -f /var/run/dev.db
493else
494	dev_mkdb
495fi
496
497# Enable dumpdev so that savecore can see it.
498# /var/crash should be a directory or a symbolic link
499# to the crash directory if core dumps are to be saved.
500#
501case ${dumpdev} in
502[Nn][Oo] | '')
503	;;
504*)
505	if [ -e "${dumpdev}" -a -d /var/crash ]; then
506		/sbin/dumpon -v ${dumpdev}
507		echo -n 'Checking for core dump: '
508		/sbin/savecore ${savecore_flags} /var/crash
509	fi
510	;;
511esac
512
513if [ -n "${network_pass1_done}" ]; then
514	network_pass2
515fi
516
517# Enable/Check the quotas (must be after ypbind if using NIS)
518#
519case ${enable_quotas} in
520[Yy][Ee][Ss])
521	case ${check_quotas} in
522	[Yy][Ee][Ss])
523		echo -n 'Checking quotas:'
524		quotacheck -a
525		echo ' done.'
526		;;
527	esac
528
529	echo -n 'Enabling quotas:'
530	quotaon -a
531	echo ' done.'
532	;;
533esac
534
535if [ -n "${network_pass2_done}" ]; then
536	network_pass3
537fi
538
539# Check the password temp/lock file
540#
541if [ -e /etc/ptmp ]; then
542	logger -s -p auth.err \
543	"password file may be incorrect -- /etc/ptmp exists"
544fi
545
546case ${accounting_enable} in
547[Yy][Ee][Ss])
548	if [ -d /var/account ]; then
549		echo 'Turning on accounting:'
550		if [ ! -e /var/account/acct ]; then
551			touch /var/account/acct
552		fi
553		accton /var/account/acct
554	fi
555	;;
556esac
557
558# Make shared lib searching a little faster.  Leave /usr/lib first if you
559# add your own entries or you may come to grief.
560#
561ldconfig="/sbin/ldconfig"
562case ${ldconfig_insecure} in
563[Yy][Ee][Ss])
564	ldconfig="${ldconfig} -i"
565	;;
566esac
567if [ -x /sbin/ldconfig ]; then
568	case `/usr/bin/objformat` in
569	elf)
570		_LDC=/usr/lib
571		for i in ${ldconfig_paths}; do
572			if [ -d "${i}" ]; then
573				_LDC="${_LDC} ${i}"
574			fi
575		done
576		echo 'ELF ldconfig path:' ${_LDC}
577		${ldconfig} -elf ${_LDC}
578		;;
579	esac
580
581	# Legacy aout support for i386 only
582	case `sysctl -n hw.machine` in
583	i386)
584		# Default the a.out ldconfig path.
585		: ${ldconfig_paths_aout=${ldconfig_paths}}
586		_LDC=/usr/lib/aout
587		for i in ${ldconfig_paths_aout}; do
588			if [ -d "${i}" ]; then
589				_LDC="${_LDC} ${i}"
590			fi
591		done
592		echo 'a.out ldconfig path:' ${_LDC}
593		${ldconfig} -aout ${_LDC}
594		;;
595	esac
596fi
597
598# Now start up miscellaneous daemons that don't belong anywhere else
599#
600echo -n 'Starting standard daemons:'
601case ${inetd_enable} in
602[Nn][Oo])
603	;;
604*)
605	echo -n ' inetd';	inetd ${inetd_flags}
606	;;
607esac
608
609case ${cron_enable} in
610[Nn][Oo])
611	;;
612*)
613	echo -n ' cron';	${cron_program:-/usr/sbin/cron} ${cron_flags}
614	;;
615esac
616
617case ${lpd_enable} in
618[Yy][Ee][Ss])
619	echo -n ' printer';	${lpd_program:-/usr/sbin/lpd} ${lpd_flags}
620	;;
621esac
622
623case ${sshd_enable} in
624[Yy][Ee][Ss])
625	if [ -x ${sshd_program:-/usr/sbin/sshd} ]; then
626		echo -n ' sshd';
627		${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
628	fi
629	;;
630esac
631
632case ${usbd_enable} in
633[Yy][Ee][Ss])
634	echo -n ' usbd';	/usr/sbin/usbd ${usbd_flags}
635	;;
636esac
637
638if [ -r /etc/mail/sendmail.cf ]; then
639	case ${sendmail_enable} in
640	[Yy][Ee][Ss])
641		echo -n ' sendmail'
642		/usr/sbin/sendmail ${sendmail_flags}
643		;;
644	*)
645		case ${sendmail_outbound_enable} in
646		[Yy][Ee][Ss])
647			echo -n ' sendmail'
648			/usr/sbin/sendmail ${sendmail_outbound_flags}
649			;;
650		esac
651		;;
652	esac
653fi
654
655echo '.'
656
657# Recover vi editor files.
658find /var/tmp/vi.recover ! -type f -a ! -type d -delete
659vibackup=`echo /var/tmp/vi.recover/vi.*`
660if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then
661	echo -n 'Recovering vi editor sessions:'
662	for i in /var/tmp/vi.recover/vi.*; do
663		# Only test files that are readable.
664		if [ ! -r "${i}" ]; then
665			continue
666		fi
667
668		# Unmodified nvi editor backup files either have the
669		# execute bit set or are zero length.  Delete them.
670		if [ -x "${i}" -o ! -s "${i}" ]; then
671			rm -f "${i}"
672		fi
673	done
674
675	# It is possible to get incomplete recovery files, if the editor
676	# crashes at the right time.
677	virecovery=`echo /var/tmp/vi.recover/recover.*`
678	if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then
679		for i in /var/tmp/vi.recover/recover.*; do
680			# Only test files that are readable.
681			if [ ! -r "${i}" ]; then
682				continue
683			fi
684
685			# Delete any recovery files that are zero length,
686			# corrupted, or that have no corresponding backup file.
687			# Else send mail to the user.
688			recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"`
689			if [ -n "${recfile}" -a -s "${recfile}" ]; then
690				sendmail -t < "${i}"
691			else
692				rm -f "${i}"
693			fi
694		done
695	fi
696	echo '.'
697fi
698
699# Make a bounds file for msgs(1) if there isn't one already
700#
701if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then
702	echo 0 > /var/msgs/bounds
703fi
704
705case ${update_motd} in
706[Nn][Oo] | '')
707	;;
708*)
709	if T=`mktemp /tmp/_motd.XXXXXX`; then
710		uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
711		awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
712		cmp -s ${T} /etc/motd || {
713			cp ${T} /etc/motd
714			chmod 644 /etc/motd
715		}
716		rm -f ${T}
717	fi
718	;;
719esac
720
721# Configure implementation specific stuff
722#
723arch=`uname -m`
724if [ -r /etc/rc.${arch} ]; then
725	. /etc/rc.${arch}
726fi
727
728# Configure the system console
729#
730if [ -r /etc/rc.syscons ]; then
731	. /etc/rc.syscons
732fi
733
734# Run rc.devfs if readable to customize devfs
735#
736if [ -r /etc/rc.devfs ]; then
737	sh /etc/rc.devfs
738fi
739
740echo -n 'Additional ABI support:'
741
742# Load the SysV IPC API if requested.
743case ${sysvipc_enable} in
744[Yy][Ee][Ss])
745	echo -n ' sysvipc'
746	kldload sysvmsg >/dev/null 2>&1
747	kldload sysvsem >/dev/null 2>&1
748	kldload sysvshm >/dev/null 2>&1
749	;;
750esac
751
752# Start the Linux binary compatibility if requested.
753#
754case ${linux_enable} in
755[Yy][Ee][Ss])
756	echo -n ' linux'
757	if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
758		kldload linux > /dev/null 2>&1
759	fi
760	if [ -x /compat/linux/sbin/ldconfig ]; then
761		/compat/linux/sbin/ldconfig
762	fi
763	;;
764esac
765
766# Start the SysVR4 binary emulation if requested.
767#
768case ${svr4_enable} in
769[Yy][Ee][Ss])
770	echo -n ' svr4';	kldload svr4 > /dev/null 2>&1
771	;;
772esac
773
774echo '.'
775
776# Do traditional (but rather obsolete) rc.local file if it exists.  If you
777# use this file and want to make it programmatic, source /etc/defaults/rc.conf
778# in /etc/rc.local and add your custom variables to /etc/rc.conf, as
779# shown below.  Please do not put local extensions into /etc/rc itself.
780# Use /etc/rc.local
781#
782# ---- rc.local ----
783#	if [ -r /etc/defaults/rc.conf ]; then
784#		. /etc/defaults/rc.conf
785#		source_rc_confs
786#	elif [ -r /etc/rc.conf ]; then
787#		. /etc/rc.conf
788#	fi
789#
790#	... additional startup conditionals ...
791# ---- rc.local ----
792#
793if [ -r /etc/rc.local ]; then
794	echo -n 'Starting local daemons:'
795	sh /etc/rc.local
796	echo '.'
797fi
798
799# For each valid dir in $local_startup, search for init scripts matching *.sh
800#
801case ${local_startup} in
802[Nn][Oo] | '')
803	;;
804*)
805	echo -n 'Local package initialization:'
806	for dir in ${local_startup}; do
807		if [ -d "${dir}" ]; then
808			for script in ${dir}/*.sh; do
809				if [ -x "${script}" ]; then
810					(set -T
811					 trap 'exit 1' 2
812					 ${script} start)
813				fi
814			done
815		fi
816	done
817	echo '.'
818	;;
819esac
820
821if [ -n "${network_pass3_done}" ]; then
822	network_pass4
823fi
824
825# Raise kernel security level.  This should be done only after `fsck' has
826# repaired local file systems if you want the securelevel to be greater than 1.
827#
828case ${kern_securelevel_enable} in
829[Yy][Ee][Ss])
830	if [ "${kern_securelevel}" -ge 0 ]; then
831		echo 'Raising kernel security level: '
832		sysctl -w kern.securelevel=${kern_securelevel}
833	fi
834	;;
835esac
836
837# Start background fsck checks if necessary
838case ${background_fsck} in
839[Yy][Ee][Ss])
840	echo 'Starting background filesystem checks'
841	nice -4 fsck -B -p 2>&1 | logger -p daemon.notice &
842	;;
843esac
844
845echo ''
846
847date
848
849exit 0
850
851