diff options
author | obrien <obrien@FreeBSD.org> | 2001-06-22 17:27:58 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-06-22 17:27:58 +0000 |
commit | 5f2fdd1aa5cb8f249ef7ceac16b22990263464ef (patch) | |
tree | 84dfa4f919fc4317018c26a739470987134544fe /etc | |
parent | afad76ee76d3a58cf84a1bc6fb12c55552bc5563 (diff) | |
download | FreeBSD-src-5f2fdd1aa5cb8f249ef7ceac16b22990263464ef.zip FreeBSD-src-5f2fdd1aa5cb8f249ef7ceac16b22990263464ef.tar.gz |
Import the NetBSD 1.5 RC system on a vendor branch.
Diffstat (limited to 'etc')
-rw-r--r-- | etc/rc | 189 | ||||
-rw-r--r-- | etc/rc.shutdown | 44 |
2 files changed, 57 insertions, 176 deletions
@@ -1,174 +1,43 @@ -# @(#)rc 5.27 (Berkeley) 6/5/91 +#!/bin/sh +# +# $NetBSD: rc,v 1.152 2000/04/22 03:01:22 lukem Exp $ +# +# rc.sh -- +# Run the scripts in /etc/rc.d with rcorder. -# 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. +# 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' -# yellow characters with blue background -echo -n "[3;30x" - -# 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 - -HOME=/; export HOME -PATH=/sbin:/bin:/usr/sbin:/usr/bin -export PATH - -if [ -r /fastboot ] -then - echo Fast boot ... skipping disk checks -elif [ $1x = autobootx ] -then - echo Automatic reboot in progress... - fsck -p - case $? in - 0) - ;; - 2) - exit 1 - ;; - 4) - reboot - echo "reboot failed... help!" - exit 1 - ;; - 8) - echo "Automatic file system check failed... help!" - exit 1 - ;; - 12) - echo "Reboot interrupted" - exit 1 - ;; - 130) - # interrupt before catcher installed - exit 1 - ;; - *) - echo "Unknown error in reboot" - exit 1 - ;; - esac -fi - -trap "echo 'Reboot interrupted'; exit 1" 3 - -swapon -a - -umount -a >/dev/null 2>&1 -mount -a -t nonfs -rm -f /fastboot # XXX (root now writeable) - -# set hostname, turn on network -echo 'starting network' -. /etc/netstart - -mount -a -t nfs >/dev/null 2>&1 & # XXX shouldn't need background - -# clean up left-over files -rm -f /etc/nologin -rm -f /var/spool/uucp/LCK.* -rm -f /var/spool/uucp/STST/* -(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; }) - -echo -n 'starting system logger' -rm -f /dev/log -syslogd - -# $timedflags is imported from /etc/netstart; -# if $timedflags == NO, timed isn't run. -if [ X${timedflags} != X"NO" ]; then - echo -n ', time daemon'; timed $timedflags -fi -echo '.' - -# /var/crash should be a directory or a symbolic link -# to the crash directory if core dumps are to be saved. -if [ -d /var/crash ]; then - echo checking for core dump... - savecore /var/crash -fi +export HOME=/ +export PATH=/sbin:/bin:/usr/sbin:/usr/bin -# echo -n 'checking quotas:' -#quotacheck -a -# echo ' done.' -#quotaon -a +. /etc/rc.subr +. /etc/rc.conf -# build ps databases -kvm_mkdb /386bsd -dev_mkdb - -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' +if ! checkyesno rc_configured; then + echo "/etc/rc.conf is not configured. Multiuser boot aborted." + exit 1 fi -echo preserving editor files -(cd /var/tmp && /usr/libexec/elvispreserve "-the system rebooted" elvis* && - rm -f elvis[0-9a-f][0-9a-f][0-9a-f][0-9a-f]* \ - elvis_[0-9a-f][0-9a-f][0-9a-f][0-9a-f]*) - -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 . ! -name . ! -name lost+found ! -name quotas -exec rm -rf -- {} \;) - -# echo 'turning on accounting'; accton /var/account/acct - -echo -n standard daemons: -echo -n ' update'; update -echo -n ' crond'; /usr/libexec/crond -echo '.' - -echo -n starting network daemons: - -# $gated and $routedflags are imported from /etc/netstart. -# 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 +if [ "$1" = autoboot ]; then + autoboot=yes + _rc_fast_run=yes # run_rc_command(): do fast booting fi -if [ X${name_server} = X"YES" -a -r /etc/named.boot ]; then - echo -n ' named'; named -fi - -# $rwhod is imported from /etc/netstart; -# if $rwhod is set to something other than NO, rwhod is run. -if [ ${rwhod-NO} != "NO" ]; then - echo -n ' rwhod'; rwhod -fi - -echo -n ' printer'; lpd - +stty status '^T' -if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then - echo -n ' portmap'; portmap - echo -n ' mountd'; mountd - echo -n ' nfsd'; nfsd -u 0,0,4 -t 0,0 - echo -n ' nfsiod'; nfsiod 4 -fi +# Set shell to ignore SIGINT (2), but not children; +# shell catches SIGQUIT (3) and returns to single user. +# +trap : 2 +trap "echo 'Boot interrupted.'; exit 1" 3 -echo -n ' sendmail'; sendmail -bd -q30m -echo -n ' inetd'; inetd -echo '.' +files=`rcorder -s nostart /etc/rc.d/*` -sh /etc/rc.local +for i in $files; do + run_rc_script $i start +done date - -# reset to normal (no colors) -echo -n "[0x" exit 0 diff --git a/etc/rc.shutdown b/etc/rc.shutdown index f935834..bccf836 100644 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -1,26 +1,38 @@ #!/bin/sh -# $Id$ +# +# $NetBSD: rc.shutdown,v 1.3 2000/03/10 13:17:25 lukem Exp $ +# +# rc.shutdown.sh -- +# Run the scripts in /etc/rc.d with reverse rcorder. -# site-specific closing actions for daemons run by init on shutdown -# or before going single-user from multi-user. -# Output and errors are directed to console by init, and the -# console is the controlling terminal. +export HOME=/ +export PATH=/sbin:/bin:/usr/sbin:/usr/bin -stty status '^T' +. /etc/rc.subr +. /etc/rc.conf -# 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 +if ! checkyesno do_rcshutdown; then + echo "Skipping shutdown hooks." + exit 0 +fi -HOME=/; export HOME -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin -export PATH +stty status '^T' -echo -n Shutting down daemon processes: +# Set shell to ignore SIGINT (2), but not children; +# shell catches SIGQUIT (3) and returns to single user. +# +trap : 2 +trap "echo 'Shutdown interrupted.'; exit 1" 3 -# Insert shutdown procedures here +files=`rcorder -k shutdown /etc/rc.d/*` +for i in $files; do # reverse order of files + nfiles="$i $nfiles" +done +files=$nfiles +for i in $files; do + run_rc_script $i stop +done -echo '.' +date exit 0 |