rc revision 63307
139287Ssos#!/bin/sh
239643Syokota# $FreeBSD: head/etc/rc 63307 2000-07-17 12:28:58Z markm $
3205566Sjkim#	From: @(#)rc	5.27 (Berkeley) 6/5/91
439287Ssos
539287Ssos# System startup script run by init on autoboot
639287Ssos# or after single-user.
739287Ssos# Output and error are redirected to console by init,
839287Ssos# and the console is the controlling terminal.
939287Ssos
1039643Syokota# Note that almost all of the user-configurable behavior is no longer in
1139643Syokota# this file, but rather in /etc/defaults/rc.conf.  Please check that file
1239287Ssos# first before contemplating any changes here.  If you do need to change
1339287Ssos# this file for some reason, we would like to know about it.
1439287Ssos
1539287Ssosstty status '^T'
1639643Syokota
1739643Syokota# Set shell to ignore SIGINT (2), but not children;
1839643Syokota# shell catches SIGQUIT (3) and returns to single user after fsck.
1939643Syokota#
2039643Syokotatrap : 2
2139643Syokotatrap : 3	# shouldn't be needed
2239643Syokota
2339643SyokotaHOME=/
2439643SyokotaPATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
2539643Syokotaexport HOME PATH
2639287Ssos
2739287Ssos# BOOTP diskless boot.  We have to run the rc file early in order to
28115703Sobrien# retarget various config files.
29115703Sobrien#
30115703Sobrienif [ -r /etc/rc.diskless1 ]; then
3142504Syokota	dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
3266710Sjhb	if [ ${dlv:=0} != 0 ]; then
3339287Ssos		. /etc/rc.diskless1
3456836Speter	fi
3539287Ssosfi
3639287Ssos
37198251Sjkim# If there is a global system configuration file, suck it in.
3839287Ssos#
3939287Ssosif [ -r /etc/defaults/rc.conf ]; then
4042179Syokota	. /etc/defaults/rc.conf
4139287Ssos	source_rc_confs
4248104Syokotaelif [ -r /etc/rc.conf ]; then
4348104Syokota	. /etc/rc.conf
4439287Ssosfi
4548104Syokota
4648104Syokota# Configure ccd devices.
47130312Sjhb#
4839287Ssosif [ -r /etc/ccd.conf ]; then
4939287Ssos	ccdconfig -C
50197383Sdelphijfi
51197025Sdelphij
5239287Ssoscase ${start_vinum} in
5342504Syokota[Yy][Ee][Ss])
5442504Syokota	vinum start
5539287Ssos	;;
56198251Sjkimesac
57198251Sjkim
5842504Syokotaswapon -a
5942504Syokota
60197444Sjkimcase $1 in
61197025Sdelphijautoboot)
62117710Srobert	echo Automatic boot in progress...
63117710Srobert	fsck -p
6442504Syokota	case $? in
6542611Syokota	0)
6642504Syokota		;;
6742504Syokota	2)
6839287Ssos		exit 1
6939287Ssos		;;
7039287Ssos	4)
7139287Ssos		reboot
7239287Ssos		echo "reboot failed... help!"
7339287Ssos		exit 1
7439287Ssos		;;
7539287Ssos	8)
7639287Ssos		echo "Automatic file system check failed... help!"
7739287Ssos		exit 1
78198419Sjkim		;;
7939287Ssos	12)
8039287Ssos		echo "Reboot interrupted"
8148399Speter		exit 1
8242504Syokota		;;
8348399Speter	130)
8448104Syokota		# interrupt before catcher installed
8542504Syokota		exit 1
8639287Ssos		;;
8739287Ssos	*)
8839287Ssos		echo "Unknown error in reboot"
8939287Ssos		exit 1
9039287Ssos		;;
9139287Ssos	esac
9239287Ssos	;;
9339287Ssos*)
9439287Ssos	echo Skipping disk checks ...
9539287Ssos	;;
9639287Ssosesac
9739287Ssos
9839287Ssosset -T
9939287Ssostrap "echo 'Reboot interrupted'; exit 1" 3
10039287Ssos
10142504Syokota# root normally must be read/write, but if this is a BOOTP NFS
10248104Syokota# diskless boot it does not have to be.
10342504Syokota#
10448104Syokotacase ${root_rw_mount} in
10548104Syokota[Nn][Oo] | '')
10648104Syokota	;;
10748104Syokota*)
10839287Ssos	if ! mount -u -o rw / ; then
10948104Syokota		echo "Mounting root filesystem rw failed, startup aborted"
11039287Ssos		exit 1
11142504Syokota	fi
11242504Syokota	;;
11342504Syokotaesac
11442504Syokota
11542504Syokotaumount -a >/dev/null 2>&1
11642504Syokota
11742504Syokota# Mount everything except nfs filesystems.
11842504Syokotamount -a -t nonfs
11942504Syokota
12042504Syokotacase $? in
12142504Syokota0)
12242504Syokota	;;
12342504Syokota*)
12442504Syokota	echo "Mounting /etc/fstab filesystems failed, startup aborted"
12542504Syokota	exit 1
12642504Syokota	;;
12742504Syokotaesac
12842504Syokota
12948104Syokota# Run custom disk mounting function here
13042504Syokota#
13148104Syokotaif [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
13248104Syokota		sh ${diskless_mount}
13348104Syokotafi
13448104Syokota
13548104Syokota# Recover some entropy so the rebooting /dev/random can reseed
13648104Syokota#
13739287Ssoscase ${entropy_file} in
13839287Ssos[Nn][Oo] | '')
13939287Ssos	;;
14042504Syokota*)
14139287Ssos	if [ -f ${entropy_file} -a -r ${entropy_file} ] ; then
14239287Ssos		echo -n "Reading entropy file"
14339287Ssos		cat ${entropy_file} > /dev/random
14439287Ssos		rm -f ${entropy_file}
14539287Ssos	fi
14639287Ssos	;;
14748104Syokotaesac
14839287Ssos
14948104Syokotaadjkerntz -i
15048104Syokota
15148104Syokotaclean_var() {
15248104Syokota	if [ ! -f /var/run/clean_var ]; then
15339287Ssos		rm -rf /var/run/*
15439287Ssos		find /var/spool/lock ! -type d -delete
15539287Ssos		rm -rf /var/spool/uucp/.Temp/*
15639287Ssos		# Keep a copy of the boot messages around
15739858Syokota		dmesg >/var/run/dmesg.boot
15839858Syokota		# And an initial utmp file
15939858Syokota		(cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
16039858Syokota		>/var/run/clean_var
16139287Ssos	fi
16239287Ssos}
16339287Ssos
16439287Ssosif [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then
16542504Syokota	# network_pass1() *may* end up writing stuff to /var - we don't want to
166198251Sjkim	# remove it immediately afterwards - *nor* to we want to fail to clean
16739287Ssos	# an nfs-mounted /var.
16839287Ssos	clean_var
169204265Sjkimfi
17045117Syokota
171204265Sjkim# Add additional swapfile, if configured.
17239287Ssos#
17342729Syokotacase ${swapfile} in
17442729Syokota[Nn][Oo] | '')
17548104Syokota	;;
17648104Syokota*)
17742729Syokota	if [ -w "${swapfile}" -a -c /dev/vn0b ]; then
17842729Syokota		echo "Adding ${swapfile} as additional swap."
17948104Syokota		vnconfig /dev/vn0b ${swapfile} && swapon /dev/vn0b
18048104Syokota	fi
18139287Ssos	;;
18239287Ssosesac
18339287Ssos
18439287Ssos# Set sysctl variables as early as we can
18539287Ssos#
18639287Ssosif [ -r /etc/rc.sysctl ]; then
18739287Ssos	. /etc/rc.sysctl
18839287Ssosfi
18939287Ssos
190198419Sjkim# Configure serial devices
19139287Ssos#
192205653Sjkimif [ -r /etc/rc.serial ]; then
19343664Syokota	. /etc/rc.serial
194205653Sjkimfi
19550446Syokota
19648399Speter# Start up PC-card configuration
19748104Syokota#
19848399Speterif [ -r /etc/rc.pccard ]; then
19948104Syokota	. /etc/rc.pccard
20039591Syokotafi
20139591Syokota
20248104Syokota# Start up the initial network configuration.
203205564Sjkim#
20439287Ssosif [ -r /etc/rc.network ]; then
20539591Syokota	. /etc/rc.network	# We only need to do this once.
20639287Ssos	network_pass1
20748399Speterfi
20848104Syokota
20948399Spetercase ${ipv6_enable} in
21048104Syokota[Yy][Ee][Ss])
21142504Syokota	if [ -r /etc/rc.network6 ]; then
21242504Syokota		. /etc/rc.network6	# We only need to do this once also.
21342504Syokota		network6_pass1
21442504Syokota	fi
215197383Sdelphij	;;
21642504Syokotaesac
217198251Sjkim
218198251Sjkim# Mount NFS filesystems if present in /etc/fstab
219197383Sdelphijcase "`mount -d -a -t nfs`" in
220197466Sjkim*mount_nfs*)
221197383Sdelphij	echo -n "Mounting NFS file systems"
222198251Sjkim	mount -a -t nfs
22342504Syokota	echo .
22442504Syokota	;;
225198251Sjkimesac
226198251Sjkim
227198251Sjkim# Whack the pty perms back into shape.
228198251Sjkim#
229198251Sjkimchflags 0 /dev/tty[pqrsPQRS]*
230198251Sjkimchmod 666 /dev/tty[pqrsPQRS]*
231198251Sjkimchown root:wheel /dev/tty[pqrsPQRS]*
232198251Sjkim
233198251Sjkim# Clean up left-over files
234198251Sjkim#
235198251Sjkimclean_var			# If it hasn't already been done
236198251Sjkimrm /var/run/clean_var
237198251Sjkim
238198251Sjkim# Clearing /tmp at boot-time seems to have a long tradition.  It doesn't
239198251Sjkim# help in any way for long-living systems, and it might accidentally
240198251Sjkim# clobber files you would rather like to have preserved after a crash
241198251Sjkim# (if not using mfs /tmp anyway).
242198251Sjkim#
243198251Sjkim# See also the example of another cleanup policy in /etc/periodic/daily.
244199230Sjkim#
245199230Sjkimcase ${clear_tmp_enable} in
246198251Sjkim[Yy][Ee][Ss])
247198251Sjkim	echo clearing /tmp
248198251Sjkim	# prune quickly with one rm, then use find to clean up /tmp/[lq]*
249198251Sjkim	# (not needed with mfs /tmp, but doesn't hurt there...)
250198251Sjkim	(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
251198251Sjkim		find -d . ! -name . ! -name lost+found ! -name quota.user \
252198251Sjkim		! -name quota.group -exec rm -rf -- {} \;)
253198251Sjkim	;;
254198251Sjkimesac
255198251Sjkim
256198251Sjkim# Remove X lock files, since they will prevent you from restarting X11
257198251Sjkim# after a system crash.
258198251Sjkim#
259198251Sjkimrm -f /tmp/.X*-lock /tmp/.X11-unix/*
260198251Sjkim
261198251Sjkim# Snapshot any kernel -c changes back to disk here <someday>.
262198251Sjkim# This has changed with ELF and /kernel.config.
263198251Sjkim
264198251Sjkimecho -n 'additional daemons:'
265198251Sjkim
266198251Sjkim# Start system logging and name service.  Named needs to start before syslogd
267198251Sjkim# if you don't have a /etc/resolv.conf.
268198251Sjkim#
269198251Sjkimcase ${syslogd_enable} in
270198251Sjkim[Yy][Ee][Ss])
271198251Sjkim	# Transitional symlink (for the next couple of years :) until all
272198419Sjkim	# binaries have had a chance to move towards /var/run/log.
273198419Sjkim	if [ ! -h /dev/log ]; then
274198419Sjkim		# might complain for r/o root f/s
275198419Sjkim		ln -sf /var/run/log /dev/log
276198251Sjkim	fi
277198251Sjkim
278198251Sjkim	rm -f /var/run/log
27939287Ssos	echo -n ' syslogd';	syslogd ${syslogd_flags}
28039287Ssos	;;
28139287Ssosesac
28239287Ssos
283197383Sdelphijecho '.'
284198251Sjkim
285198251Sjkim# Enable dumpdev so that savecore can see it.
28639287Ssos# /var/crash should be a directory or a symbolic link
287198251Sjkim# to the crash directory if core dumps are to be saved.
288198251Sjkim#
289198251Sjkimcase ${dumpdev} in
29044846Sjlemon[Nn][Oo] | '')
291198251Sjkim	;;
292198251Sjkim*)
293198251Sjkim	if [ -e "${dumpdev}" -a -d /var/crash ]; then
294197025Sdelphij		dumpon ${dumpdev}
295198251Sjkim		echo -n checking for core dump...
296198251Sjkim		savecore /var/crash
297197025Sdelphij	fi
298197466Sjkim	;;
299197383Sdelphijesac
300198251Sjkim
301198251Sjkimif [ -n "${network_pass1_done}" ]; then
302198251Sjkim	network_pass2
303197383Sdelphijfi
304197025Sdelphij
30539287Ssos# Enable/Check the quotas (must be after ypbind if using NIS)
306198251Sjkim#
307197025Sdelphijcase ${enable_quotas} in
308198251Sjkim[Yy][Ee][Ss])
30939287Ssos	case ${check_quotas} in
31039287Ssos	[Yy][Ee][Ss])
31139287Ssos		echo -n 'checking quotas:'
31239287Ssos		quotacheck -a
31339287Ssos		echo ' done.'
314197383Sdelphij		;;
31539287Ssos	esac
316198251Sjkim
317198251Sjkim	echo -n 'enabling quotas:'
318198251Sjkim	quotaon -a
319197025Sdelphij	echo ' done.'
320197466Sjkim	;;
321197383Sdelphijesac
322198251Sjkim
32339287Ssosif [ -n "${network_pass2_done}" ]; then
32439287Ssos	network_pass3
325204265Sjkimfi
32639287Ssos
32745117Syokota# Build ps databases
32845117Syokota#
329197383Sdelphijdev_mkdb
33045117Syokota
331198251Sjkim# Check the password temp/lock file
332198251Sjkim#
333198251Sjkimif [ -e /etc/ptmp ]; then
334197025Sdelphij	logger -s -p auth.err \
335197466Sjkim	"password file may be incorrect -- /etc/ptmp exists"
336197383Sdelphijfi
337198251Sjkim
338198251Sjkimcase ${accounting_enable} in
339197025Sdelphij[Yy][Ee][Ss])
340198251Sjkim	if [ -d /var/account ]; then
34145117Syokota		echo 'turning on accounting'
342204265Sjkim		if [ ! -e /var/account/acct ]; then
34345117Syokota			touch /var/account/acct
34445117Syokota		fi
34539287Ssos		accton /var/account/acct
34639287Ssos	fi
347197383Sdelphij	;;
34839287Ssosesac
349198251Sjkim
350198251Sjkim# Make shared lib searching a little faster.  Leave /usr/lib first if you
351198251Sjkim# add your own entries or you may come to grief.
352198251Sjkim#
353197025Sdelphijif [ -x /sbin/ldconfig ]; then
354197466Sjkim	case `/usr/bin/objformat` in
355197383Sdelphij	elf)
356198251Sjkim		_LDC=/usr/lib
357198251Sjkim		for i in ${ldconfig_paths}; do
358197025Sdelphij			if [ -d "${i}" ]; then
359198251Sjkim				_LDC="${_LDC} ${i}"
36039287Ssos			fi
36139287Ssos		done
36239287Ssos		echo 'setting ELF ldconfig path:' ${_LDC}
36342729Syokota		ldconfig -elf ${_LDC}
36439287Ssos		;;
365197383Sdelphij	esac
366198251Sjkim
36739287Ssos	# Legacy aout support for i386 only
36839287Ssos	case `sysctl -n hw.machine` in
36939287Ssos	i386)
370198251Sjkim		# Default the a.out ldconfig path.
371198251Sjkim		: ${ldconfig_paths_aout=${ldconfig_paths}}
372198251Sjkim		_LDC=/usr/lib/aout
37344846Sjlemon		for i in ${ldconfig_paths_aout}; do
374198251Sjkim			if [ -d "${i}" ]; then
375198251Sjkim				_LDC="${_LDC} ${i}"
376198251Sjkim			fi
377198251Sjkim		done
378198251Sjkim		echo 'setting a.out ldconfig path:' ${_LDC}
379197025Sdelphij		ldconfig -aout ${_LDC}
380198251Sjkim		;;
381198251Sjkim	esac
382197025Sdelphijfi
383197466Sjkim
384197025Sdelphij# Now start up miscellaneous daemons that don't belong anywhere else
385198251Sjkim#
386198251Sjkimecho -n starting standard daemons:
387198251Sjkimcase ${inetd_enable} in
388197383Sdelphij[Nn][Oo])
38939287Ssos	;;
39042729Syokota*)
39139287Ssos	echo -n ' inetd';	inetd ${inetd_flags}
392198858Sjkim	;;
393198858Sjkimesac
394198858Sjkim
39539287Ssoscase ${cron_enable} in
396198251Sjkim[Nn][Oo])
397197383Sdelphij	;;
398198251Sjkim*)
39939287Ssos	echo -n ' cron';	cron
40039287Ssos	;;
40139287Ssosesac
40248104Syokota
40348104Syokotacase ${lpd_enable} in
40448104Syokota[Yy][Ee][Ss])
405197383Sdelphij	echo -n ' printer';	${lpd_program:-/usr/sbin/lpd} ${lpd_flags}
406198251Sjkim	;;
40748104Syokotaesac
40848104Syokota
40948104Syokotacase ${sendmail_enable} in
410198251Sjkim[Yy][Ee][Ss])
411198251Sjkim	if [ -r /etc/mail/sendmail.cf ]; then
412198251Sjkim		echo -n ' sendmail';	/usr/sbin/sendmail ${sendmail_flags}
41348104Syokota	fi
414198251Sjkim	;;
415198251Sjkimesac
416198251Sjkim
417198251Sjkimcase ${sshd_enable} in
418198251Sjkim[Yy][Ee][Ss])
419197025Sdelphij	if [ -x ${sshd_program:-/usr/sbin/sshd} ]; then
420198251Sjkim		echo -n ' sshd';
421198251Sjkim		${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
422197025Sdelphij	fi
423197466Sjkim	;;
424197025Sdelphijesac
425198251Sjkim
426198251Sjkimcase ${usbd_enable} in
427198251Sjkim[Yy][Ee][Ss])
428197383Sdelphij	echo -n ' usbd';	/usr/sbin/usbd ${usbd_flags}
42948104Syokota	;;
43048104Syokotaesac
43148104Syokota
432198858Sjkimecho '.'
433198858Sjkim
434198858Sjkim# Recover vi editor files.
43548104Syokotafind /var/tmp/vi.recover ! -type f -a ! -type d -delete
436198251Sjkimvibackup=`echo /var/tmp/vi.recover/vi.*`
437197383Sdelphijif [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then
438198251Sjkim	echo 'Recovering vi editor sessions'
43948104Syokota	for i in /var/tmp/vi.recover/vi.*; do
44048104Syokota		# Only test files that are readable.
44148104Syokota		if [ ! -r "${i}" ]; then
44242729Syokota			continue
44339287Ssos		fi
444197383Sdelphij
445198251Sjkim		# Unmodified nvi editor backup files either have the
44639287Ssos		# execute bit set or are zero length.  Delete them.
44739287Ssos		if [ -x "${i}" -o ! -s "${i}" ]; then
44839287Ssos			rm -f "${i}"
449198251Sjkim		fi
450198251Sjkim	done
451198251Sjkim
452197025Sdelphij	# It is possible to get incomplete recovery files, if the editor
453198251Sjkim	# crashes at the right time.
454198251Sjkim	virecovery=`echo /var/tmp/vi.recover/recover.*`
455198251Sjkim	if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then
456198251Sjkim		for i in /var/tmp/vi.recover/recover.*; do
457198251Sjkim			# Only test files that are readable.
458198251Sjkim			if [ ! -r "${i}" ]; then
459198251Sjkim				continue
460198251Sjkim			fi
461198251Sjkim
46242729Syokota			# Delete any recovery files that are zero length,
46339287Ssos			# corrupted, or that have no corresponding backup file.
464198858Sjkim			# Else send mail to the user.
465198858Sjkim			recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"`
466198858Sjkim			if [ -n "${recfile}" -a -s "${recfile}" ]; then
467198858Sjkim				sendmail -t < "${i}"
46839287Ssos			else
469197466Sjkim				rm -f "${i}"
470198251Sjkim			fi
471197025Sdelphij		done
472198251Sjkim	fi
47339287Ssosfi
47439287Ssos
47539287Ssos# Make a bounds file for msgs(1) if there isn't one already
47648104Syokota# "Delete important files with symlink" security hole?
47748104Syokota#
47848104Syokotaif [ -d /var/msgs -a ! -f /var/msgs/bounds ]; then
479197383Sdelphij	echo 0 > /var/msgs/bounds
480198251Sjkimfi
48148104Syokota
48248104Syokotacase ${update_motd} in
48348104Syokota[Nn][Oo] | '')
484198251Sjkim	;;
485198251Sjkim*)
486198251Sjkim	if T=`mktemp /tmp/_motd.XXXXXX`; then
487197025Sdelphij		uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
488198251Sjkim		awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
489198251Sjkim		cmp -s ${T} /etc/motd || {
490198251Sjkim			cp ${T} /etc/motd
491198251Sjkim			chmod 644 /etc/motd
492198251Sjkim		}
493198251Sjkim		rm -f ${T}
494198251Sjkim	fi
495198251Sjkim	;;
496198251Sjkimesac
49748104Syokota
49848104Syokota# Configure implementation specific stuff
499198858Sjkim#
500198858Sjkimarch=`uname -m`
501198858Sjkimif [ -r /etc/rc.${arch} ]; then
502198858Sjkim	. /etc/rc.${arch}
50348104Syokotafi
504197466Sjkim
505198251Sjkim# Run rc.devfs if readable to customize devfs
506197025Sdelphij#
507198251Sjkimif [ -r /etc/rc.devfs ]; then
50848104Syokota	sh /etc/rc.devfs
50948104Syokotafi
510198419Sjkim
51139287Ssos# Do traditional (but rather obsolete) rc.local file if it exists.  If you
51239287Ssos# use this file and want to make it programmatic, source /etc/defaults/rc.conf
513197383Sdelphij# in /etc/rc.local and add your custom variables to /etc/rc.conf, as
51439287Ssos# shown below.  Please do not put local extensions into /etc/rc itself.
515198251Sjkim# Use /etc/rc.local
516198251Sjkim#
517198251Sjkim# ---- rc.local ----
518198251Sjkim#	if [ -r /etc/defaults/rc.conf ]; then
519197025Sdelphij#		. /etc/defaults/rc.conf
520197466Sjkim#		source_rc_confs
521197383Sdelphij#	elif [ -r /etc/rc.conf ]; then
522198251Sjkim#		. /etc/rc.conf
523198251Sjkim#	fi
524197025Sdelphij#
525198251Sjkim#	... additional startup conditionals ...
52639287Ssos# ---- rc.local ----
52739287Ssos#
52839287Ssosif [ -r /etc/rc.local ]; then
52939287Ssos	echo -n 'starting local daemons:'
53039287Ssos	sh /etc/rc.local
531197383Sdelphij	echo '.'
532198251Sjkimfi
533198251Sjkim
53439287Ssos# For each valid dir in $local_startup, search for init scripts matching *.sh
535198251Sjkim#
536198251Sjkimcase ${local_startup} in
537197025Sdelphij[Nn][Oo] | '')
538198251Sjkim	;;
539197025Sdelphij*)
540198251Sjkim	echo -n 'Local package initialization:'
541198251Sjkim	for dir in ${local_startup}; do
542198251Sjkim		if [ -d "${dir}" ]; then
543198251Sjkim			for script in ${dir}/*.sh; do
544197025Sdelphij				if [ -x "${script}" ]; then
545198251Sjkim					(set -T
546198251Sjkim					 trap 'exit 1' 2
54744846Sjlemon					 ${script} start)
548198251Sjkim				fi
549198251Sjkim			done
550198251Sjkim		fi
551198251Sjkim	done
552198251Sjkim	echo .
553198251Sjkim	;;
554198251Sjkimesac
555198251Sjkim
556198251Sjkimif [ -n "${network_pass3_done}" ]; then
557198251Sjkim	network_pass4
558198251Sjkimfi
559197025Sdelphij
560198251Sjkim# Raise kernel security level.  This should be done only after `fsck' has
56139287Ssos# repaired local file systems if you want the securelevel to be greater than 1.
56239287Ssos#
563205653Sjkimcase ${kern_securelevel_enable} in
56443664Syokota[Yy][Ee][Ss])
56543664Syokota	if [ "${kern_securelevel}" -ge 0 ]; then
56643664Syokota		echo 'Raising kernel security level'
567197383Sdelphij		sysctl -w kern.securelevel=${kern_securelevel}
56843664Syokota	fi
569198251Sjkim	;;
570198251Sjkimesac
571198251Sjkim
572197025Sdelphijdate
573197466Sjkimexit 0
574197383Sdelphij