rc revision 1.56
11.56Smrg# $NetBSD: rc,v 1.56 1996/03/22 00:44:59 mrg Exp $ 21.45Scgd# from: @(#)rc 8.2 (Berkeley) 3/17/94 31.1Scgd 41.1Scgd# System startup script run by init on autoboot 51.1Scgd# or after single-user. 61.1Scgd# Output and error are redirected to console by init, 71.1Scgd# and the console is the controlling terminal. 81.1Scgd 91.1Scgdstty status '^T' 101.1Scgd 111.1Scgd# Set shell to ignore SIGINT (2), but not children; 121.1Scgd# shell catches SIGQUIT (3) and returns to single user after fsck. 131.1Scgdtrap : 2 141.1Scgdtrap : 3 # shouldn't be needed 151.1Scgd 161.1ScgdHOME=/; export HOME 171.1ScgdPATH=/sbin:/bin:/usr/sbin:/usr/bin 181.1Scgdexport PATH 191.50Sthorpej 201.50Sthorpej# Configure ccd devices. 211.50Sthorpejif [ -f /etc/ccd.conf ] 221.50Sthorpejthen 231.50Sthorpej ccdconfig -C 241.50Sthorpejfi 251.1Scgd 261.17Smycroftif [ -e /fastboot ] 271.1Scgdthen 281.38Scgd echo "Fast boot: skipping disk checks." 291.1Scgdelif [ $1x = autobootx ] 301.1Scgdthen 311.38Scgd echo "Automatic boot in progress: starting file system checks." 321.1Scgd fsck -p 331.1Scgd case $? in 341.1Scgd 0) 351.1Scgd ;; 361.1Scgd 2) 371.1Scgd exit 1 381.1Scgd ;; 391.1Scgd 4) 401.35Scgd echo "Rebooting..." 411.1Scgd reboot 421.38Scgd echo "Reboot failed; help!" 431.1Scgd exit 1 441.1Scgd ;; 451.1Scgd 8) 461.38Scgd echo "Automatic file system check failed; help!" 471.1Scgd exit 1 481.1Scgd ;; 491.1Scgd 12) 501.38Scgd echo "Boot interrupted." 511.1Scgd exit 1 521.1Scgd ;; 531.1Scgd 130) 541.1Scgd # interrupt before catcher installed 551.1Scgd exit 1 561.1Scgd ;; 571.1Scgd *) 581.38Scgd echo "Unknown error; help!" 591.1Scgd exit 1 601.1Scgd ;; 611.1Scgd esac 621.1Scgdfi 631.1Scgd 641.38Scgdtrap "echo 'Boot interrupted.'; exit 1" 3 651.1Scgd 661.1Scgdswapon -a 671.1Scgd 681.1Scgdumount -a >/dev/null 2>&1 691.1Scgdmount -a -t nonfs 701.1Scgdrm -f /fastboot # XXX (root now writeable) 711.40Scgd 721.40Scgd# set flags on ttys. (do early, in case they use tty for SLIP in netstart) 731.40Scgdecho 'setting tty flags' 741.40Scgdttyflags -a 751.1Scgd 761.1Scgd# set hostname, turn on network 771.1Scgdecho 'starting network' 781.1Scgd. /etc/netstart 791.1Scgd 801.26Sderaadtmount /usr >/dev/null 2>&1 811.42Smycroftmount /var >/dev/null 2>&1 821.26Sderaadt 831.41Sjtc# clean up left-over files 841.41Sjtcrm -f /etc/nologin 851.41Sjtcrm -f /var/spool/lock/LCK.* 861.41Sjtcrm -f /var/spool/uucp/STST/* 871.45Scgd(cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; }) 881.41Sjtc 891.26Sderaadtecho -n 'starting rpc daemons:' 901.26Sderaadtecho -n ' portmap'; portmap 911.26Sderaadt 921.26Sderaadtif [ -f /usr/sbin/ypbind -a -d /var/yp ]; then 931.26Sderaadt echo -n ' ypbind'; ypbind 941.26Sderaadtfi 951.26Sderaadt 961.26Sderaadt# $nfs_server is imported from /etc/netstart; 971.26Sderaadt# if $nfs_server == YES, the machine is setup for being an nfs server 981.26Sderaadtif [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then 991.26Sderaadt rm -f /var/db/mountdtab 1001.48Smycroft echo -n > /var/db/mountdtab 1011.26Sderaadt echo -n ' mountd'; mountd 1021.44Smycroft echo -n ' nfsd'; nfsd -tun 4 1031.26Sderaadtfi 1041.26Sderaadt 1051.26Sderaadt# $nfs_client is imported from /etc/netstart; 1061.26Sderaadt# if $nfs_client == YES, the machine is setup for being an nfs client 1071.26Sderaadtif [ X${nfs_client} = X"YES" ]; then 1081.44Smycroft echo -n ' nfsiod'; nfsiod -n 4 1091.26Sderaadtfi 1101.26Sderaadt 1111.36Scgdif [ X${amd} = X"YES" -a -d ${amd_dir} -a -r ${amd_master} ]; then 1121.27Sderaadt echo -n ' amd' 1131.49Sbriggs amd -l syslog -x error,noinfo,nostats -p \ 1141.49Sbriggs -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid 1151.27Sderaadtfi 1161.27Sderaadt 1171.26Sderaadtecho '.' 1181.27Sderaadtmount -a -t nfs 1191.1Scgd 1201.1Scgdecho -n 'starting system logger' 1211.1Scgdrm -f /dev/log 1221.1Scgdsyslogd 1231.1Scgd 1241.19Scgd# $timed_flags is imported from /etc/netstart; 1251.19Scgd# if $timed_flags == NO, timed isn't run. 1261.21Scgdif [ "X${timed_flags}" != X"NO" ]; then 1271.19Scgd echo -n ', time daemon'; timed $timed_flags 1281.1Scgdfi 1291.1Scgdecho '.' 1301.1Scgd 1311.1Scgd# /var/crash should be a directory or a symbolic link 1321.1Scgd# to the crash directory if core dumps are to be saved. 1331.1Scgdif [ -d /var/crash ]; then 1341.1Scgd echo checking for core dump... 1351.1Scgd savecore /var/crash 1361.1Scgdfi 1371.1Scgd 1381.47Sderaadt echo -n 'checking quotas:' 1391.47Sderaadtquotacheck -a 1401.47Sderaadt echo ' done.' 1411.47Sderaadtquotaon -a 1421.1Scgd 1431.1Scgd# build ps databases 1441.2Scgdecho 'building databases...' 1451.11Scgdkvm_mkdb /netbsd 1461.1Scgddev_mkdb 1471.1Scgd 1481.1Scgdchmod 666 /dev/tty[pqrs]* 1491.1Scgd 1501.1Scgd# check the password temp/lock file 1511.1Scgdif [ -f /etc/ptmp ] 1521.1Scgdthen 1531.1Scgd logger -s -p auth.err \ 1541.1Scgd 'password file may be incorrect -- /etc/ptmp exists' 1551.1Scgdfi 1561.1Scgd 1571.32Smycroftvirecovery=/var/tmp/vi.recover/recover.* 1581.32Smycroftif [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then 1591.32Smycroft echo preserving editor files 1601.32Smycroft for i in $virecovery; do 1611.32Smycroft sendmail -t < $i 1621.32Smycroft done 1631.32Smycroftfi 1641.1Scgd 1651.1Scgdecho clearing /tmp 1661.1Scgd 1671.1Scgd# prune quickly with one rm, then use find to clean up /tmp/[lq]* 1681.1Scgd# (not needed with mfs /tmp, but doesn't hurt there...) 1691.1Scgd(cd /tmp && rm -rf [a-km-pr-zA-Z]* && 1701.46Sderaadt find . ! -name . ! -name lost+found ! -name quota.user \ 1711.46Sderaadt ! -name quota.group -exec rm -rf -- {} \; -type d -prune) 1721.1Scgd 1731.34Scgdif [ -f /var/account/acct ]; then 1741.34Scgd echo 'turning on accounting'; accton /var/account/acct 1751.34Scgdfi 1761.1Scgd 1771.1Scgdecho -n standard daemons: 1781.1Scgdecho -n ' update'; update 1791.31Sjtcecho -n ' cron'; cron 1801.1Scgdecho '.' 1811.1Scgd 1821.1Scgdecho -n starting network daemons: 1831.1Scgd 1841.19Scgd# $gated and $routed_flags are imported from /etc/netstart. 1851.1Scgd# If $gated == YES, gated is used; otherwise routed. 1861.19Scgd# If $routed_flags == NO, routed isn't run. 1871.1Scgdif [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then 1881.48Smycroft echo -n ' gated'; gated $gated_flags 1891.21Scgdelif [ "X${routed_flags}" != X"NO" ]; then 1901.48Smycroft echo -n ' routed'; routed $routed_flags 1911.1Scgdfi 1921.1Scgd 1931.55Sthorpej# $mrouted_flags is imported from /etc/netstart; 1941.55Sthorpej# If $mrouted_flags == NO, then mrouted isn't run. 1951.55Sthorpejif [ "X${mrouted_flags}" != X"NO" ]; then 1961.55Sthorpej echo -n ' mrouted'; mrouted $mrouted_flags 1971.55Sthorpejfi 1981.55Sthorpej 1991.55Sthorpej# $named_flags is imported from /etc/netstart; 2001.48Smycroft# if $named_flags != NO, named is run. 2011.48Smycroftif [ "X${named_flags}" != X"NO" ]; then 2021.48Smycroft echo -n ' named'; named $named_flags 2031.29Smycroftfi 2041.29Smycroft 2051.1Scgd# $rwhod is imported from /etc/netstart; 2061.2Scgd# if $rwhod == YES, rwhod is run. 2071.5Scgdif [ X${rwhod} = X"YES" ]; then 2081.48Smycroft echo -n ' rwhod'; rwhod 2091.1Scgdfi 2101.1Scgd 2111.1Scgdecho -n ' printer'; lpd 2121.6Scgd 2131.19Scgd# $sendmail_flags is imported from /etc/netstart; 2141.24Scgd# If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then 2151.24Scgd# sendmail isn't run. 2161.24Scgdif [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then 2171.56Smrg echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags} 2181.19Scgdfi 2191.19Scgd 2201.1Scgdecho -n ' inetd'; inetd 2211.30Smycroft 2221.51Sthorpej# $rarpd_flags is imported from /etc/netstart; 2231.30Smycroft# If $rarpd_flags == NO or /etc/ethers doesn't exist, then 2241.30Smycroft# rarpd isn't run. 2251.30Smycroftif [ "X${rarpd_flags}" != X"NO" -a -r /etc/ethers ]; then 2261.30Smycroft echo -n ' rarpd'; rarpd ${rarpd_flags} 2271.30Smycroftfi 2281.30Smycroft 2291.51Sthorpej# $bootparamd_flags is imported from /etc/netstart; 2301.30Smycroft# If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then 2311.30Smycroft# bootparamd isn't run. 2321.30Smycroftif [ "X${bootparamd_flags}" != X"NO" -a -r /etc/bootparams ]; then 2331.30Smycroft echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags} 2341.52Sthorpejfi 2351.52Sthorpej 2361.52Sthorpej# $rbootd_flags is imported from /etc/netstart; 2371.52Sthorpej# If $rbootd_flags == NO or /etc/rbootd.conf doesn't exist, then 2381.52Sthorpej# rbootd isn't run. 2391.52Sthorpejif [ "X${rbootd_flags}" != X"NO" -a -r /etc/rbootd.conf ]; then 2401.52Sthorpej echo -n ' rbootd'; rbootd ${rbootd_flags} 2411.30Smycroftfi 2421.30Smycroft 2431.1Scgdecho '.' 2441.1Scgd 2451.25Smycroft. /etc/rc.local 2461.1Scgd 2471.1Scgddate 2481.1Scgdexit 0 249