1999-11-23 18:12:43 +03:00
|
|
|
# $NetBSD: rc,v 1.138 1999/11/23 15:12:43 hubertf Exp $
|
1997-04-19 07:10:57 +04:00
|
|
|
# originally from: @(#)rc 8.2 (Berkeley) 3/17/94
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
# System startup script run by init on autoboot
|
|
|
|
# or after single-user.
|
|
|
|
# Output and error are redirected to console by init,
|
|
|
|
# and the console is the controlling terminal.
|
|
|
|
|
|
|
|
stty status '^T'
|
|
|
|
|
|
|
|
# Set shell to ignore SIGINT (2), but not children;
|
|
|
|
# shell catches SIGQUIT (3) and returns to single user after fsck.
|
|
|
|
trap : 2
|
|
|
|
trap : 3 # shouldn't be needed
|
|
|
|
|
1997-03-10 12:34:59 +03:00
|
|
|
export HOME=/
|
1997-11-11 05:28:58 +03:00
|
|
|
export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1995-08-28 00:30:53 +04:00
|
|
|
# Configure ccd devices.
|
1997-01-05 15:01:54 +03:00
|
|
|
if [ -f /etc/ccd.conf ]; then
|
1995-08-28 00:30:53 +04:00
|
|
|
ccdconfig -C
|
|
|
|
fi
|
|
|
|
|
1999-01-04 03:49:36 +03:00
|
|
|
# Configure raid devices.
|
|
|
|
for dev in 0 1 2 3; do
|
|
|
|
if [ -f /etc/raid$dev.conf ]; then
|
|
|
|
raidctl -c /etc/raid$dev.conf raid$dev
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
1997-06-26 03:30:28 +04:00
|
|
|
# Add all block-type swap devices; these might be necessary
|
|
|
|
# during disk checks.
|
|
|
|
swapctl -A -t blk
|
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
if [ -e /fastboot ]; then
|
1994-03-18 03:58:20 +03:00
|
|
|
echo "Fast boot: skipping disk checks."
|
1997-03-10 12:34:59 +03:00
|
|
|
elif [ "$1" = autoboot ]; then
|
1994-03-18 03:58:20 +03:00
|
|
|
echo "Automatic boot in progress: starting file system checks."
|
1993-03-21 12:45:37 +03:00
|
|
|
fsck -p
|
|
|
|
case $? in
|
|
|
|
0)
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
4)
|
1994-03-09 07:02:58 +03:00
|
|
|
echo "Rebooting..."
|
1993-03-21 12:45:37 +03:00
|
|
|
reboot
|
1994-03-18 03:58:20 +03:00
|
|
|
echo "Reboot failed; help!"
|
1993-03-21 12:45:37 +03:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
8)
|
1994-03-18 03:58:20 +03:00
|
|
|
echo "Automatic file system check failed; help!"
|
1993-03-21 12:45:37 +03:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
12)
|
1994-03-18 03:58:20 +03:00
|
|
|
echo "Boot interrupted."
|
1993-03-21 12:45:37 +03:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
130)
|
|
|
|
# interrupt before catcher installed
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
1994-03-18 03:58:20 +03:00
|
|
|
echo "Unknown error; help!"
|
1993-03-21 12:45:37 +03:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
1994-03-18 03:58:20 +03:00
|
|
|
trap "echo 'Boot interrupted.'; exit 1" 3
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
umount -a >/dev/null 2>&1
|
1997-07-14 15:55:44 +04:00
|
|
|
mount /
|
1993-03-21 12:45:37 +03:00
|
|
|
rm -f /fastboot # XXX (root now writeable)
|
|
|
|
|
1997-08-29 13:33:34 +04:00
|
|
|
if [ -f /etc/rc.subr ]; then
|
|
|
|
. /etc/rc.subr
|
1997-08-29 06:24:04 +04:00
|
|
|
else
|
1997-08-29 13:33:34 +04:00
|
|
|
echo "Can't read /etc/rc.subr; aborting."
|
1997-08-29 06:24:04 +04:00
|
|
|
exit 1;
|
|
|
|
fi
|
|
|
|
|
1997-03-12 22:21:26 +03:00
|
|
|
if [ -f /etc/rc.conf ]; then
|
1997-01-05 15:01:54 +03:00
|
|
|
. /etc/rc.conf
|
|
|
|
fi
|
|
|
|
|
1999-10-30 16:35:30 +04:00
|
|
|
if ! checkyesno rc_configured; then
|
1997-08-29 06:24:04 +04:00
|
|
|
echo "/etc/rc.conf is not configured. Multiuser boot aborted."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1994-04-10 10:42:40 +04:00
|
|
|
# set flags on ttys. (do early, in case they use tty for SLIP in netstart)
|
|
|
|
echo 'setting tty flags'
|
|
|
|
ttyflags -a
|
|
|
|
|
1997-07-14 15:55:44 +04:00
|
|
|
# load kernel modules specified in /etc/lkm.conf if the /usr filesystem
|
|
|
|
# is already present with "/" or can be mounted now
|
1997-09-12 14:36:04 +04:00
|
|
|
if checkyesno lkm && [ -f /etc/rc.lkm ]; then
|
1997-07-14 15:55:44 +04:00
|
|
|
mount /usr >/dev/null 2>&1
|
|
|
|
if [ -x /usr/bin/ld ]; then
|
|
|
|
lkmstage=BEFORENET
|
|
|
|
. /etc/rc.lkm
|
|
|
|
fi
|
1997-01-05 15:01:54 +03:00
|
|
|
fi
|
|
|
|
|
1999-04-01 07:58:44 +04:00
|
|
|
mount_critical_filesystems local
|
1999-03-24 21:59:47 +03:00
|
|
|
|
1999-10-05 14:32:56 +04:00
|
|
|
if [ -e /etc/etc.current ] ; then
|
|
|
|
if [ -h /etc/etc.default ] ; then
|
|
|
|
def=`ls -ld /etc/etc.default 2>&1`
|
|
|
|
default=`expr "$def" : '.*-> etc\.\(.*\)' 2>&1`
|
|
|
|
else
|
|
|
|
default=current
|
|
|
|
fi
|
|
|
|
spc=""
|
|
|
|
conflist=`cd /etc; ls -1d etc.* 2>&1 | egrep -v 'current|default'`
|
|
|
|
for i in $conflist; do
|
|
|
|
name=`expr $i : 'etc\.\(.*\)' 2>&1`
|
|
|
|
if [ $name = $default ] ; then
|
|
|
|
echo -n "${spc}[${name}]"
|
|
|
|
else
|
|
|
|
echo -n "${spc}${name}"
|
|
|
|
fi
|
|
|
|
spc=" "
|
|
|
|
done
|
|
|
|
echo
|
|
|
|
master=$$
|
|
|
|
conf=/etc/passwd
|
|
|
|
while [ ! -d /etc/etc.$conf ] ; do
|
|
|
|
trap 'conf=$default; echo; echo Using default of $conf' 14
|
|
|
|
echo -n "Which configuration [$default] ? "
|
|
|
|
(sleep 30 && kill -ALRM $master) >/dev/null 2>&1 &
|
|
|
|
read conf
|
|
|
|
trap "" 14
|
|
|
|
if [ -z $conf ] ; then
|
|
|
|
conf=$default
|
|
|
|
fi
|
|
|
|
if [ ! -d /etc/etc.$conf -a ! -h /etc/etc.$conf ] ; then
|
|
|
|
conf=/etc/passwd
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
rm -f /etc/etc.current
|
|
|
|
ln -s /etc/etc.$conf /etc/etc.current
|
|
|
|
if [ -f /etc/rc.conf ] ; then
|
|
|
|
. /etc/rc.conf
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
# set hostname, turn on network
|
|
|
|
echo 'starting network'
|
1997-04-29 08:58:38 +04:00
|
|
|
sh /etc/netstart
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1999-04-01 07:58:44 +04:00
|
|
|
mount_critical_filesystems network
|
1993-12-16 07:02:23 +03:00
|
|
|
|
1998-01-24 22:12:54 +03:00
|
|
|
# Network Address Translation...
|
1998-01-26 15:02:43 +03:00
|
|
|
if checkyesno ipnat && [ -f /etc/ipnat.conf ]; then
|
1998-01-24 22:12:54 +03:00
|
|
|
echo 'installing NAT rules ... '
|
1998-01-26 15:02:43 +03:00
|
|
|
if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then
|
1998-01-24 22:12:54 +03:00
|
|
|
ipf -E -Fa
|
|
|
|
fi
|
|
|
|
ipnat -F -f /etc/ipnat.conf
|
|
|
|
fi
|
|
|
|
|
1997-06-26 03:30:28 +04:00
|
|
|
# "Critical" file systems are now mounted. Go ahead and swap
|
|
|
|
# to files now, since they will be residing in the critical file
|
|
|
|
# systems (or, at least, better).
|
|
|
|
swapctl -A -t noblk
|
|
|
|
|
1997-11-23 07:17:57 +03:00
|
|
|
# Check for no swap, and warn about it unless that is desired.
|
1998-01-26 15:02:43 +03:00
|
|
|
if ! checkyesno no_swap; then
|
1997-11-23 07:17:57 +03:00
|
|
|
swapctl -s | grep 'no swap devices configured' > /dev/null && \
|
|
|
|
echo "WARNING: no swap space configured!"
|
|
|
|
fi
|
|
|
|
|
1994-05-29 07:37:33 +04:00
|
|
|
# clean up left-over files
|
|
|
|
rm -f /etc/nologin
|
|
|
|
rm -f /var/spool/lock/LCK.*
|
|
|
|
rm -f /var/spool/uucp/STST/*
|
1994-06-18 10:38:54 +04:00
|
|
|
(cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
|
1994-05-29 07:37:33 +04:00
|
|
|
|
1999-10-05 14:54:27 +04:00
|
|
|
# build ps databases
|
|
|
|
echo 'building databases...'
|
1999-09-16 15:00:44 +04:00
|
|
|
# if this kernel supports machdep.booted_kernel, use that to build the KVM
|
|
|
|
# db so dmesg will run work when we boot /netbsd.new, etc.
|
1999-10-05 14:32:56 +04:00
|
|
|
sysctl machdep 2>/dev/null | grep -q booted_kernel
|
1999-09-16 15:00:44 +04:00
|
|
|
if [ $? -eq 0 ] ; then
|
|
|
|
kvm_mkdb `sysctl -n machdep.booted_kernel`
|
1999-10-05 14:54:27 +04:00
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
kvm_mkdb /netbsd
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
kvm_mkdb /netbsd
|
1999-09-16 15:00:44 +04:00
|
|
|
fi
|
1999-10-05 14:54:27 +04:00
|
|
|
dev_mkdb
|
|
|
|
|
1999-01-12 15:42:46 +03:00
|
|
|
# get the system dmesg output, hopefully containing the boot messages
|
|
|
|
# $dmesg_flags is imported from /etc/rc.conf
|
|
|
|
if checkyesno dmesg; then
|
|
|
|
dmesg $dmesg_flags > /var/run/dmesg.boot
|
|
|
|
fi
|
1999-01-06 06:41:44 +03:00
|
|
|
|
1999-04-13 11:40:53 +04:00
|
|
|
if checkyesno wscons && [ -f /etc/rc.wscons ]; then
|
|
|
|
echo 'configuring wscons'
|
|
|
|
/bin/sh /etc/rc.wscons $wscons_flags
|
|
|
|
fi
|
|
|
|
|
1997-07-15 15:19:20 +04:00
|
|
|
# start the system logger first, so that all messages from daemons
|
|
|
|
# are logged, then start savecore to get a dump on low memory systems
|
|
|
|
# and then start the name server.
|
1997-01-05 15:01:54 +03:00
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno syslogd; then
|
1997-01-05 15:01:54 +03:00
|
|
|
echo 'starting system logger'
|
1999-03-19 03:35:44 +03:00
|
|
|
# Transitional symlink for old binaries
|
|
|
|
if [ ! -h /dev/log ] ; then
|
|
|
|
ln -sf /var/run/log /dev/log
|
|
|
|
fi
|
|
|
|
rm -f /var/run/log
|
1997-01-05 15:01:54 +03:00
|
|
|
syslogd $syslogd_flags
|
|
|
|
fi
|
|
|
|
|
1997-10-07 16:11:48 +04:00
|
|
|
# Enable ipmon (only useful if ipfilter is running)
|
|
|
|
# NOTE: requires the IPFILTER_LOG kernel option.
|
|
|
|
if checkyesno ipmon; then
|
|
|
|
echo 'starting ipmon'
|
|
|
|
ipmon $ipmon_flags &
|
|
|
|
fi
|
|
|
|
|
1997-07-15 15:19:20 +04:00
|
|
|
# /var/crash should be a directory or a symbolic link
|
|
|
|
# to the crash directory if core dumps are to be saved.
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno savecore; then
|
1998-11-21 06:00:38 +03:00
|
|
|
if [ -d /var/crash/. ]; then
|
1997-08-29 06:24:04 +04:00
|
|
|
echo checking for core dump...
|
|
|
|
savecore $savecore_flags /var/crash
|
|
|
|
else
|
|
|
|
logger -s "WARNING: no /var/crash directory; savecore not run."
|
1997-07-15 15:19:20 +04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno named; then
|
1997-01-05 15:01:54 +03:00
|
|
|
echo 'starting name server'; named $named_flags
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
# set time, if requested
|
|
|
|
if checkyesno ntpdate; then
|
1997-09-08 06:34:44 +04:00
|
|
|
if [ -z "$ntpdate_hosts" ]; then
|
1998-02-23 08:20:52 +03:00
|
|
|
ntpdate_hosts=`awk '
|
|
|
|
/^server[ \t]*127.127/ {next}
|
1999-02-07 03:47:08 +03:00
|
|
|
/^(server|peer)/ {print $2}
|
1998-02-23 08:20:52 +03:00
|
|
|
' </etc/ntp.conf`
|
1997-08-29 06:24:04 +04:00
|
|
|
fi
|
|
|
|
if [ -n "$ntpdate_hosts" ]; then
|
|
|
|
echo 'Setting date via ntp.'
|
1998-02-24 03:24:45 +03:00
|
|
|
ntpdate -b -s $ntpdate_hosts
|
1997-08-29 06:24:04 +04:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1997-07-15 15:19:20 +04:00
|
|
|
# now start the rpc servers, for YP server/client.
|
1997-01-05 15:01:54 +03:00
|
|
|
echo -n 'starting rpc daemons:'
|
|
|
|
|
|
|
|
# note that portmap is generally required for all other rpc services.
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno portmap; then
|
1999-01-12 00:04:38 +03:00
|
|
|
echo -n ' portmap'; portmap $portmap_flags
|
1997-01-05 15:01:54 +03:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno ypserv; then
|
1999-11-23 18:12:43 +03:00
|
|
|
checkyesno portmap || \
|
|
|
|
logger -s "WARNING: set portmap=YES in /etc/rc.conf if ypserv=YES."
|
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
echo -n ' ypserv'; ypserv $ypserv_flags
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno ypbind; then
|
1997-01-05 15:01:54 +03:00
|
|
|
echo -n ' ypbind'; ypbind $ypbind_flags
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno yppasswdd; then
|
1999-11-23 18:12:43 +03:00
|
|
|
checkyesno ypserv || \
|
|
|
|
logger -s "WARNING: set ypserv=YES in /etc/rc.conf if yppasswdd=YES."
|
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
echo -n ' rpc.yppasswdd'; rpc.yppasswdd $yppasswdd_flags
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno bootparamd; then
|
|
|
|
if [ -r /etc/bootparams ]; then
|
|
|
|
echo -n ' rpc.bootparamd'; rpc.bootparamd $bootparamd_flags
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/bootparams not found. " \
|
|
|
|
"bootparamd not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1997-01-05 15:01:54 +03:00
|
|
|
fi
|
|
|
|
|
1997-07-15 15:19:20 +04:00
|
|
|
echo '.'
|
|
|
|
|
|
|
|
# load kernel modules specified in /etc/lkm.conf
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno lkm; then
|
|
|
|
if [ -r /etc/rc.lkm ]; then
|
|
|
|
lkmstage=BEFOREMOUNT
|
|
|
|
. /etc/rc.lkm
|
|
|
|
else
|
|
|
|
logger -s "WARNING: /etc/rc.lkm not found; LKMs not loaded."
|
|
|
|
fi
|
1997-07-15 15:19:20 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
mount -a
|
|
|
|
|
|
|
|
# now start the rpc servers, for NFS server/client.
|
1999-10-05 14:32:56 +04:00
|
|
|
if checkyesno nfs_client || checkyesno nfs_server; then
|
|
|
|
echo -n 'starting nfs daemons:'
|
|
|
|
|
1999-11-23 18:12:43 +03:00
|
|
|
if checkyesno nfs_server && ! checkyesno portmap; then
|
|
|
|
logger -s "WARNING: set portmap=YES in /etc/rc.conf if nfs_server=YES."
|
|
|
|
fi
|
|
|
|
|
1999-10-05 14:32:56 +04:00
|
|
|
nfs_locking=NO
|
|
|
|
|
|
|
|
if checkyesno nfs_server; then
|
|
|
|
if [ -r /etc/exports ]; then
|
|
|
|
rm -f /var/db/mountdtab
|
|
|
|
echo -n > /var/db/mountdtab
|
|
|
|
echo -n ' mountd'; mountd $mountd_flags
|
|
|
|
echo -n ' nfsd'; nfsd $nfsd_flags
|
|
|
|
nfs_locking=YES
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/exports not readable; " \
|
|
|
|
"NFS server not started."
|
|
|
|
fi
|
|
|
|
fi
|
1997-03-10 12:16:13 +03:00
|
|
|
|
1999-10-05 14:32:56 +04:00
|
|
|
if checkyesno nfs_client; then
|
|
|
|
echo -n ' nfsiod'; nfsiod $nfsiod_flags
|
1998-01-26 15:02:43 +03:00
|
|
|
nfs_locking=YES
|
1997-01-05 15:01:54 +03:00
|
|
|
fi
|
|
|
|
|
1999-10-05 14:32:56 +04:00
|
|
|
if checkyesno nfs_locking; then
|
|
|
|
if checkyesno statd; then
|
|
|
|
echo -n ' rpc.statd'; rpc.statd $statd_flags
|
|
|
|
fi
|
|
|
|
if checkyesno lockd; then
|
|
|
|
echo -n ' rpc.lockd'; rpc.lockd $lockd_flags
|
|
|
|
fi
|
1997-03-10 09:32:37 +03:00
|
|
|
fi
|
|
|
|
|
1999-10-05 14:32:56 +04:00
|
|
|
if checkyesno amd; then
|
|
|
|
if [ -d "$amd_dir" ]; then
|
|
|
|
if [ -r "$amd_master" ]; then
|
|
|
|
echo -n ' amd'
|
|
|
|
amd $amd_flags -p -a $amd_dir \
|
|
|
|
`sed s/#.*$// <$amd_master` >/var/run/amd.pid
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: \$amd_master ($amd_master)not " \
|
|
|
|
"readable; amd not started."
|
|
|
|
fi
|
1997-08-29 06:24:04 +04:00
|
|
|
else
|
|
|
|
echo
|
1999-10-05 14:32:56 +04:00
|
|
|
logger -s "WARNING: \$amd_dir ($amd_dir) not a directory; " \
|
|
|
|
"amd not started."
|
1997-08-29 06:24:04 +04:00
|
|
|
fi
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1999-10-05 14:32:56 +04:00
|
|
|
echo '.'
|
1993-03-21 12:45:37 +03:00
|
|
|
fi
|
1997-01-05 15:01:54 +03:00
|
|
|
|
1997-07-14 15:55:44 +04:00
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
if [ -f /sbin/ldconfig ]; then
|
|
|
|
echo 'creating runtime link editor directory cache.'
|
1997-08-26 23:35:33 +04:00
|
|
|
ldconfig
|
1997-01-05 15:01:54 +03:00
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-07-14 15:55:44 +04:00
|
|
|
# load kernel modules specified in /etc/lkm.conf
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno lkm && [ -f /etc/rc.lkm ]; then
|
1997-07-14 15:55:44 +04:00
|
|
|
lkmstage=AFTERMOUNT
|
|
|
|
. /etc/rc.lkm
|
|
|
|
fi
|
|
|
|
|
1999-09-28 18:53:17 +04:00
|
|
|
# if $defcorename is set, change it here.
|
|
|
|
if [ -n "$defcorename" ]; then
|
|
|
|
echo -n 'setting default core name template: '
|
|
|
|
sysctl -w kern.defcorename=$defcorename
|
|
|
|
fi
|
|
|
|
|
1999-01-31 11:46:58 +03:00
|
|
|
# if $securelevel is set, change it here, else if it is 0, change
|
|
|
|
# it to 1 here, before we start login services.
|
1999-02-01 03:34:25 +03:00
|
|
|
if [ -n "$securelevel" ]; then
|
1999-01-31 11:46:58 +03:00
|
|
|
echo -n 'setting securelevel: '
|
|
|
|
sysctl -w kern.securelevel=$securelevel
|
|
|
|
else
|
1999-02-07 17:56:01 +03:00
|
|
|
securelevel=`sysctl -n kern.securelevel`
|
1999-01-31 11:46:58 +03:00
|
|
|
if [ x"$securelevel" = x0 ]; then
|
|
|
|
echo -n 'setting securelevel: '
|
|
|
|
sysctl -w kern.securelevel=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
echo -n 'checking quotas:'; quotacheck -a; echo ' done.'
|
1994-06-28 01:14:19 +04:00
|
|
|
quotaon -a
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
chmod 666 /dev/tty[pqrs]*
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
1999-01-31 11:46:58 +03:00
|
|
|
# XXX replace me with a script that works!
|
1997-07-31 07:35:39 +04:00
|
|
|
virecovery=`echo /var/tmp/vi.recover/recover.*`
|
1994-01-30 20:15:52 +03:00
|
|
|
if [ "$virecovery" != "/var/tmp/vi.recover/recover.*" ]; then
|
|
|
|
echo preserving editor files
|
|
|
|
for i in $virecovery; do
|
1999-08-28 07:39:59 +04:00
|
|
|
if [ -f $i ]; then
|
|
|
|
sendmail -t < $i
|
|
|
|
fi
|
1994-01-30 20:15:52 +03:00
|
|
|
done
|
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
echo clearing /tmp
|
|
|
|
|
1997-02-15 13:02:07 +03:00
|
|
|
# Prune quickly with one rm, then use find to clean up /tmp/[lq]* (this
|
|
|
|
# is not needed with mfs /tmp, but doesn't hurt anything).
|
1993-03-21 12:45:37 +03:00
|
|
|
(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
|
1994-06-24 11:51:59 +04:00
|
|
|
find . ! -name . ! -name lost+found ! -name quota.user \
|
|
|
|
! -name quota.group -exec rm -rf -- {} \; -type d -prune)
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1997-04-23 05:24:22 +04:00
|
|
|
# Update kernel info in /etc/motd
|
|
|
|
# Must be done *before* interactive logins are possible to prevent
|
|
|
|
# possible race conditions.
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno update_motd; then
|
1997-04-23 05:24:22 +04:00
|
|
|
echo 'updating motd.'
|
|
|
|
if [ ! -f /etc/motd ]; then
|
|
|
|
install -c -o root -g wheel -m 664 /dev/null /etc/motd
|
|
|
|
fi
|
1999-08-06 00:51:57 +04:00
|
|
|
T=/etc/_motd
|
1997-04-23 05:24:22 +04:00
|
|
|
rm -f $T
|
|
|
|
sysctl -n kern.version | sed 1q > $T
|
|
|
|
echo "" >> $T
|
|
|
|
sed '1,/^$/d' < /etc/motd >> $T
|
|
|
|
cmp -s $T /etc/motd || cp $T /etc/motd
|
|
|
|
rm -f $T
|
|
|
|
fi
|
|
|
|
|
1999-11-23 11:05:04 +03:00
|
|
|
if checkyesno accounting; then
|
|
|
|
if [ -f /var/account/acct ]; then
|
|
|
|
echo 'turning on accounting'
|
|
|
|
accton /var/account/acct
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /var/account/acct doesn't exist; " \
|
|
|
|
"accounting not enabled."
|
|
|
|
fi
|
1994-02-26 06:29:23 +03:00
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
echo -n standard daemons:
|
1999-01-12 07:58:37 +03:00
|
|
|
if checkyesno cron; then
|
|
|
|
echo -n ' cron'; cron
|
|
|
|
fi
|
1993-03-21 12:45:37 +03:00
|
|
|
echo '.'
|
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
# now start all the other daemons
|
1993-03-21 12:45:37 +03:00
|
|
|
echo -n starting network daemons:
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno gated && checkyesno routed; then
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: gated and routed both requested to be run: " \
|
|
|
|
"running only gated."
|
|
|
|
routed=NO
|
|
|
|
fi
|
|
|
|
|
|
|
|
if checkyesno gated; then
|
|
|
|
if [ -r /etc/gated.conf ]; then
|
|
|
|
echo -n ' gated'; gated $gated_flags
|
|
|
|
else
|
|
|
|
logger -s "WARNING: no /etc/gated.conf; gated not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1997-08-29 06:24:04 +04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if checkyesno routed; then
|
1994-09-17 03:38:01 +04:00
|
|
|
echo -n ' routed'; routed $routed_flags
|
1993-03-21 12:45:37 +03:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno mrouted; then
|
1995-12-30 04:30:03 +03:00
|
|
|
echo -n ' mrouted'; mrouted $mrouted_flags
|
|
|
|
fi
|
|
|
|
|
1999-07-03 07:29:29 +04:00
|
|
|
if checkyesno route6d; then
|
|
|
|
echo -n ' route6d'; route6d $route6d_flags
|
|
|
|
fi
|
|
|
|
|
1999-09-03 17:40:15 +04:00
|
|
|
if checkyesno rtsold; then
|
|
|
|
if checkyesno ip6forwarding; then
|
|
|
|
logger -s "WARNING: rtsold cannot be used on IPv6 router."
|
|
|
|
else
|
|
|
|
echo -n ' rtsold'; rtsold $rtsold_flags
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
1999-07-03 07:29:29 +04:00
|
|
|
if checkyesno rtadvd; then
|
1999-09-03 17:40:15 +04:00
|
|
|
if checkyesno ip6forwarding; then
|
|
|
|
echo -n ' rtadvd'; rtadvd $rtadvd_flags
|
|
|
|
else
|
|
|
|
logger -s "WARNING: rtadvd cannot be used on IPv6 host."
|
|
|
|
fi
|
1999-07-03 07:29:29 +04:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno timed; then
|
1997-03-10 12:16:13 +03:00
|
|
|
echo -n ' timed'; timed $timed_flags
|
1994-01-10 19:57:24 +03:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno xntpd; then
|
1997-03-10 12:16:13 +03:00
|
|
|
echo -n ' xntpd'; xntpd $xntpd_flags
|
1996-08-26 10:02:21 +04:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno dhcpd; then
|
|
|
|
if [ -r /etc/dhcpd.conf ]; then
|
|
|
|
echo -n ' dhcpd'; dhcpd $dhcpd_flags
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/dhcpd.conf not readable; " \
|
|
|
|
"dhcpd not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1999-03-26 16:10:17 +03:00
|
|
|
elif checkyesno dhcrelay; then
|
|
|
|
echo -n ' dhcrelay'; dhcrelay $dhcrelay_flags
|
1994-01-10 19:57:24 +03:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno rwhod; then
|
1997-01-05 15:01:54 +03:00
|
|
|
echo -n ' rwhod'; rwhod
|
1996-08-26 10:02:21 +04:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno lpd; then
|
|
|
|
echo -n ' lpd'; lpd $lpd_flags
|
1996-08-26 10:02:21 +04:00
|
|
|
fi
|
|
|
|
|
1997-01-05 15:01:54 +03:00
|
|
|
# We call sendmail with a full path so that SIGHUP works.
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno sendmail; then
|
|
|
|
if [ -r /etc/sendmail.cf ]; then
|
|
|
|
echo -n ' sendmail'; /usr/sbin/sendmail $sendmail_flags
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/sendmail.cf not readable; " \
|
|
|
|
"sendmail not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1996-08-26 10:02:21 +04:00
|
|
|
fi
|
|
|
|
|
1997-11-11 05:28:58 +03:00
|
|
|
# Start xfs before boot daemons, so its ready before client xterminals.
|
|
|
|
if checkyesno xfs; then
|
|
|
|
echo -n ' xfs'; xfs $xfs_flags &
|
1998-01-10 00:57:17 +03:00
|
|
|
sleep 2
|
1997-11-11 05:28:58 +03:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno rarpd; then
|
|
|
|
if [ -r /etc/ethers ]; then
|
|
|
|
echo -n ' rarpd'; rarpd $rarpd_flags
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/ethers not readable; " \
|
|
|
|
"rarpd not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1996-08-26 10:02:21 +04:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno rbootd; then
|
|
|
|
if [ -r /etc/rbootd.conf ]; then
|
|
|
|
echo -n ' rbootd'; rbootd $rbootd_flags
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/rbootd.conf not readable; " \
|
1999-01-12 15:42:46 +03:00
|
|
|
"rbootd not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1996-08-26 10:02:21 +04:00
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno mopd; then
|
1997-03-17 03:02:02 +03:00
|
|
|
echo -n ' mopd'; mopd $mopd_flags
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno apmd; then
|
1997-08-04 02:24:20 +04:00
|
|
|
echo -n ' apmd'; apmd $apmd_flags
|
|
|
|
fi
|
|
|
|
|
1998-04-07 08:47:33 +04:00
|
|
|
if checkyesno screenblank; then
|
|
|
|
echo -n ' screenblank'; screenblank $screenblank_flags
|
|
|
|
fi
|
|
|
|
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno inetd; then
|
|
|
|
if [ -r /etc/inetd.conf ]; then
|
|
|
|
echo -n ' inetd'; inetd $inetd_flags
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
logger -s "WARNING: /etc/inetd.conf not readable; " \
|
|
|
|
"inetd not started."
|
1997-03-10 12:16:13 +03:00
|
|
|
fi
|
1995-09-02 21:30:41 +04:00
|
|
|
fi
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
echo '.'
|
|
|
|
|
1997-04-19 07:10:57 +04:00
|
|
|
# Kerberos runs ONLY on the Kerberos server machine
|
1997-08-29 06:24:04 +04:00
|
|
|
if checkyesno kerberos; then
|
1997-04-19 07:10:57 +04:00
|
|
|
echo -n 'starting kerberos daemons:'
|
|
|
|
echo -n ' kerberos'; kerberos >> /var/log/kerberos.log &
|
|
|
|
echo -n ' kadmind'; kadmind -n >> /var/log/kadmind.log &
|
|
|
|
echo '.'
|
|
|
|
fi
|
|
|
|
|
1999-03-26 16:45:47 +03:00
|
|
|
# xdm after wscons - need a virtual screen for X
|
|
|
|
if checkyesno xdm; then
|
|
|
|
echo 'starting xdm'
|
|
|
|
xdm $xdm_flags
|
|
|
|
fi
|
|
|
|
|
1993-12-15 10:24:31 +03:00
|
|
|
. /etc/rc.local
|
1993-03-21 12:45:37 +03:00
|
|
|
|
|
|
|
date
|
|
|
|
exit 0
|