From 711aa1c2727c4533f0cf5487f163e95f5ff8a0cc Mon Sep 17 00:00:00 2001 From: "Rodney W. Grimes" Date: Thu, 30 Mar 1995 06:26:19 +0000 Subject: [PATCH] This is the rc work as provided by pts, I will me makeing some additional changes to it based upon other outstanding bug reports and commits made after his work. Comments: (a) sysconfig is still used to do all configuration. I was not going to change that out from under you.... a user never need edit netstart or rc* unless they're being very weird. (b) rc.maint has been folded back into rc. It is just unworkable as a separate chunk because of ordering bogosities (c) netstart does what it says... it starts up enough of the network to get up, it doesn't start every bloody daemon that might talk to a socket... netstart ifconfig's the devices and sets up routing if configured to do so. (d) nfs disks are mounted immediately after netstart completes (e) syslog is started as early as possible (right after nfs) so that error messages can get logged to remote syslog servers properly (f) named is started (there is an argument that says that named should be started before syslogd because if you are the dns server for your domain, you'd like named to resolve remote hosts in syslog.conf, but this is a minority case and the trivial workarround is to put the syslog host in /etc/hosts or use an /etc/resolv.conf -- why? because you want syslog to catch named errors, which is a MUCH more important and likely occurance) (g) NOW all of the rest of the network daemons such as the time stuff, RPC, NIS, NFS, Kerberos and inetd are started (h) the rest of the generic stuff is done (cron/printer/sendmail) (i) shared libraries are set (j) /etc/rc.i386 is run (this does FreeBSD/386 specific stuff like ibcs2, xtend, and all of the syscons stuff (this is actually started as /etc/rc.`uname -m` (k) the syscons stuff has gotten a serious cleaning to make it consistent with rc conventions (l) rc.local has had the comments about syscons removed (they are not relevant to this file now) and the full name of the kernel has been restored to /etc/motd Submitted by: pts --- etc/Makefile | 7 +- etc/etc.amd64/rc.amd64 | 80 +++++++++++++ etc/etc.i386/rc.i386 | 80 +++++++++++++ etc/netstart | 112 +++--------------- etc/rc | 259 +++++++++++++++++++++++++---------------- etc/rc.local | 7 +- 6 files changed, 343 insertions(+), 202 deletions(-) create mode 100644 etc/etc.amd64/rc.amd64 create mode 100644 etc/etc.i386/rc.i386 diff --git a/etc/Makefile b/etc/Makefile index 545e9be0478f..c0d5f432e06d 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -1,5 +1,5 @@ # from: @(#)Makefile 5.11 (Berkeley) 5/21/91 -# $Id: Makefile,v 1.110 1995/03/24 00:15:15 phk Exp $ +# $Id: Makefile,v 1.111 1995/03/24 00:17:37 jkh Exp $ # disktab may be wrong -- hcx9 is a tahoe, but gets its own. # -rw-r--r-- @@ -8,8 +8,9 @@ BINGRP= wheel BIN1= aliases csh.cshrc csh.login csh.logout dm.conf \ ftpusers gettytab group hosts host.conf hosts.equiv hosts.lpd \ inetd.conf login.access motd netstart \ - networks phones printcap profile protocols rc rc.local rc.maint \ - rc.serial remote security services sysconfig shells \ + networks phones printcap profile protocols \ + rc rc.local rc.serial etc.${MACHINE}/rc.${MACHINE} \ + remote security services sysconfig shells \ syslog.conf ttys etc.${MACHINE}/disktab rpc make.conf \ ${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config \ ${.CURDIR}/../usr.bin/mail/misc/mail.rc diff --git a/etc/etc.amd64/rc.amd64 b/etc/etc.amd64/rc.amd64 new file mode 100644 index 000000000000..1d87cdc8a95f --- /dev/null +++ b/etc/etc.amd64/rc.amd64 @@ -0,0 +1,80 @@ +#!/bin/sh - +# +# $Id$ +# Do i386 specific processing +# + +echo -n 'enabling FreeBSD/386 options:' + +# Start the SCO binary emulation if requested. +if [ "X${ibcs2}" = X"YES" ]; then + echo -n ' ibcs2'; ibcs2 +fi + +if [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then + echo -n ' xtend'; /usr/libexec/xtend +fi + +########################################################################## +####### Syscons section ######## +########################################################################## + +# don't change these, they're modified below +kbdadjust=NO +vidadjust=NO + +[ "X${keymap}" != X"NO" -o "X${keyrate}" != X"NO" ] && kbdadjust=YES +[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \ + "X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \ + "X${blanktime}" != X"NO" ] && vidadjust=YES + +[ "X${kbdadjust}" != X"NO" ] && echo -n ' [kbdcontrol:' + +# keymap +if [ "X${keymap}" != X"NO" ]; then + echo -n ' keymap'; kbdcontrol -l ${keymap} +fi + +# keyrate +if [ "X${keyrate}" != X"NO" ]; then + echo -n ' keyrate'; kbdcontrol -r ${keyrate} +fi + +[ "X${kbdadjust}" != X"NO" ] && echo ']' + + +[ "X${vidadjust}" != X"NO" ] && echo -n ' [vidcontrol:' + +# screen mapping +if [ "X${scrnmap}" != X"NO" ]; then + echo -n ' screen_map'; vidcontrol -l ${scrnmap} +fi + +# font 8x16 +if [ "X${font8x16}" != X"NO" ]; then + echo -n ' font8x16'; vidcontrol -f 8x16 ${font8x16} +fi + +# font 8x14 +if [ "X${font8x14}" != X"NO" ]; then + echo -n ' font8x14'; vidcontrol -f 8x14 ${font8x14} +fi + +# font 8x8 +if [ "X${font8x8}" != X"NO" ]; then + echo -n ' font8x8'; vidcontrol -f 8x8 ${font8x8} +fi + +# blank time +if [ "X${blanktime}" != X"NO" ]; then + echo -n ' blank_time'; vidcontrol -t ${blanktime} +fi + +[ "X${vidadjust}" != X"NO" ] && echo ']' + +# screen saver +if [ "X${saver}" != X"NO" ] ; then + echo -n ' screensaver: ' + modstat | grep _saver || modload -u -o /tmp/saver_mod -e \ + saver_init -q /lkm/${saver}_saver_mod.o +fi diff --git a/etc/etc.i386/rc.i386 b/etc/etc.i386/rc.i386 new file mode 100644 index 000000000000..1d87cdc8a95f --- /dev/null +++ b/etc/etc.i386/rc.i386 @@ -0,0 +1,80 @@ +#!/bin/sh - +# +# $Id$ +# Do i386 specific processing +# + +echo -n 'enabling FreeBSD/386 options:' + +# Start the SCO binary emulation if requested. +if [ "X${ibcs2}" = X"YES" ]; then + echo -n ' ibcs2'; ibcs2 +fi + +if [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then + echo -n ' xtend'; /usr/libexec/xtend +fi + +########################################################################## +####### Syscons section ######## +########################################################################## + +# don't change these, they're modified below +kbdadjust=NO +vidadjust=NO + +[ "X${keymap}" != X"NO" -o "X${keyrate}" != X"NO" ] && kbdadjust=YES +[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \ + "X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \ + "X${blanktime}" != X"NO" ] && vidadjust=YES + +[ "X${kbdadjust}" != X"NO" ] && echo -n ' [kbdcontrol:' + +# keymap +if [ "X${keymap}" != X"NO" ]; then + echo -n ' keymap'; kbdcontrol -l ${keymap} +fi + +# keyrate +if [ "X${keyrate}" != X"NO" ]; then + echo -n ' keyrate'; kbdcontrol -r ${keyrate} +fi + +[ "X${kbdadjust}" != X"NO" ] && echo ']' + + +[ "X${vidadjust}" != X"NO" ] && echo -n ' [vidcontrol:' + +# screen mapping +if [ "X${scrnmap}" != X"NO" ]; then + echo -n ' screen_map'; vidcontrol -l ${scrnmap} +fi + +# font 8x16 +if [ "X${font8x16}" != X"NO" ]; then + echo -n ' font8x16'; vidcontrol -f 8x16 ${font8x16} +fi + +# font 8x14 +if [ "X${font8x14}" != X"NO" ]; then + echo -n ' font8x14'; vidcontrol -f 8x14 ${font8x14} +fi + +# font 8x8 +if [ "X${font8x8}" != X"NO" ]; then + echo -n ' font8x8'; vidcontrol -f 8x8 ${font8x8} +fi + +# blank time +if [ "X${blanktime}" != X"NO" ]; then + echo -n ' blank_time'; vidcontrol -t ${blanktime} +fi + +[ "X${vidadjust}" != X"NO" ] && echo ']' + +# screen saver +if [ "X${saver}" != X"NO" ] ; then + echo -n ' screensaver: ' + modstat | grep _saver || modload -u -o /tmp/saver_mod -e \ + saver_init -q /lkm/${saver}_saver_mod.o +fi diff --git a/etc/netstart b/etc/netstart index e0b40011a076..af2e52a8fd1c 100755 --- a/etc/netstart +++ b/etc/netstart @@ -1,6 +1,6 @@ #!/bin/sh - # -# $Id: netstart,v 1.23 1995/03/29 03:28:08 rgrimes Exp $ +# $Id: netstart,v 1.24 1995/03/29 03:33:55 rgrimes Exp $ # From: @(#)netstart 5.9 (Berkeley) 3/30/91 # my-name is my symbolic name @@ -44,104 +44,18 @@ fi # use loopback, not the wire # route add $hostname localhost -# The syslog daemon needs to be started as soon as possible in order -# to capture any messages generated by the other system daemons. -echo -n Starting system logger: -rm -f /dev/log -echo ' syslogd.'; syslogd +if [ "x$gated" != "xNO" -o "x$routedflags" != "xNO" ] ; then + echo -n starting routing daemons: -echo -n starting network daemons: + # $gated and $routedflags are imported from /etc/sysconfig. + # If $gated == YES, gated is used; otherwise routed. + # If $routedflags == NO, routed isn't run. -# Portmapper should always be run, to provide RPC services for inetd. -if [ -x /usr/sbin/portmap ]; then - echo -n ' portmap'; portmap + if [ "X${gated}" = X"YES" -a -r /etc/gated.conf ]; then + echo -n ' gated'; gated $gatedflags + elif [ "X${routedflags}" != X"NO" ]; then + echo -n ' routed'; routed $routedflags + fi + + echo '.' fi - -# $gated and $routedflags are imported from /etc/sysconfig. -# If $gated == YES, gated is used; otherwise routed. -# If $routedflags == NO, routed isn't run. -if [ "X${gated}" = X"YES" -a -r /etc/gated.conf ]; then - echo -n ' gated'; gated $gatedflags -elif [ "X${routedflags}" != X"NO" ]; then - echo -n ' routed'; routed $routedflags -fi - -# $namedflags is imported from /etc/sysconfig -if [ "X${namedflags}" != "XNO" ]; then - echo -n ' named'; named $namedflags -fi - -# Start ypserv if we're an NIS server. -# Run yppasswdd only on the NIS master server -if [ "X${nis_serverflags}" != X"NO" ]; then - echo -n ' ypserv'; ypserv ${nis_serverflags} - - if [ "X${yppasswddflags}" != X"NO" ]; then - echo -n ' yppasswdd'; yppasswdd ${yppasswddflags} - fi -fi - - -# Start ypbind if we're an NIS client -if [ "X${nis_clientflags}" != X"NO" ]; then - echo -n ' ypbind'; ypbind ${nis_clientflags} -fi - -# $ntpdate and $xntpdflags are imported from /etc/sysconfig. -# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. -# If $xntpdflags != NO, start xntpd. -if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then - if [ "X${tickadjflags}" != X"NO" ]; then - echo -n ' tickadj'; tickadj ${tickadjflags--Aq} - fi - - if [ "X${ntpdate}" != X"NO" ]; then - echo -n ' ntpdate'; ntpdate ${ntpdate} - fi - - if [ "X${xntpdflags}" != X"NO" ]; then - echo -n ' xntpd'; xntpd ${xntpdflags} - fi -fi - -# $timedflags is imported from /etc/sysconfig; -# if $timedflags == NO, timed isn't run. -if [ "X${timedflags}" != X"NO" ]; then - echo -n ' timed'; timed $timedflags -fi - -# $rwhod is imported from /etc/sysconfig; -# if $rwhod is set to YES, rwhod is run. -if [ "X${rwhod}" = X"YES" ]; then - echo -n ' rwhod'; rwhod -fi - -if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then - echo -n ' mountd'; mountd - echo -n ' nfsd'; nfsd -u -t 4 -fi - -if [ "X${nfs_client}" = X"YES" ]; then - echo -n ' nfsiod'; nfsiod -n 4 -fi - -if [ "X${amdflags}" != X"NO" ]; then - echo -n ' amd'; amd ${amdflags} -fi - -# $sendmail_flags is imported from /etc/sysconfig; -# if $sendmail_flags is something other than NO, sendmail is run. -if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then - echo -n ' sendmail'; sendmail ${sendmail_flags} -fi - -# Kerberos runs ONLY on the Kerberos server machine -if [ "X${kerberos_server}" = X"YES" ]; then - echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & - echo -n ' kadmind'; \ - (sleep 20; /usr/sbin/kadmind -n >/dev/null 2>&1 &) & -fi - -echo -n ' inetd'; inetd -echo '.' - diff --git a/etc/rc b/etc/rc index cd602a608cb8..3256f8573b5e 100644 --- a/etc/rc +++ b/etc/rc @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: rc,v 1.58 1995/03/29 03:42:16 jkh Exp $ +# $Id: rc,v 1.59 1995/03/30 00:01:08 ache Exp $ # From: @(#)rc 5.27 (Berkeley) 6/5/91 # System startup script run by init on autoboot @@ -81,27 +81,172 @@ if [ -f /etc/rc.serial ]; then . /etc/rc.serial fi -# Do system maintainance functions. -if [ -f /etc/rc.maint ]; then - . /etc/rc.maint -fi - -# Start up the network +# start up the network if [ -f /etc/netstart ]; then . /etc/netstart fi +mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background + +# Whack the pty perms back into shape. +chmod 666 /dev/tty[pqrs]* + +# clean up left-over files +rm -f /etc/nologin +rm -f /var/spool/lock/* +rm -f /var/spool/uucp/.Temp/* +rm -f /dev/log +(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) + +echo clearing /tmp + +# prune quickly with one rm, then use find to clean up /tmp/[lq]* +# (not needed with mfs /tmp, but doesn't hurt there...) +(cd /tmp && rm -rf [a-km-pr-zA-Z]* && + find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) + +# /var/crash should be a directory or a symbolic link +# to the crash directory if core dumps are to be saved. +if [ "X${savecore}" = X"YES" -a -d /var/crash ]; then + echo -n checking for core dump... + savecore /var/crash +fi + +# snapshot any kernel -c changes back to disk +echo 'recording kernel -c changes' +/sbin/dset -q + +# Check the quotas +if [ "X${check_quotas}" = X"YES" ]; then + echo 'checking quotas:' + quotacheck -a + echo ' done.' + quotaon -a +fi + +# start system logging and name service (named needs to start before syslogd +# if you don't have a /etc/resolv.conf) +# +echo -n starting system daemons: + +echo ' syslogd.'; syslogd + +echo -n starting network daemons: + +# $namedflags is imported from /etc/sysconfig +if [ "X${namedflags}" != "XNO" ]; then + echo -n ' named'; named $namedflags +fi + +# $ntpdate and $xntpdflags are imported from /etc/sysconfig. +# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly. +# If $xntpdflags != NO, start xntpd. +if [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then + if [ "X${tickadjflags}" != X"NO" ]; then + echo -n ' tickadj'; tickadj ${tickadjflags--Aq} + fi + + if [ "X${ntpdate}" != X"NO" ]; then + echo -n ' ntpdate'; ntpdate ${ntpdate} >/dev/null 2>&1 + fi + + if [ "X${xntpdflags}" != X"NO" ]; then + echo -n ' xntpd'; xntpd ${xntpdflags} + fi +fi + +# $timedflags is imported from /etc/sysconfig; +# if $timedflags == NO, timed isn't run. +if [ "X${timedflags}" != X"NO" ]; then + echo -n ' timed'; timed $timedflags +fi + +# Portmapper should always be run, to provide RPC services for inetd. +if [ -x /usr/sbin/portmap ]; then + echo -n ' portmap'; portmap +fi + +# Start ypserv if we're an NIS server. +# Run yppasswdd only on the NIS master server +if [ "X${nis_serverflags}" != X"NO" ]; then + echo -n ' ypserv'; ypserv ${nis_serverflags} + + if [ "X${yppasswddflags}" != X"NO" ]; then + echo -n ' yppasswdd'; yppasswdd ${yppasswddflags} + fi +fi + +# Start ypbind if we're an NIS client +if [ "X${nis_clientflags}" != X"NO" ]; then + echo -n ' ypbind'; ypbind ${nis_clientflags} +fi + +# $rwhod is imported from /etc/sysconfig; +# if $rwhod is set to YES, rwhod is run. +if [ "X${rwhod}" = X"YES" ]; then + echo -n ' rwhod'; rwhod +fi + +if [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then + echo -n ' mountd'; mountd + echo -n ' nfsd'; nfsd -u -t 4 +fi + +if [ "X${nfs_client}" = X"YES" ]; then + echo -n ' nfsiod'; nfsiod -n 4 +fi + +if [ "X${amdflags}" != X"NO" ]; then + echo -n ' amd'; amd ${amdflags} +fi + +# Kerberos runs ONLY on the Kerberos server machine +if [ "X${kerberos_server}" = X"YES" ]; then + echo -n ' kerberos'; kerberos >> /var/log/kerberos.log & + echo -n ' kadmind'; \ + (sleep 20; /usr/sbin/kadmind -n >/dev/null 2>&1 &) & +fi + +echo -n ' inetd'; inetd +echo '.' + +# build ps databases +kvm_mkdb +dev_mkdb + +# check the password temp/lock file +if [ -f /etc/ptmp ] +then + logger -s -p auth.err \ + "password file may be incorrect -- /etc/ptmp exists" +fi + +# Recover vi editor files. +virecovery=/var/tmp/vi.recover/recover.* +if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then + echo 'Recovering vi editor sessions' + for i in $virecovery; do + sendmail -t < $i + done +fi + +if [ "X${accounting}" = X"YES" -a -d /var/account ]; then + echo 'turning on accounting'; accton /var/account/acct +fi + # Now start up miscellaneous daemons that don't belong anywhere else # echo -n standard daemons: echo -n ' cron'; cron -if [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then - echo -n ' xtend'; /usr/libexec/xtend -fi echo -n ' printer'; lpd -echo '.' -mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background +# $sendmail_flags is imported from /etc/sysconfig; +# if $sendmail_flags is something other than NO, sendmail is run. +if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then + echo -n ' sendmail'; sendmail ${sendmail_flags} +fi + +echo '.' # Make shared lib searching a little faster. Leave /usr/lib first if you # add your own entries or you may come to grief. @@ -115,92 +260,10 @@ if [ -x /sbin/ldconfig ]; then ldconfig ${_LDC} fi -######################### Start Of Syscons Section ####################### - -kbdadjust=NO -[ "X${keymap}" != X"NO" -o "X${keyrate}" != X"NO" \ - -o "X${keychange}" != X"NO" ] && kbdadjust=YES -vidadjust=NO -[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \ - "X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \ - "X${blanktime}" != X"NO" ] && vidadjust=YES - -[ "X${kbdadjust}" != X"NO" -o "X${vidadjust}" != X"NO" -o \ - "X${saver}" != X"NO" ] && echo "starting syscons:" - -[ "X${kbdadjust}" != X"NO" ] && echo -n " kbdcontrol:" - -# keymap -if [ "X${keymap}" != X"NO" ]; then - echo -n " keymap" - kbdcontrol -l ${keymap} -fi - -# keyrate -if [ "X${keyrate}" != X"NO" ]; then - echo -n " keyrate" - kbdcontrol -r ${keyrate} -fi - -# change function keys -if [ "X${keychange}" != X"NO" ]; then - echo -n " keychange" - set - ${keychange} - while [ $# -gt 0 ] - do - kbdcontrol -f "$1" "$2" - shift; shift - done -fi - -[ "X${kbdadjust}" != X"NO" ] && echo -[ "X${vidadjust}" != X"NO" ] && echo -n " vidcontrol:" - -# screen mapping -if [ "X${scrnmap}" != X"NO" ]; then - echo -n " screen_map" - vidcontrol -l ${scrnmap} -fi - -# font 8x16 -if [ "X${font8x16}" != X"NO" ]; then - echo -n " font8x16" - vidcontrol -f 8x16 ${font8x16} -fi - -# font 8x14 -if [ "X${font8x14}" != X"NO" ]; then - echo -n " font8x14" - vidcontrol -f 8x14 ${font8x14} -fi - -# font 8x8 -if [ "X${font8x8}" != X"NO" ]; then - echo -n " font8x8" - vidcontrol -f 8x8 ${font8x8} -fi - -# blank time -if [ "X${blanktime}" != X"NO" ]; then - echo -n " blank_time" - vidcontrol -t ${blanktime} -fi - -[ "X${vidadjust}" != X"NO" ] && echo "." - -# screen saver -if [ "X${saver}" != X"NO" ] ; then - echo -n "screensaver: " - modstat | grep _saver || modload -u -o /tmp/saver_mod -e \ - saver_init -q /lkm/${saver}_saver_mod.o -fi - -######################### End Of Syscons Section ####################### - -# Start the SCO binary emulation if requested. -if [ "X${ibcs2}" = X"YES" ]; then - echo "Enabling ibcs2 emulation." - ibcs2 +# configure implementation specific stuff +arch=`uname -m` +if [ -f /etc/rc.$arch ]; then + . /etc/rc.$arch fi # Do traditional (but rather obsolete) rc.local file if it exists. diff --git a/etc/rc.local b/etc/rc.local index b7cca4aaacc3..140e8631e90a 100644 --- a/etc/rc.local +++ b/etc/rc.local @@ -1,12 +1,13 @@ # # site-specific startup actions, daemons # -# $Id: rc.local,v 1.16 1995/03/16 16:58:01 wollman Exp $ +# $Id: rc.local,v 1.17 1995/03/30 00:10:31 ache Exp $ # T=/tmp/_motd rm -f $T -uname -rs > $T +uname -v | sed -e 's/199[0-9]/&\ +/' > $T echo "" >> $T sed '1,/^$/d' < /etc/motd >> $T cp $T /etc/motd @@ -16,4 +17,6 @@ _HOST=`hostname` echo -n 'starting local daemons:' +# put your local stuff here + echo '.'