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