rc revision 96703
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# @(#)rc 5.27 (Berkeley) 6/5/91 28# $FreeBSD: head/etc/rc 96703 2002-05-16 02:10:03Z trhodes $ 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 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 amd amd_enable NFS nfs_client_enable 107chkdepend NFS nfs_server_enable portmap portmap_enable 108chkdepend NIS nis_server_enable portmap portmap_enable 109chkdepend NIS nis_client_enable portmap portmap_enable 110 111# Enable dumpdev early so that a crash during the boot process can be caught. 112# 113case ${dumpdev} in 114[Nn][Oo] | '') 115 dumpdev='NO' 116 ;; 117*) 118 /sbin/dumpon -v ${dumpdev} 119 ;; 120esac 121 122# Enable harvesting of entropy via devices. The sooner this happens the 123# better so that we can take advantage of the boot process. 124# 125echo -n 'Entropy harvesting:' 126 127case ${harvest_interrupt} in 128[Nn][Oo]) 129 ;; 130*) 131 if [ -w /dev/random ]; then 132 /sbin/sysctl kern.random.sys.harvest.interrupt=1 >/dev/null 133 echo -n ' interrupts' 134 fi 135 ;; 136esac 137 138case ${harvest_ethernet} in 139[Nn][Oo]) 140 ;; 141*) 142 if [ -w /dev/random ]; then 143 /sbin/sysctl kern.random.sys.harvest.ethernet=1 >/dev/null 144 echo -n ' ethernet' 145 fi 146 ;; 147esac 148 149case ${harvest_p_to_p} in 150[Nn][Oo]) 151 ;; 152*) 153 if [ -w /dev/random ]; then 154 /sbin/sysctl kern.random.sys.harvest.point_to_point=1 >/dev/null 155 echo -n ' point_to_point' 156 fi 157 ;; 158esac 159 160echo '.' 161 162# First pass at reseeding /dev/random. 163# 164case ${entropy_file} in 165[Nn][Oo] | '') 166 ;; 167*) 168 if [ -w /dev/random ]; then 169 feed_dev_random "${entropy_file}" 170 fi 171 ;; 172esac 173 174# XXX temporary until we can get the entropy 175# harvesting rate up 176# Entropy below is not great, 177# but better than nothing. 178( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \ 179 | dd of=/dev/random bs=8k 2>/dev/null 180cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null 181 182# Configure ccd devices. 183# 184if [ -r /etc/ccd.conf ]; then 185 ccdconfig -C 186fi 187 188case ${start_vinum} in 189[Yy][Ee][Ss]) 190 vinum start 191 ;; 192esac 193 194swapon -a 195 196# Last chance to do things before potentially waiting for 197# operator to do fsck related tasks 198if [ -r /etc/rc.early ]; then 199 . /etc/rc.early 200fi 201 202case ${bootmode} in 203autoboot) 204 echo 'Automatic boot in progress...' 205 case ${background_fsck} in 206 [Yy][Ee][Ss]) 207 fsck -F -p 208 ;; 209 *) 210 fsck -p 211 ;; 212 esac 213 case $? in 214 0) 215 ;; 216 2) 217 exit 1 218 ;; 219 4) 220 reboot 221 echo 'Reboot failed... help!' 222 exit 1 223 ;; 224 8) 225 case ${fsck_y_enable} in 226 [Yy][Ee][Ss]) 227 echo 'File system preen failed, trying fsck -y . . .' 228 fsck -y 229 case $? in 230 0) 231 ;; 232 *) 233 echo 'Automatic filesystem check failed . . . help!' 234 exit 1 235 ;; 236 esac 237 ;; 238 *) 239 echo 'Automatic filesystem check failed . . . help!' 240 exit 1 241 ;; 242 esac 243 ;; 244 12) 245 echo 'Reboot interrupted' 246 exit 1 247 ;; 248 130) 249 # interrupt before catcher installed 250 exit 1 251 ;; 252 *) 253 echo 'Unknown error in reboot' 254 exit 1 255 ;; 256 esac 257 ;; 258*) 259 echo 'Skipping disk checks ...' 260 ;; 261esac 262 263set -T 264trap "echo 'Reboot interrupted'; exit 1" 3 265 266# root normally must be read/write, but if this is a BOOTP NFS 267# diskless boot it does not have to be. 268# 269case ${root_rw_mount} in 270[Nn][Oo] | '') 271 ;; 272*) 273 if ! mount -u -o rw / ; then 274 echo 'Mounting root filesystem rw failed, startup aborted' 275 exit 1 276 fi 277 ;; 278esac 279 280umount -a >/dev/null 2>&1 281 282# Set up the list of network filesystem types for which mounting should be 283# delayed until after network initialization. 284networkfs_types='nfs:NFS smbfs:SMB portalfs:PORTAL' 285case ${extra_netfs_types} in 286[Nn][Oo]) 287 ;; 288*) 289 networkfs_types="${networkfs_types} ${extra_netfs_types}" 290 ;; 291esac 292 293# Mount everything except nfs filesystems. 294mount_excludes='no' 295for i in ${networkfs_types}; do 296 fstype=${i%:*} 297 mount_excludes="${mount_excludes}${fstype}," 298done 299mount_excludes=${mount_excludes%,} 300mount -a -t ${mount_excludes} 301 302case $? in 3030) 304 ;; 305*) 306 echo 'Mounting /etc/fstab filesystems failed, startup aborted' 307 exit 1 308 ;; 309esac 310 311# Run custom disk mounting function here 312# 313if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then 314 sh ${diskless_mount} 315fi 316 317# If we booted a special kernel remove the record so we will boot 318# the default kernel next time 319rm -f /boot/nextboot.conf 320 321# Reseed /dev/random with previously stored entropy. 322case ${entropy_dir} in 323[Nn][Oo]) 324 ;; 325*) 326 entropy_dir=${entropy_dir:-/var/db/entropy} 327 if [ -d "${entropy_dir}" ]; then 328 if [ -w /dev/random ]; then 329 for seedfile in ${entropy_dir}/*; do 330 feed_dev_random "${seedfile}" 331 done 332 fi 333 fi 334 ;; 335esac 336 337case ${entropy_file} in 338[Nn][Oo] | '') 339 ;; 340*) 341 if [ -w /dev/random ]; then 342 feed_dev_random "${entropy_file}" 343 fi 344 ;; 345esac 346 347adjkerntz -i 348 349purgedir() { 350 local dir file 351 352 if [ $# -eq 0 ]; then 353 purgedir . 354 else 355 for dir 356 do 357 ( 358 cd "$dir" && for file in .* * 359 do 360 [ ."$file" = .. -o ."$file" = ... ] && continue 361 if [ -d "$file" -a ! -L "$file" ] 362 then 363 purgedir "$file" 364 else 365 rm -f -- "$file" 366 fi 367 done 368 ) 369 done 370 fi 371} 372 373clean_var() { 374 if [ -d /var/run -a ! -f /var/run/clean_var ]; then 375 purgedir /var/run 376 # Keep a copy of the boot messages around 377 dmesg >/var/run/dmesg.boot 378 # And an initial utmp file 379 (cd /var/run && cp /dev/null utmp && chmod 644 utmp;) 380 >/var/run/clean_var 381 fi 382 if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then 383 purgedir /var/spool/lock 384 >/var/spool/lock/clean_var 385 fi 386 rm -rf /var/spool/uucp/.Temp/* 387} 388 389# network_pass1() *may* end up writing stuff to /var - we don't want to 390# remove it immediately afterwards - *nor* do we want to fail to clean 391# an NFS-mounted /var. 392rm -f /var/run/clean_var /var/spool/lock/clean_var 393clean_var 394 395# Add additional swapfile, if configured. 396# 397case ${swapfile} in 398[Nn][Oo] | '') 399 ;; 400*) 401 if [ -w "${swapfile}" -a -c /dev/mdctl ]; then 402 echo "Adding ${swapfile} as additional swap" 403 mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev} 404 fi 405 ;; 406esac 407 408# Early pass to set the variables we can 409# 410if [ -r /etc/rc.sysctl ]; then 411 sh /etc/rc.sysctl first 412fi 413 414# Configure serial devices 415# 416if [ -r /etc/rc.serial ]; then 417 . /etc/rc.serial 418fi 419 420# Start up PC-card configuration 421# 422if [ -r /etc/rc.pccard ]; then 423 . /etc/rc.pccard 424fi 425 426# Start up the initial network configuration. 427# 428if [ -r /etc/rc.network ]; then 429 . /etc/rc.network # We only need to do this once. 430 network_pass1 431fi 432 433case ${ipv6_enable} in 434[Yy][Ee][Ss]) 435 if [ -r /etc/rc.network6 ]; then 436 . /etc/rc.network6 # We only need to do this once also. 437 network6_pass1 438 fi 439 ;; 440esac 441 442# Mount NFS filesystems if present in /etc/fstab 443# 444# XXX When the vfsload() issues with nfsclient support and related sysctls 445# have been resolved, this block can be removed, and the condition that 446# skips nfs in the following block (for "other network filesystems") can 447# be removed. 448case "`mount -d -a -t nfs 2> /dev/null`" in 449*mount_nfs*) 450 # Handle absent nfs client support 451 nfsclient_in_kernel=0 452 if sysctl vfs.nfs >/dev/null 2>&1; then 453 nfsclient_in_kernel=1 454 else 455 kldload nfsclient && nfsclient_in_kernel=1 456 fi 457 458 case ${nfsclient_in_kernel} in 459 1) 460 echo -n 'Mounting NFS filesystem:' 461 mount -a -t nfs 462 echo '.' 463 ;; 464 *) 465 echo 'Warning: nfs mount requested, but no nfs client in kernel' 466 ;; 467 esac 468 ;; 469esac 470 471# Mount other network filesystems if present in /etc/fstab 472for i in ${networkfs_types}; do 473 fstype=${i%:*} 474 fsdecr=${i#*:} 475 476 if [ "${fstype}" = "nfs" ]; then 477 continue 478 fi 479 case "`mount -d -a -t ${fstype}`" in 480 *mount_${fstype}*) 481 echo -n "Mounting ${fsdecr} filesystems:" 482 mount -a -t ${fstype} 483 echo '.' 484 ;; 485 esac 486done 487 488# Whack the pty perms back into shape. 489# 490if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then 491 chflags 0 /dev/tty[pqrsPQRS]* 492 chmod 666 /dev/tty[pqrsPQRS]* 493 chown root:wheel /dev/tty[pqrsPQRS]* 494fi 495 496# Clean up left-over files 497# 498clean_var # If it hasn't already been done 499rm /var/run/clean_var /var/spool/lock/clean_var 500 501# Clearing /tmp at boot-time seems to have a long tradition. It doesn't 502# help in any way for long-living systems, and it might accidentally 503# clobber files you would rather like to have preserved after a crash 504# (if not using mfs /tmp anyway). 505# 506# See also the example of another cleanup policy in /etc/periodic/daily. 507# 508case ${clear_tmp_enable} in 509[Yy][Ee][Ss]) 510 echo -n 'Clearing /tmp:' 511 # prune quickly with one rm, then use find to clean up /tmp/[lq]* 512 # (not needed with mfs /tmp, but doesn't hurt there...) 513 (cd /tmp && rm -rf [a-km-pr-zA-Z]* && 514 find -d . ! -name . ! -name lost+found ! -name quota.user \ 515 ! -name quota.group -exec rm -rf -- {} \;) 516 echo '.' 517 ;; 518esac 519 520# Remove X lock files, since they will prevent you from restarting X11 521# after a system crash. 522# 523rm -f /tmp/.X*-lock 524rm -fr /tmp/.X11-unix 525mkdir -m 1777 /tmp/.X11-unix 526 527# Snapshot any kernel -c changes back to disk here <someday>. 528# This has changed with ELF and /kernel.config. 529 530# Load LOMAC(4) security if wanted. 531case ${lomac_enable} in 532[Yy][Ee][Ss]) 533 kldload lomac >/dev/null 2>&1 534 ;; 535esac 536 537echo -n 'Additional daemons:' 538 539# Start system logging and name service. Named needs to start before syslogd 540# if you don't have a /etc/resolv.conf. 541# 542case ${syslogd_enable} in 543[Yy][Ee][Ss]) 544 # Transitional symlink (for the next couple of years :) until all 545 # binaries have had a chance to move towards /var/run/log. 546 if [ ! -L /dev/log ]; then 547 # might complain for r/o root f/s 548 ln -sf /var/run/log /dev/log 549 fi 550 551 rm -f /var/run/log 552 echo -n ' syslogd'; 553 ${syslogd_program:-/usr/sbin/syslogd} ${syslogd_flags} 554 ;; 555esac 556 557echo '.' 558 559# Build device name databases if we are not using DEVFS 560# 561if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 562 rm -f /var/run/dev.db 563else 564 dev_mkdb 565fi 566 567# $dumpdir should be a directory or a symbolic link 568# to the crash directory if core dumps are to be saved. 569# 570if [ "${dumpdev}" != 'NO' ]; then 571 case ${dumpdir} in 572 '') 573 dumpdir='/var/crash' 574 ;; 575 [Nn][Oo]) 576 dumpdir='NO' 577 ;; 578 esac 579 580 if [ "${dumpdir}" != 'NO' ]; then 581 echo -n 'Checking for core dump: ' 582 /sbin/savecore ${savecore_flags} "${dumpdir}" 583 fi 584fi 585 586if [ -n "${network_pass1_done}" ]; then 587 network_pass2 588fi 589 590# Enable/Check the quotas (must be after ypbind if using NIS) 591# 592case ${enable_quotas} in 593[Yy][Ee][Ss]) 594 case ${check_quotas} in 595 [Yy][Ee][Ss]) 596 echo -n 'Checking quotas:' 597 quotacheck -a 598 echo ' done.' 599 ;; 600 esac 601 602 echo -n 'Enabling quotas:' 603 quotaon -a 604 echo ' done.' 605 ;; 606esac 607 608if [ -n "${network_pass2_done}" ]; then 609 network_pass3 610fi 611 612# Check the password temp/lock file 613# 614if [ -e /etc/ptmp ]; then 615 logger -s -p auth.err \ 616 "password file may be incorrect -- /etc/ptmp exists" 617fi 618 619case ${accounting_enable} in 620[Yy][Ee][Ss]) 621 if [ -d /var/account ]; then 622 echo 'Turning on accounting:' 623 if [ ! -e /var/account/acct ]; then 624 touch /var/account/acct 625 fi 626 accton /var/account/acct 627 fi 628 ;; 629esac 630 631# Make shared lib searching a little faster. Leave /usr/lib first if you 632# add your own entries or you may come to grief. 633# 634ldconfig="/sbin/ldconfig" 635case ${ldconfig_insecure} in 636[Yy][Ee][Ss]) 637 ldconfig="${ldconfig} -i" 638 ;; 639esac 640if [ -x /sbin/ldconfig ]; then 641 case `/usr/bin/objformat` in 642 elf) 643 _LDC=/usr/lib 644 for i in ${ldconfig_paths}; do 645 if [ -d "${i}" ]; then 646 _LDC="${_LDC} ${i}" 647 fi 648 done 649 echo 'ELF ldconfig path:' ${_LDC} 650 ${ldconfig} -elf ${_LDC} 651 ;; 652 esac 653 654 # Legacy aout support for i386 only 655 case `sysctl -n hw.machine_arch` in 656 i386) 657 # Default the a.out ldconfig path. 658 : ${ldconfig_paths_aout=${ldconfig_paths}} 659 _LDC=/usr/lib/aout 660 for i in ${ldconfig_paths_aout}; do 661 if [ -d "${i}" ]; then 662 _LDC="${_LDC} ${i}" 663 fi 664 done 665 echo 'a.out ldconfig path:' ${_LDC} 666 ${ldconfig} -aout ${_LDC} 667 ;; 668 esac 669fi 670 671# Now start up miscellaneous daemons that don't belong anywhere else 672# 673echo -n 'Starting standard daemons:' 674case ${inetd_enable} in 675[Nn][Oo]) 676 ;; 677*) 678 echo -n ' inetd'; ${inetd_program:-/usr/sbin/inetd} ${inetd_flags} 679 ;; 680esac 681 682case ${cron_enable} in 683[Nn][Oo]) 684 ;; 685*) 686 echo -n ' cron'; ${cron_program:-/usr/sbin/cron} ${cron_flags} 687 ;; 688esac 689 690case ${lpd_enable} in 691[Yy][Ee][Ss]) 692 echo -n ' printer'; ${lpd_program:-/usr/sbin/lpd} ${lpd_flags} 693 ;; 694esac 695 696case ${sshd_enable} in 697[Yy][Ee][Ss]) 698 if [ -x ${sshd_program:-/usr/sbin/sshd} ]; then 699 echo -n ' sshd'; 700 ${sshd_program:-/usr/sbin/sshd} ${sshd_flags} 701 fi 702 ;; 703esac 704 705case ${usbd_enable} in 706[Yy][Ee][Ss]) 707 echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags} 708 ;; 709esac 710 711case ${mta_start_script} in 712/*) 713 if [ -r ${mta_start_script} ]; then 714 sh ${mta_start_script} 715 fi 716 ;; 717esac 718 719echo '.' 720 721# Recover vi editor files. 722find /var/tmp/vi.recover ! -type f -a ! -type d -delete 723vibackup=`echo /var/tmp/vi.recover/vi.*` 724if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then 725 echo -n 'Recovering vi editor sessions:' 726 for i in /var/tmp/vi.recover/vi.*; do 727 # Only test files that are readable. 728 if [ ! -r "${i}" ]; then 729 continue 730 fi 731 732 # Unmodified nvi editor backup files either have the 733 # execute bit set or are zero length. Delete them. 734 if [ -x "${i}" -o ! -s "${i}" ]; then 735 rm -f "${i}" 736 fi 737 done 738 739 # It is possible to get incomplete recovery files, if the editor 740 # crashes at the right time. 741 virecovery=`echo /var/tmp/vi.recover/recover.*` 742 if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then 743 for i in /var/tmp/vi.recover/recover.*; do 744 # Only test files that are readable. 745 if [ ! -r "${i}" ]; then 746 continue 747 fi 748 749 # Delete any recovery files that are zero length, 750 # corrupted, or that have no corresponding backup file. 751 # Else send mail to the user. 752 recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"` 753 if [ -n "${recfile}" -a -s "${recfile}" ]; then 754 sendmail -t < "${i}" 755 else 756 rm -f "${i}" 757 fi 758 done 759 fi 760 echo '.' 761fi 762 763# Make a bounds file for msgs(1) if there isn't one already 764# 765if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then 766 echo 0 > /var/msgs/bounds 767fi 768 769case ${update_motd} in 770[Nn][Oo] | '') 771 ;; 772*) 773 if T=`mktemp /tmp/_motd.XXXXXX`; then 774 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} 775 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} 776 cmp -s ${T} /etc/motd || { 777 cp ${T} /etc/motd 778 chmod 644 /etc/motd 779 } 780 rm -f ${T} 781 fi 782 ;; 783esac 784 785# Run rc.devfs if readable to customize devfs 786# 787if [ -r /etc/rc.devfs ]; then 788 sh /etc/rc.devfs 789fi 790 791# Configure implementation specific stuff 792# 793arch=`uname -p` 794if [ -r /etc/rc.${arch} ]; then 795 . /etc/rc.${arch} 796fi 797 798# Configure the system console 799# 800if [ -r /etc/rc.syscons ]; then 801 . /etc/rc.syscons 802fi 803 804echo -n 'Additional ABI support:' 805 806# Load the SysV IPC API if requested. 807case ${sysvipc_enable} in 808[Yy][Ee][Ss]) 809 echo -n ' sysvipc' 810 kldload sysvmsg >/dev/null 2>&1 811 kldload sysvsem >/dev/null 2>&1 812 kldload sysvshm >/dev/null 2>&1 813 ;; 814esac 815 816# Start the Linux binary compatibility if requested. 817# 818case ${linux_enable} in 819[Yy][Ee][Ss]) 820 echo -n ' linux' 821 if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then 822 kldload linux > /dev/null 2>&1 823 fi 824 if [ -x /compat/linux/sbin/ldconfig ]; then 825 /compat/linux/sbin/ldconfig 826 fi 827 ;; 828esac 829 830# Start the SysVR4 binary emulation if requested. 831# 832case ${svr4_enable} in 833[Yy][Ee][Ss]) 834 echo -n ' svr4'; kldload svr4 > /dev/null 2>&1 835 ;; 836esac 837 838echo '.' 839 840# Do traditional (but rather obsolete) rc.local file if it exists. If you 841# use this file and want to make it programmatic, source /etc/defaults/rc.conf 842# in /etc/rc.local and add your custom variables to /etc/rc.conf, as 843# shown below. Please do not put local extensions into /etc/rc itself. 844# Use /etc/rc.local 845# 846# ---- rc.local ---- 847# if [ -r /etc/defaults/rc.conf ]; then 848# . /etc/defaults/rc.conf 849# source_rc_confs 850# elif [ -r /etc/rc.conf ]; then 851# . /etc/rc.conf 852# fi 853# 854# ... additional startup conditionals ... 855# ---- rc.local ---- 856# 857if [ -r /etc/rc.local ]; then 858 echo -n 'Starting local daemons:' 859 sh /etc/rc.local 860 echo '.' 861fi 862 863# For each valid dir in $local_startup, search for init scripts matching *.sh 864# 865case ${local_startup} in 866[Nn][Oo] | '') 867 ;; 868*) 869 echo -n 'Local package initialization:' 870 slist="" 871 if [ -z "${script_name_sep}" ]; then 872 script_name_sep=" " 873 fi 874 for dir in ${local_startup}; do 875 if [ -d "${dir}" ]; then 876 for script in ${dir}/*.sh; do 877 slist="${slist}${script_name_sep}${script}" 878 done 879 fi 880 done 881 script_save_sep="$IFS" 882 IFS="${script_name_sep}" 883 for script in ${slist}; do 884 if [ -x "${script}" ]; then 885 (set -T 886 trap 'exit 1' 2 887 ${script} start) 888 elif [ -f "${script}" -o -L "${script}" ]; then 889 echo -n " (skipping ${script##*/}, not executable)" 890 fi 891 done 892 IFS="${script_save_sep}" 893 echo '.' 894 ;; 895esac 896 897if [ -n "${network_pass3_done}" ]; then 898 network_pass4 899fi 900 901# Late pass to set variables we missed the first time 902# 903if [ -r /etc/rc.sysctl ]; then 904 sh /etc/rc.sysctl last 905fi 906 907# Raise kernel security level. This should be done only after `fsck' has 908# repaired local filesystems if you want the securelevel to be greater than 1. 909# 910case ${kern_securelevel_enable} in 911[Yy][Ee][Ss]) 912 if [ "${kern_securelevel}" -ge 0 ]; then 913 echo 'Raising kernel security level: ' 914 sysctl kern.securelevel=${kern_securelevel} 915 fi 916 ;; 917esac 918 919# Start background fsck checks if necessary 920case ${background_fsck} in 921[Yy][Ee][Ss]) 922 echo 'Starting background filesystem checks' 923 nice -4 fsck -B -p 2>&1 | logger -p daemon.notice & 924 ;; 925esac 926 927echo '' 928 929date 930 931exit 0 932 933