rc revision 92187
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 92187 2002-03-12 20:59:35Z cjc $ 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 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 -efauxww; sysctl -a; date; df -ib; dmesg; ps -efauxww; ) \ 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 file system check failed . . . help!' 234 exit 1 235 ;; 236 esac 237 ;; 238 *) 239 echo 'Automatic file system 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# Reseed /dev/random with previously stored entropy. 318case ${entropy_dir} in 319[Nn][Oo]) 320 ;; 321*) 322 entropy_dir=${entropy_dir:-/var/db/entropy} 323 if [ -d "${entropy_dir}" ]; then 324 if [ -w /dev/random ]; then 325 for seedfile in ${entropy_dir}/*; do 326 feed_dev_random "${seedfile}" 327 done 328 fi 329 fi 330 ;; 331esac 332 333case ${entropy_file} in 334[Nn][Oo] | '') 335 ;; 336*) 337 if [ -w /dev/random ]; then 338 feed_dev_random "${entropy_file}" 339 fi 340 ;; 341esac 342 343adjkerntz -i 344 345purgedir() { 346 local dir file 347 348 if [ $# -eq 0 ]; then 349 purgedir . 350 else 351 for dir 352 do 353 ( 354 cd "$dir" && for file in .* * 355 do 356 [ ."$file" = .. -o ."$file" = ... ] && continue 357 if [ -d "$file" -a ! -L "$file" ] 358 then 359 purgedir "$file" 360 else 361 rm -f -- "$file" 362 fi 363 done 364 ) 365 done 366 fi 367} 368 369clean_var() { 370 if [ -d /var/run -a ! -f /var/run/clean_var ]; then 371 purgedir /var/run 372 # Keep a copy of the boot messages around 373 dmesg >/var/run/dmesg.boot 374 # And an initial utmp file 375 (cd /var/run && cp /dev/null utmp && chmod 644 utmp;) 376 >/var/run/clean_var 377 fi 378 if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then 379 purgedir /var/spool/lock 380 >/var/spool/lock/clean_var 381 fi 382 rm -rf /var/spool/uucp/.Temp/* 383} 384 385# network_pass1() *may* end up writing stuff to /var - we don't want to 386# remove it immediately afterwards - *nor* do we want to fail to clean 387# an NFS-mounted /var. 388rm -f /var/run/clean_var /var/spool/lock/clean_var 389clean_var 390 391# Add additional swapfile, if configured. 392# 393case ${swapfile} in 394[Nn][Oo] | '') 395 ;; 396*) 397 if [ -w "${swapfile}" -a -c /dev/mdctl ]; then 398 echo "Adding ${swapfile} as additional swap" 399 mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev} 400 fi 401 ;; 402esac 403 404# Set sysctl variables as early as we can 405# 406if [ -r /etc/rc.sysctl ]; then 407 . /etc/rc.sysctl 408fi 409 410# Configure serial devices 411# 412if [ -r /etc/rc.serial ]; then 413 . /etc/rc.serial 414fi 415 416# Start up PC-card configuration 417# 418if [ -r /etc/rc.pccard ]; then 419 . /etc/rc.pccard 420fi 421 422# Start up the initial network configuration. 423# 424if [ -r /etc/rc.network ]; then 425 . /etc/rc.network # We only need to do this once. 426 network_pass1 427fi 428 429case ${ipv6_enable} in 430[Yy][Ee][Ss]) 431 if [ -r /etc/rc.network6 ]; then 432 . /etc/rc.network6 # We only need to do this once also. 433 network6_pass1 434 fi 435 ;; 436esac 437 438# Mount NFS filesystems if present in /etc/fstab 439# 440# XXX When the vfsload() issues with nfsclient support and related sysctls 441# have been resolved, this block can be removed, and the condition that 442# skips nfs in the following block (for "other network filesystems") can 443# be removed. 444case "`mount -d -a -t nfs 2> /dev/null`" in 445*mount_nfs*) 446 # Handle absent nfs client support 447 nfsclient_in_kernel=0 448 if sysctl vfs.nfs >/dev/null 2>&1; then 449 nfsclient_in_kernel=1 450 else 451 kldload nfsclient && nfsclient_in_kernel=1 452 fi 453 454 case ${nfsclient_in_kernel} in 455 1) 456 echo -n 'Mounting NFS file systems:' 457 mount -a -t nfs 458 echo '.' 459 ;; 460 *) 461 echo 'Warning: nfs mount requested, but no nfs client in kernel' 462 ;; 463 esac 464 ;; 465esac 466 467# Mount other network filesystems if present in /etc/fstab 468for i in ${networkfs_types}; do 469 fstype=${i%:*} 470 fsdecr=${i#*:} 471 472 if [ "${fstype}" = "nfs" ]; then 473 continue 474 fi 475 case "`mount -d -a -t ${fstype}`" in 476 *mount_${fstype}*) 477 echo -n "Mounting ${fsdecr} file systems:" 478 mount -a -t ${fstype} 479 echo '.' 480 ;; 481 esac 482done 483 484# Whack the pty perms back into shape. 485# 486if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then 487 chflags 0 /dev/tty[pqrsPQRS]* 488 chmod 666 /dev/tty[pqrsPQRS]* 489 chown root:wheel /dev/tty[pqrsPQRS]* 490fi 491 492# Clean up left-over files 493# 494clean_var # If it hasn't already been done 495rm /var/run/clean_var /var/spool/lock/clean_var 496 497# Clearing /tmp at boot-time seems to have a long tradition. It doesn't 498# help in any way for long-living systems, and it might accidentally 499# clobber files you would rather like to have preserved after a crash 500# (if not using mfs /tmp anyway). 501# 502# See also the example of another cleanup policy in /etc/periodic/daily. 503# 504case ${clear_tmp_enable} in 505[Yy][Ee][Ss]) 506 echo -n 'Clearing /tmp:' 507 # prune quickly with one rm, then use find to clean up /tmp/[lq]* 508 # (not needed with mfs /tmp, but doesn't hurt there...) 509 (cd /tmp && rm -rf [a-km-pr-zA-Z]* && 510 find -d . ! -name . ! -name lost+found ! -name quota.user \ 511 ! -name quota.group -exec rm -rf -- {} \;) 512 echo '.' 513 ;; 514esac 515 516# Remove X lock files, since they will prevent you from restarting X11 517# after a system crash. 518# 519rm -f /tmp/.X*-lock /tmp/.X11-unix/* 520 521# Snapshot any kernel -c changes back to disk here <someday>. 522# This has changed with ELF and /kernel.config. 523 524echo -n 'Additional daemons:' 525 526# Start system logging and name service. Named needs to start before syslogd 527# if you don't have a /etc/resolv.conf. 528# 529case ${syslogd_enable} in 530[Yy][Ee][Ss]) 531 # Transitional symlink (for the next couple of years :) until all 532 # binaries have had a chance to move towards /var/run/log. 533 if [ ! -L /dev/log ]; then 534 # might complain for r/o root f/s 535 ln -sf /var/run/log /dev/log 536 fi 537 538 rm -f /var/run/log 539 echo -n ' syslogd'; 540 ${syslogd_program:-/usr/sbin/syslogd} ${syslogd_flags} 541 ;; 542esac 543 544echo '.' 545 546# Build device name databases if we are not using DEVFS 547# 548if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then 549 rm -f /var/run/dev.db 550else 551 dev_mkdb 552fi 553 554# $dumpdir should be a directory or a symbolic link 555# to the crash directory if core dumps are to be saved. 556# 557if [ "${dumpdev}" != 'NO' ]; then 558 case ${dumpdir} in 559 '') 560 dumpdir='/var/crash' 561 ;; 562 [Nn][Oo]) 563 dumpdir='NO' 564 ;; 565 esac 566 567 if [ "${dumpdir}" != 'NO' ]; then 568 echo -n 'Checking for core dump: ' 569 /sbin/savecore ${savecore_flags} "${dumpdir}" 570 fi 571fi 572 573if [ -n "${network_pass1_done}" ]; then 574 network_pass2 575fi 576 577# Enable/Check the quotas (must be after ypbind if using NIS) 578# 579case ${enable_quotas} in 580[Yy][Ee][Ss]) 581 case ${check_quotas} in 582 [Yy][Ee][Ss]) 583 echo -n 'Checking quotas:' 584 quotacheck -a 585 echo ' done.' 586 ;; 587 esac 588 589 echo -n 'Enabling quotas:' 590 quotaon -a 591 echo ' done.' 592 ;; 593esac 594 595if [ -n "${network_pass2_done}" ]; then 596 network_pass3 597fi 598 599# Check the password temp/lock file 600# 601if [ -e /etc/ptmp ]; then 602 logger -s -p auth.err \ 603 "password file may be incorrect -- /etc/ptmp exists" 604fi 605 606case ${accounting_enable} in 607[Yy][Ee][Ss]) 608 if [ -d /var/account ]; then 609 echo 'Turning on accounting:' 610 if [ ! -e /var/account/acct ]; then 611 touch /var/account/acct 612 fi 613 accton /var/account/acct 614 fi 615 ;; 616esac 617 618# Make shared lib searching a little faster. Leave /usr/lib first if you 619# add your own entries or you may come to grief. 620# 621ldconfig="/sbin/ldconfig" 622case ${ldconfig_insecure} in 623[Yy][Ee][Ss]) 624 ldconfig="${ldconfig} -i" 625 ;; 626esac 627if [ -x /sbin/ldconfig ]; then 628 case `/usr/bin/objformat` in 629 elf) 630 _LDC=/usr/lib 631 for i in ${ldconfig_paths}; do 632 if [ -d "${i}" ]; then 633 _LDC="${_LDC} ${i}" 634 fi 635 done 636 echo 'ELF ldconfig path:' ${_LDC} 637 ${ldconfig} -elf ${_LDC} 638 ;; 639 esac 640 641 # Legacy aout support for i386 only 642 case `sysctl -n hw.machine_arch` in 643 i386) 644 # Default the a.out ldconfig path. 645 : ${ldconfig_paths_aout=${ldconfig_paths}} 646 _LDC=/usr/lib/aout 647 for i in ${ldconfig_paths_aout}; do 648 if [ -d "${i}" ]; then 649 _LDC="${_LDC} ${i}" 650 fi 651 done 652 echo 'a.out ldconfig path:' ${_LDC} 653 ${ldconfig} -aout ${_LDC} 654 ;; 655 esac 656fi 657 658# Now start up miscellaneous daemons that don't belong anywhere else 659# 660echo -n 'Starting standard daemons:' 661case ${inetd_enable} in 662[Nn][Oo]) 663 ;; 664*) 665 echo -n ' inetd'; ${inetd_program:-/usr/sbin/inetd} ${inetd_flags} 666 ;; 667esac 668 669case ${cron_enable} in 670[Nn][Oo]) 671 ;; 672*) 673 echo -n ' cron'; ${cron_program:-/usr/sbin/cron} ${cron_flags} 674 ;; 675esac 676 677case ${lpd_enable} in 678[Yy][Ee][Ss]) 679 echo -n ' printer'; ${lpd_program:-/usr/sbin/lpd} ${lpd_flags} 680 ;; 681esac 682 683case ${sshd_enable} in 684[Yy][Ee][Ss]) 685 if [ -x ${sshd_program:-/usr/sbin/sshd} ]; then 686 echo -n ' sshd'; 687 ${sshd_program:-/usr/sbin/sshd} ${sshd_flags} 688 fi 689 ;; 690esac 691 692case ${usbd_enable} in 693[Yy][Ee][Ss]) 694 echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags} 695 ;; 696esac 697 698case ${sendmail_enable} in 699[Yy][Ee][Ss]) 700 echo -n ' sendmail' 701 /usr/sbin/sendmail ${sendmail_flags} 702 ;; 703*) 704 case ${sendmail_outbound_enable} in 705 [Yy][Ee][Ss]) 706 echo -n ' sendmail-outbound' 707 /usr/sbin/sendmail ${sendmail_outbound_flags} 708 ;; 709 esac 710 case ${sendmail_submit_enable} in 711 [Yy][Ee][Ss]) 712 echo -n ' sendmail-submit' 713 /usr/sbin/sendmail ${sendmail_submit_flags} 714 ;; 715 esac 716 ;; 717esac 718 719if [ -r /etc/mail/submit.cf ]; then 720 case ${sendmail_msp_queue_enable} in 721 [Yy][Ee][Ss]) 722 echo -n ' sendmail-clientmqueue' 723 /usr/sbin/sendmail ${sendmail_msp_queue_flags} 724 ;; 725 esac 726fi 727 728echo '.' 729 730# Recover vi editor files. 731find /var/tmp/vi.recover ! -type f -a ! -type d -delete 732vibackup=`echo /var/tmp/vi.recover/vi.*` 733if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then 734 echo -n 'Recovering vi editor sessions:' 735 for i in /var/tmp/vi.recover/vi.*; do 736 # Only test files that are readable. 737 if [ ! -r "${i}" ]; then 738 continue 739 fi 740 741 # Unmodified nvi editor backup files either have the 742 # execute bit set or are zero length. Delete them. 743 if [ -x "${i}" -o ! -s "${i}" ]; then 744 rm -f "${i}" 745 fi 746 done 747 748 # It is possible to get incomplete recovery files, if the editor 749 # crashes at the right time. 750 virecovery=`echo /var/tmp/vi.recover/recover.*` 751 if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then 752 for i in /var/tmp/vi.recover/recover.*; do 753 # Only test files that are readable. 754 if [ ! -r "${i}" ]; then 755 continue 756 fi 757 758 # Delete any recovery files that are zero length, 759 # corrupted, or that have no corresponding backup file. 760 # Else send mail to the user. 761 recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"` 762 if [ -n "${recfile}" -a -s "${recfile}" ]; then 763 sendmail -t < "${i}" 764 else 765 rm -f "${i}" 766 fi 767 done 768 fi 769 echo '.' 770fi 771 772# Make a bounds file for msgs(1) if there isn't one already 773# 774if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then 775 echo 0 > /var/msgs/bounds 776fi 777 778case ${update_motd} in 779[Nn][Oo] | '') 780 ;; 781*) 782 if T=`mktemp /tmp/_motd.XXXXXX`; then 783 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} 784 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} 785 cmp -s ${T} /etc/motd || { 786 cp ${T} /etc/motd 787 chmod 644 /etc/motd 788 } 789 rm -f ${T} 790 fi 791 ;; 792esac 793 794# Run rc.devfs if readable to customize devfs 795# 796if [ -r /etc/rc.devfs ]; then 797 sh /etc/rc.devfs 798fi 799 800# Configure implementation specific stuff 801# 802arch=`uname -p` 803if [ -r /etc/rc.${arch} ]; then 804 . /etc/rc.${arch} 805fi 806 807# Configure the system console 808# 809if [ -r /etc/rc.syscons ]; then 810 . /etc/rc.syscons 811fi 812 813echo -n 'Additional ABI support:' 814 815# Load the SysV IPC API if requested. 816case ${sysvipc_enable} in 817[Yy][Ee][Ss]) 818 echo -n ' sysvipc' 819 kldload sysvmsg >/dev/null 2>&1 820 kldload sysvsem >/dev/null 2>&1 821 kldload sysvshm >/dev/null 2>&1 822 ;; 823esac 824 825# Start the Linux binary compatibility if requested. 826# 827case ${linux_enable} in 828[Yy][Ee][Ss]) 829 echo -n ' linux' 830 if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then 831 kldload linux > /dev/null 2>&1 832 fi 833 if [ -x /compat/linux/sbin/ldconfig ]; then 834 /compat/linux/sbin/ldconfig 835 fi 836 ;; 837esac 838 839# Start the SysVR4 binary emulation if requested. 840# 841case ${svr4_enable} in 842[Yy][Ee][Ss]) 843 echo -n ' svr4'; kldload svr4 > /dev/null 2>&1 844 ;; 845esac 846 847echo '.' 848 849# Do traditional (but rather obsolete) rc.local file if it exists. If you 850# use this file and want to make it programmatic, source /etc/defaults/rc.conf 851# in /etc/rc.local and add your custom variables to /etc/rc.conf, as 852# shown below. Please do not put local extensions into /etc/rc itself. 853# Use /etc/rc.local 854# 855# ---- rc.local ---- 856# if [ -r /etc/defaults/rc.conf ]; then 857# . /etc/defaults/rc.conf 858# source_rc_confs 859# elif [ -r /etc/rc.conf ]; then 860# . /etc/rc.conf 861# fi 862# 863# ... additional startup conditionals ... 864# ---- rc.local ---- 865# 866if [ -r /etc/rc.local ]; then 867 echo -n 'Starting local daemons:' 868 sh /etc/rc.local 869 echo '.' 870fi 871 872# For each valid dir in $local_startup, search for init scripts matching *.sh 873# 874case ${local_startup} in 875[Nn][Oo] | '') 876 ;; 877*) 878 echo -n 'Local package initialization:' 879 slist="" 880 if [ -z "${script_name_sep}" ]; then 881 script_name_sep=" " 882 fi 883 for dir in ${local_startup}; do 884 if [ -d "${dir}" ]; then 885 for script in ${dir}/*.sh; do 886 slist="${slist}${script_name_sep}${script}" 887 done 888 fi 889 done 890 script_save_sep="$IFS" 891 IFS="${script_name_sep}" 892 for script in ${slist}; do 893 if [ -x "${script}" ]; then 894 (set -T 895 trap 'exit 1' 2 896 ${script} start) 897 elif [ -f "${script}" -o -L "${script}" ]; then 898 echo -n " (skipping ${script##*/}, not executable)" 899 fi 900 done 901 IFS="${script_save_sep}" 902 echo '.' 903 ;; 904esac 905 906if [ -n "${network_pass3_done}" ]; then 907 network_pass4 908fi 909 910# Raise kernel security level. This should be done only after `fsck' has 911# repaired local file systems if you want the securelevel to be greater than 1. 912# 913case ${kern_securelevel_enable} in 914[Yy][Ee][Ss]) 915 if [ "${kern_securelevel}" -ge 0 ]; then 916 echo 'Raising kernel security level: ' 917 sysctl kern.securelevel=${kern_securelevel} 918 fi 919 ;; 920esac 921 922# Start background fsck checks if necessary 923case ${background_fsck} in 924[Yy][Ee][Ss]) 925 echo 'Starting background filesystem checks' 926 nice -4 fsck -B -p 2>&1 | logger -p daemon.notice & 927 ;; 928esac 929 930echo '' 931 932date 933 934exit 0 935 936