rc revision 90808
1265625Smarcel#!/bin/sh 2265625Smarcel# 3265625Smarcel# Copyright (c) 2000 The FreeBSD Project 4265625Smarcel# All rights reserved. 5265625Smarcel# 6265625Smarcel# Redistribution and use in source and binary forms, with or without 7265625Smarcel# modification, are permitted provided that the following conditions 8265625Smarcel# are met: 9265625Smarcel# 1. Redistributions of source code must retain the above copyright 10265625Smarcel# notice, this list of conditions and the following disclaimer. 11265625Smarcel# 2. Redistributions in binary form must reproduce the above copyright 12265625Smarcel# notice, this list of conditions and the following disclaimer in the 13265625Smarcel# documentation and/or other materials provided with the distribution. 14265625Smarcel# 15265625Smarcel# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16265625Smarcel# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17265625Smarcel# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18265625Smarcel# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19265625Smarcel# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20265625Smarcel# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21265625Smarcel# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22265625Smarcel# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23265625Smarcel# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24265625Smarcel# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25265625Smarcel# SUCH DAMAGE. 26265625Smarcel# 27265625Smarcel# @(#)rc 5.27 (Berkeley) 6/5/91 28265625Smarcel# $FreeBSD: head/etc/rc 90808 2002-02-17 22:19:14Z gshapiro $ 29265625Smarcel# 30265625Smarcel 31265625Smarcel# System startup script run by init on autoboot 32265625Smarcel# or after single-user. 33265625Smarcel# Output and error are redirected to console by init, 34265625Smarcel# and the console is the controlling terminal. 35265625Smarcel 36265625Smarcel# Note that almost all of the user-configurable behavior is no longer in 37266039Smarcel# this file, but rather in /etc/defaults/rc.conf. Please check that file 38265625Smarcel# first before contemplating any changes here. If you do need to change 39265625Smarcel# this file for some reason, we would like to know about it. 40265625Smarcel 41265625Smarcelstty status '^T' 42266039Smarcel 43266039Smarcel# Set shell to ignore SIGINT (2), but not children; 44266039Smarcel# shell catches SIGQUIT (3) and returns to single user after fsck. 45266039Smarcel# 46266039Smarceltrap : 2 47266039Smarceltrap : 3 # shouldn't be needed 48266039Smarcel 49265718Smarcelbootmode=$1 50265625Smarcel 51265625SmarcelHOME=/ 52265718SmarcelPATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin 53265625Smarcelexport HOME PATH 54265625Smarcel 55265625Smarcel# BOOTP diskless boot. We have to run the rc file early in order to 56265625Smarcel# retarget various config files. 57265625Smarcel# 58266039Smarcelif [ -r /etc/rc.diskless1 ]; then 59265625Smarcel dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null` 60265625Smarcel if [ ${dlv:=0} != 0 ]; then 61265625Smarcel . /etc/rc.diskless1 62265625Smarcel 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 esac 556 557 if [ -e "${dumpdev}" -a -d "${dumpdir}" ]; then 558 /sbin/dumpon -v ${dumpdev} 559 echo -n 'Checking for core dump: ' 560 /sbin/savecore ${savecore_flags} "${dumpdir}" 561 fi 562 ;; 563esac 564 565if [ -n "${network_pass1_done}" ]; then 566 network_pass2 567fi 568 569# Enable/Check the quotas (must be after ypbind if using NIS) 570# 571case ${enable_quotas} in 572[Yy][Ee][Ss]) 573 case ${check_quotas} in 574 [Yy][Ee][Ss]) 575 echo -n 'Checking quotas:' 576 quotacheck -a 577 echo ' done.' 578 ;; 579 esac 580 581 echo -n 'Enabling quotas:' 582 quotaon -a 583 echo ' done.' 584 ;; 585esac 586 587if [ -n "${network_pass2_done}" ]; then 588 network_pass3 589fi 590 591# Check the password temp/lock file 592# 593if [ -e /etc/ptmp ]; then 594 logger -s -p auth.err \ 595 "password file may be incorrect -- /etc/ptmp exists" 596fi 597 598case ${accounting_enable} in 599[Yy][Ee][Ss]) 600 if [ -d /var/account ]; then 601 echo 'Turning on accounting:' 602 if [ ! -e /var/account/acct ]; then 603 touch /var/account/acct 604 fi 605 accton /var/account/acct 606 fi 607 ;; 608esac 609 610# Make shared lib searching a little faster. Leave /usr/lib first if you 611# add your own entries or you may come to grief. 612# 613ldconfig="/sbin/ldconfig" 614case ${ldconfig_insecure} in 615[Yy][Ee][Ss]) 616 ldconfig="${ldconfig} -i" 617 ;; 618esac 619if [ -x /sbin/ldconfig ]; then 620 case `/usr/bin/objformat` in 621 elf) 622 _LDC=/usr/lib 623 for i in ${ldconfig_paths}; do 624 if [ -d "${i}" ]; then 625 _LDC="${_LDC} ${i}" 626 fi 627 done 628 echo 'ELF ldconfig path:' ${_LDC} 629 ${ldconfig} -elf ${_LDC} 630 ;; 631 esac 632 633 # Legacy aout support for i386 only 634 case `sysctl -n hw.machine_arch` in 635 i386) 636 # Default the a.out ldconfig path. 637 : ${ldconfig_paths_aout=${ldconfig_paths}} 638 _LDC=/usr/lib/aout 639 for i in ${ldconfig_paths_aout}; do 640 if [ -d "${i}" ]; then 641 _LDC="${_LDC} ${i}" 642 fi 643 done 644 echo 'a.out ldconfig path:' ${_LDC} 645 ${ldconfig} -aout ${_LDC} 646 ;; 647 esac 648fi 649 650# Now start up miscellaneous daemons that don't belong anywhere else 651# 652echo -n 'Starting standard daemons:' 653case ${inetd_enable} in 654[Nn][Oo]) 655 ;; 656*) 657 echo -n ' inetd'; ${inetd_program:-/usr/sbin/inetd} ${inetd_flags} 658 ;; 659esac 660 661case ${cron_enable} in 662[Nn][Oo]) 663 ;; 664*) 665 echo -n ' cron'; ${cron_program:-/usr/sbin/cron} ${cron_flags} 666 ;; 667esac 668 669case ${lpd_enable} in 670[Yy][Ee][Ss]) 671 echo -n ' printer'; ${lpd_program:-/usr/sbin/lpd} ${lpd_flags} 672 ;; 673esac 674 675case ${sshd_enable} in 676[Yy][Ee][Ss]) 677 if [ -x ${sshd_program:-/usr/sbin/sshd} ]; then 678 echo -n ' sshd'; 679 ${sshd_program:-/usr/sbin/sshd} ${sshd_flags} 680 fi 681 ;; 682esac 683 684case ${usbd_enable} in 685[Yy][Ee][Ss]) 686 echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags} 687 ;; 688esac 689 690case ${sendmail_enable} in 691[Yy][Ee][Ss]) 692 echo -n ' sendmail' 693 /usr/sbin/sendmail ${sendmail_flags} 694 ;; 695*) 696 case ${sendmail_outbound_enable} in 697 [Yy][Ee][Ss]) 698 echo -n ' sendmail-outbound' 699 /usr/sbin/sendmail ${sendmail_outbound_flags} 700 ;; 701 esac 702 case ${sendmail_submit_enable} in 703 [Yy][Ee][Ss]) 704 echo -n ' sendmail-submit' 705 /usr/sbin/sendmail ${sendmail_submit_flags} 706 ;; 707 esac 708 ;; 709esac 710 711if [ -r /etc/mail/submit.cf ]; then 712 case ${sendmail_msp_queue_enable} in 713 [Yy][Ee][Ss]) 714 echo -n ' sendmail-clientmqueue' 715 /usr/sbin/sendmail ${sendmail_msp_queue_flags} 716 ;; 717 esac 718fi 719 720echo '.' 721 722# Recover vi editor files. 723find /var/tmp/vi.recover ! -type f -a ! -type d -delete 724vibackup=`echo /var/tmp/vi.recover/vi.*` 725if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then 726 echo -n 'Recovering vi editor sessions:' 727 for i in /var/tmp/vi.recover/vi.*; do 728 # Only test files that are readable. 729 if [ ! -r "${i}" ]; then 730 continue 731 fi 732 733 # Unmodified nvi editor backup files either have the 734 # execute bit set or are zero length. Delete them. 735 if [ -x "${i}" -o ! -s "${i}" ]; then 736 rm -f "${i}" 737 fi 738 done 739 740 # It is possible to get incomplete recovery files, if the editor 741 # crashes at the right time. 742 virecovery=`echo /var/tmp/vi.recover/recover.*` 743 if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then 744 for i in /var/tmp/vi.recover/recover.*; do 745 # Only test files that are readable. 746 if [ ! -r "${i}" ]; then 747 continue 748 fi 749 750 # Delete any recovery files that are zero length, 751 # corrupted, or that have no corresponding backup file. 752 # Else send mail to the user. 753 recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"` 754 if [ -n "${recfile}" -a -s "${recfile}" ]; then 755 sendmail -t < "${i}" 756 else 757 rm -f "${i}" 758 fi 759 done 760 fi 761 echo '.' 762fi 763 764# Make a bounds file for msgs(1) if there isn't one already 765# 766if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then 767 echo 0 > /var/msgs/bounds 768fi 769 770case ${update_motd} in 771[Nn][Oo] | '') 772 ;; 773*) 774 if T=`mktemp /tmp/_motd.XXXXXX`; then 775 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T} 776 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T} 777 cmp -s ${T} /etc/motd || { 778 cp ${T} /etc/motd 779 chmod 644 /etc/motd 780 } 781 rm -f ${T} 782 fi 783 ;; 784esac 785 786# Run rc.devfs if readable to customize devfs 787# 788if [ -r /etc/rc.devfs ]; then 789 sh /etc/rc.devfs 790fi 791 792# Configure implementation specific stuff 793# 794arch=`uname -p` 795if [ -r /etc/rc.${arch} ]; then 796 . /etc/rc.${arch} 797fi 798 799# Configure the system console 800# 801if [ -r /etc/rc.syscons ]; then 802 . /etc/rc.syscons 803fi 804 805echo -n 'Additional ABI support:' 806 807# Load the SysV IPC API if requested. 808case ${sysvipc_enable} in 809[Yy][Ee][Ss]) 810 echo -n ' sysvipc' 811 kldload sysvmsg >/dev/null 2>&1 812 kldload sysvsem >/dev/null 2>&1 813 kldload sysvshm >/dev/null 2>&1 814 ;; 815esac 816 817# Start the Linux binary compatibility if requested. 818# 819case ${linux_enable} in 820[Yy][Ee][Ss]) 821 echo -n ' linux' 822 if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then 823 kldload linux > /dev/null 2>&1 824 fi 825 if [ -x /compat/linux/sbin/ldconfig ]; then 826 /compat/linux/sbin/ldconfig 827 fi 828 ;; 829esac 830 831# Start the SysVR4 binary emulation if requested. 832# 833case ${svr4_enable} in 834[Yy][Ee][Ss]) 835 echo -n ' svr4'; kldload svr4 > /dev/null 2>&1 836 ;; 837esac 838 839echo '.' 840 841# Do traditional (but rather obsolete) rc.local file if it exists. If you 842# use this file and want to make it programmatic, source /etc/defaults/rc.conf 843# in /etc/rc.local and add your custom variables to /etc/rc.conf, as 844# shown below. Please do not put local extensions into /etc/rc itself. 845# Use /etc/rc.local 846# 847# ---- rc.local ---- 848# if [ -r /etc/defaults/rc.conf ]; then 849# . /etc/defaults/rc.conf 850# source_rc_confs 851# elif [ -r /etc/rc.conf ]; then 852# . /etc/rc.conf 853# fi 854# 855# ... additional startup conditionals ... 856# ---- rc.local ---- 857# 858if [ -r /etc/rc.local ]; then 859 echo -n 'Starting local daemons:' 860 sh /etc/rc.local 861 echo '.' 862fi 863 864# For each valid dir in $local_startup, search for init scripts matching *.sh 865# 866case ${local_startup} in 867[Nn][Oo] | '') 868 ;; 869*) 870 echo -n 'Local package initialization:' 871 slist="" 872 if [ -z "${script_name_sep}" ]; then 873 script_name_sep=" " 874 fi 875 for dir in ${local_startup}; do 876 if [ -d "${dir}" ]; then 877 for script in ${dir}/*.sh; do 878 slist="${slist}${script_name_sep}${script}" 879 done 880 fi 881 done 882 script_save_sep="$IFS" 883 IFS="${script_name_sep}" 884 for script in ${slist}; do 885 if [ -x "${script}" ]; then 886 (set -T 887 trap 'exit 1' 2 888 ${script} start) 889 elif [ -f "${script}" -o -L "${script}" ]; then 890 echo -n " (skipping ${script##*/}, not executable)" 891 fi 892 done 893 IFS="${script_save_sep}" 894 echo '.' 895 ;; 896esac 897 898if [ -n "${network_pass3_done}" ]; then 899 network_pass4 900fi 901 902# Raise kernel security level. This should be done only after `fsck' has 903# repaired local file systems if you want the securelevel to be greater than 1. 904# 905case ${kern_securelevel_enable} in 906[Yy][Ee][Ss]) 907 if [ "${kern_securelevel}" -ge 0 ]; then 908 echo 'Raising kernel security level: ' 909 sysctl kern.securelevel=${kern_securelevel} 910 fi 911 ;; 912esac 913 914# Start background fsck checks if necessary 915case ${background_fsck} in 916[Yy][Ee][Ss]) 917 echo 'Starting background filesystem checks' 918 nice -4 fsck -B -p 2>&1 | logger -p daemon.notice & 919 ;; 920esac 921 922echo '' 923 924date 925 926exit 0 927 928