Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Mar 1995 23:45:29 -0800
From:      Paul Traina <pst@shockwave.com>
To:        jkh@FreeBSD.org, phk@FreeBSD.org
Cc:        current@FreeBSD.org
Subject:   grumbles from the grave
Message-ID:  <199503290745.XAA00427@precipice.shockwave.com>

next in thread | raw e-mail | index | archive | help
I -am- retired,  but the reorganization of the rc scripts has been annoying
me,  so I've gone through and redone them.  I've kept all of the spirit
of sysconfig et al (in fact, sysconfig hasn't changed at all),  but I've
fixed all of the ordering problems that I could find or recognize and
moved things so they actually make better sense (and are closer to BSD spirit
in functionality).

This stuff has been tested thoroughly in as many bizzare configurations as
I could handle.

-->>> This stuff does NOT include any changes made since 1pm yesterday.
	I am not giving this to you as diffs because diffs don't make
	sense here.

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

So, please make the following changes:
	replace src/etc/netstart with this new one
	replace src/etc/rc	 with this new one
	replace src/etc/rc.local with this new one
	remove  src/etc/rc.maint and rules, it is no longer needed
	add     src/etc/i386/rc.i386 and a makefile install rule
			^^^^

OK, -now- I'm retired.

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	netstart
#	rc
#	rc.i386
#	rc.local
#
echo x - netstart
sed 's/^X//' >netstart << 'END-of-netstart'
X#!/bin/sh -
X#
X#	$Id: netstart,v 1.2 1995/03/26 18:18:59 wpaul Exp $
X#	From: @(#)netstart	5.9 (Berkeley) 3/30/91
X
X# my-name is my symbolic name
X# my-netmask is specified in /etc/networks
X#
Xif [ -z "`hostname -s`" ] ; then
X	hostname $hostname
Xfi
X
X# Set the domainname if we're using NIS
Xif [ -z "`domainname`" -a -e "/etc/defaultdomain" ] ; then
X        domainname=`cat /etc/defaultdomain`
X        domainname $domainname
Xfi
X
Xfor i in /etc/hostname.*
Xdo
X	ifn=`expr $i : '/etc/hostname\.\(.*\)'`
X	if [ -e /etc/hostname.$ifn ]; then
X		if [ -e /etc/start_if.$ifn ]; then
X			sh /etc/start_if.$ifn $ifn
X		fi
X		ifconfig $ifn `cat /etc/hostname.$ifn`
X		ifconfig $ifn
X	fi
Xdone
X
X# set the address for the loopback interface
Xifconfig lo0 inet localhost
X
X# set interface for multicasts to default interface
X# this needs to happen before router discovery
Xroute add 224.0.0.0 -netmask 0xf0000000 -interface $hostname
X
Xif [ -n "$defaultrouter" -a "x$defaultrouter" != "xNO" ] ; then
X	route add default $defaultrouter
Xelif [ -f /etc/defaultrouter ] ; then
X	route add default `cat /etc/defaultrouter`
Xfi
X
X# use loopback, not the wire
X# route add $hostname localhost
X
Xif [ "x$gated" != "xNO" -o "x$routedflags" != "xNO" ] ; then
X    echo -n starting routing daemons:
X
X    # $gated and $routedflags are imported from /etc/sysconfig.
X    # If $gated == YES, gated is used; otherwise routed.
X    # If $routedflags == NO, routed isn't run.
X
X    if [ "X${gated}" = X"YES" -a -r /etc/gated.conf ]; then
X	    echo -n ' gated';	gated $gatedflags
X    elif [ "X${routedflags}" != X"NO" ]; then
X	    echo -n ' routed';	routed $routedflags
X    fi
X
X    echo '.'
Xfi
END-of-netstart
echo x - rc
sed 's/^X//' >rc << 'END-of-rc'
X#!/bin/sh
X#	$Id: rc,v 1.56 1995/03/26 18:18:58 wpaul Exp $
X#	From: @(#)rc	5.27 (Berkeley) 6/5/91
X
X# System startup script run by init on autoboot
X# or after single-user.
X# Output and error are redirected to console by init,
X# and the console is the controlling terminal.
X
Xstty status '^T'
X
X# Set shell to ignore SIGINT (2), but not children;
X# shell catches SIGQUIT (3) and returns to single user after fsck.
Xtrap : 2
Xtrap : 3	# shouldn't be needed
X
XHOME=/; export HOME
XPATH=/sbin:/bin:/usr/sbin:/usr/bin
Xexport PATH
X
Xswapon -a
X
Xif [ $1x = autobootx ]
Xthen
X	echo Automatic reboot in progress...
X	fsck -p
X	case $? in
X	0)
X		;;
X	2)
X		exit 1
X		;;
X	4)
X		reboot
X		echo "reboot failed... help!"
X		exit 1
X		;;
X	8)
X		echo "Automatic file system check failed... help!"
X		exit 1
X		;;
X	12)
X		echo "Reboot interrupted"
X		exit 1
X		;;
X	130)
X		# interrupt before catcher installed
X		exit 1
X		;;
X	*)
X		echo "Unknown error in reboot"
X		exit 1
X		;;
X	esac
Xelse
X	echo Skipping disk checks ...
Xfi
X
Xtrap "echo 'Reboot interrupted'; exit 1" 3
X
X# root must be read/write both for NFS diskless and for VFS LKMs before
X# proceeding any further.
Xmount -u -o rw /
X
Xumount -a >/dev/null 2>&1
Xmount -a -t nonfs
X
X# If the machine runs wall CMOS clock (compatible with MSDOS),
X# activate following line by creating empty file /etc/wall_cmos_clock
X# If this file not exist, following line does nothing (assumed
X# the machine runs UTC CMOS clock). See adjkerntz(8) for details.
Xadjkerntz -i
X
X# If there is a global system configuration file, suck it in.
Xif [ -f /etc/sysconfig ]; then
X	. /etc/sysconfig
Xfi
X
X# configure serial devices
Xif [ -f /etc/rc.serial ]; then
X	. /etc/rc.serial
Xfi
X
X# start up the network
Xif [ -f /etc/netstart ]; then
X	. /etc/netstart
Xfi
X
Xmount -a -t nfs >/dev/null 2>&1 &	# XXX shouldn't need background
X
X# Whack the pty perms back into shape.
Xchmod 666 /dev/tty[pqrs]*
X
X# clean up left-over files
Xrm -f /etc/nologin
Xrm -f /var/spool/lock/*
Xrm -f /var/spool/uucp/.Temp/*
Xrm -f /dev/log
X(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })
X
Xecho clearing /tmp
X
X# prune quickly with one rm, then use find to clean up /tmp/[lq]*
X# (not needed with mfs /tmp, but doesn't hurt there...)
X(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
X    find -d . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;)
X
X# /var/crash should be a directory or a symbolic link
X# to the crash directory if core dumps are to be saved.
Xif [ "X${savecore}" = X"YES" -a -d /var/crash ]; then
X	echo -n checking for core dump...
X	savecore /var/crash
Xfi
X
X# snapshot any kernel -c changes back to disk
Xecho 'recording kernel -c changes'
X/sbin/dset -q
X
X# Check the quotas
Xif [ "X${check_quotas}" = X"YES" ]; then
X	echo 'checking quotas:'
X	quotacheck -a
X	echo ' done.'
X	quotaon -a
Xfi
X
X# start system logging and name service (named needs to start before syslogd
X# if you don't have a /etc/resolv.conf)
X#
Xecho -n starting system daemons:
X
Xecho ' syslogd.';                       syslogd
X
Xecho -n starting network daemons:
X
X# $namedflags is imported from /etc/sysconfig
Xif [ "X${namedflags}" != "XNO" ]; then
X	echo -n ' named';	named $namedflags
Xfi
X
X# $ntpdate and $xntpdflags are imported from /etc/sysconfig.
X# If $ntpdate != NO, run ntpdate $ntpdate to set the date correctly.
X# If $xntpdflags != NO, start xntpd.
Xif [ "X${ntpdate}" != X"NO" -o "X${xntpdflags}" != X"NO" ]; then
X	if [ "X${tickadjflags}" != X"NO" ]; then
X		echo -n ' tickadj';	tickadj ${tickadjflags--Aq}
X	fi
X
X	if [ "X${ntpdate}" != X"NO" ]; then
X		echo -n ' ntpdate';	ntpdate ${ntpdate} >/dev/null 2>&1
X	fi
X
X	if [ "X${xntpdflags}" != X"NO" ]; then
X		echo -n ' xntpd';	xntpd ${xntpdflags}
X	fi
Xfi
X
X# $timedflags is imported from /etc/sysconfig;
X# if $timedflags == NO, timed isn't run.
Xif [ "X${timedflags}" != X"NO" ]; then
X	echo -n ' timed'; timed $timedflags
Xfi
X
X# Portmapper should always be run, to provide RPC services for inetd.
Xif [ -x /usr/sbin/portmap ]; then
X	echo -n ' portmap';		portmap
Xfi
X
X# Start ypserv if we're an NIS server.
X# Run yppasswdd only on the NIS master server
Xif [ "X${nis_serverflags}" != X"NO" ]; then
X        echo -n ' ypserv'; ypserv ${nis_serverflags}
X
X	if [ "X${yppasswddflags}" != X"NO" ]; then
X	        echo -n ' yppasswdd'; yppasswdd ${yppasswddflags}
X	fi
Xfi
X
X# Start ypbind if we're an NIS client
Xif [ "X${nis_clientflags}" != X"NO" ]; then
X        echo -n ' ypbind'; ypbind ${nis_clientflags}
Xfi
X
X# $rwhod is imported from /etc/sysconfig;
X# if $rwhod is set to YES, rwhod is run.
Xif [ "X${rwhod}" = X"YES" ]; then
X	echo -n ' rwhod';	rwhod
Xfi
X
Xif [ "X${nfs_server}" = X"YES" -a -r /etc/exports ]; then
X	echo -n ' mountd';		mountd
X	echo -n ' nfsd';		nfsd -u -t 4
Xfi
X
Xif [ "X${nfs_client}" = X"YES" ]; then
X	echo -n ' nfsiod';		nfsiod -n 4
Xfi
X
Xif [ "X${amdflags}" != X"NO" ]; then
X	echo -n ' amd';			amd ${amdflags}
Xfi
X
X# Kerberos runs ONLY on the Kerberos server machine
Xif [ "X${kerberos_server}" = X"YES" ]; then
X	echo -n ' kerberos';	kerberos >> /var/log/kerberos.log &
X	echo -n ' kadmind'; \
X		(sleep 20; /usr/sbin/kadmind -n >/dev/null 2>&1 &) &
Xfi
X
Xecho -n ' inetd';		inetd
Xecho '.'
X
X# build ps databases
Xkvm_mkdb 
Xdev_mkdb
X
X# check the password temp/lock file
Xif [ -f /etc/ptmp ]
Xthen
X	logger -s -p auth.err \
X	"password file may be incorrect -- /etc/ptmp exists"
Xfi
X
X# Recover vi editor files.
Xvirecovery=/var/tmp/vi.recover/recover.*
Xif [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
X	echo 'Recovering vi editor sessions'
X	for i in $virecovery; do
X		sendmail -t < $i
X	done
Xfi
X
Xif [ "X${accounting}" = X"YES" -a -d /var/account ]; then
X	echo 'turning on accounting';	accton /var/account/acct
Xfi
X
X# Now start up miscellaneous daemons that don't belong anywhere else
X#
Xecho -n standard daemons:
Xecho -n ' cron';		cron
Xecho -n ' printer';             lpd
X
X# $sendmail_flags is imported from /etc/sysconfig;
X# if $sendmail_flags is something other than NO, sendmail is run.
Xif [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
X	echo -n ' sendmail';		sendmail ${sendmail_flags} 
Xfi
X
Xecho '.'
X
X# Make shared lib searching a little faster.  Leave /usr/lib first if you
X# add your own entries or you may come to grief.
Xif [ -x /sbin/ldconfig ]; then
X	_LDC=/usr/lib
X	if [ -d /usr/X11R6/lib ]; then _LDC="${_LDC} /usr/X11R6/lib" ; fi
X	if [ -d /usr/X386/lib ]; then _LDC="${_LDC} /usr/X386/lib" ; fi
X	if [ -d /usr/local/lib ]; then _LDC="${_LDC} /usr/local/lib" ; fi
X	if [ -d /usr/gnu/lib ]; then _LDC="${_LDC} /usr/gnu/lib" ; fi
X	echo 'setting ldconfig path:' ${_LDC}
X	ldconfig ${_LDC}
Xfi
X
X# configure implementation specific stuff
Xarch=`uname -m`
Xif [ -f /etc/rc.$arch ]; then
X	. /etc/rc.$arch
Xfi
X
X# Do traditional (but rather obsolete) rc.local file if it exists.
Xif [ -f /etc/rc.local ]; then
X	sh /etc/rc.local
Xfi
X
Xdate
Xexit 0
END-of-rc
echo x - rc.i386
sed 's/^X//' >rc.i386 << 'END-of-rc.i386'
X#!/bin/sh -
X#
X#	$Id$
X#	Do i386 specific processing
X#
X
Xecho -n 'enabling FreeBSD/386 options:'
X
X# Start the SCO binary emulation if requested.
Xif [ "X${ibcs2}" = X"YES" ]; then
X	echo -n ' ibcs2';  ibcs2
Xfi
X
Xif [ "X${xtend}" != X"NO" -a -x /usr/libexec/xtend ]; then
X 	echo -n ' xtend';   /usr/libexec/xtend
Xfi
X
X##########################################################################
X####### Syscons section						  ########
X##########################################################################
X
X# don't change these, they're modified below
Xkbdadjust=NO
Xvidadjust=NO
X
X[ "X${keymap}" != X"NO" -o "X${keyrate}" != X"NO" ] && kbdadjust=YES
X[ "X${scrnmap}" != X"NO" -o "X${font8x16}" != X"NO" -o \
X	"X${font8x14}" != X"NO" -o "X${font8x8}" != X"NO" -o \
X	"X${blanktime}" != X"NO" ] && vidadjust=YES
X
X[ "X${kbdadjust}" != X"NO" ] && echo -n ' [kbdcontrol:'
X
X# keymap
Xif [ "X${keymap}" != X"NO" ]; then
X	echo -n ' keymap';	kbdcontrol -l ${keymap}
Xfi
X
X# keyrate
Xif [ "X${keyrate}" != X"NO" ]; then
X	echo -n ' keyrate';    kbdcontrol -r ${keyrate}
Xfi
X
X[ "X${kbdadjust}" != X"NO" ] && echo ']'
X
X
X[ "X${vidadjust}" != X"NO" ] && echo -n ' [vidcontrol:'
X
X# screen mapping
Xif [ "X${scrnmap}" != X"NO" ]; then
X	echo -n ' screen_map';	vidcontrol -l ${scrnmap}
Xfi
X
X# font 8x16
Xif [ "X${font8x16}" != X"NO" ]; then
X	echo -n ' font8x16';	vidcontrol -f 8x16 ${font8x16}
Xfi
X
X# font 8x14
Xif [ "X${font8x14}" != X"NO" ]; then
X	echo -n ' font8x14';	vidcontrol -f 8x14 ${font8x14}
Xfi
X
X# font 8x8
Xif [ "X${font8x8}" != X"NO" ]; then
X	echo -n ' font8x8';	vidcontrol -f 8x8 ${font8x8}
Xfi
X
X# blank time
Xif [ "X${blanktime}" != X"NO" ]; then
X	echo -n ' blank_time';	vidcontrol -t ${blanktime}
Xfi
X
X[ "X${vidadjust}" != X"NO" ] && echo ']'
X
X# screen saver
Xif [ "X${saver}" != X"NO" ] ; then
X	echo -n ' screensaver: '
X	modstat | grep _saver || modload -u -o /tmp/saver_mod -e \
X				 saver_init -q /lkm/${saver}_saver_mod.o
Xfi
END-of-rc.i386
echo x - rc.local
sed 's/^X//' >rc.local << 'END-of-rc.local'
X#
X# site-specific startup actions, daemons
X#
X#	$Id: rc.local,v 1.16 1995/03/16 16:58:01 wollman Exp $
X#
X
XT=/tmp/_motd
Xrm -f $T
Xuname -v | sed -e 's/199[0-9]/&\
X/' > $T
Xecho "" >> $T
Xsed '1,/^$/d' < /etc/motd >> $T
Xcp $T /etc/motd
Xchmod 644 /etc/motd
Xrm -f $T
X_HOST=`hostname`
X
Xecho -n 'starting local daemons:'
X
X# put your local stuff here
X
Xecho '.'
END-of-rc.local
exit




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503290745.XAA00427>