[BACK]Return to rc CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/rc, Revision 1.245

1.245   ! deraadt     1: #      $OpenBSD: rc,v 1.244 2004/04/27 22:51:28 markus Exp $
1.1       deraadt     2:
                      3: # System startup script run by init on autoboot
                      4: # or after single-user.
                      5: # Output and error are redirected to console by init,
                      6: # and the console is the controlling terminal.
                      7:
1.131     millert     8: # Subroutines (have to come first).
                      9:
                     10: # Strip comments (and leading/trailing whitespace if IFS is set)
                     11: # from a file and spew to stdout
                     12: stripcom() {
                     13:        local _file="$1"
                     14:        local _line
                     15:
                     16:        {
                     17:                while read _line ; do
                     18:                        _line=${_line%%#*}              # strip comments
                     19:                        test -z "$_line" && continue
                     20:                        echo $_line
                     21:                done
                     22:        } < $_file
                     23: }
                     24:
                     25: # End subroutines
                     26:
1.1       deraadt    27: stty status '^T'
                     28:
                     29: # Set shell to ignore SIGINT (2), but not children;
                     30: # shell catches SIGQUIT (3) and returns to single user after fsck.
                     31: trap : 2
                     32: trap : 3       # shouldn't be needed
                     33:
                     34: HOME=/; export HOME
                     35: PATH=/sbin:/bin:/usr/sbin:/usr/bin
                     36: export PATH
1.108     deraadt    37:
                     38: if [ $1x = shutdownx ]; then
                     39:        dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 >/dev/null 2>&1
                     40:        chmod 600 /var/db/host.random >/dev/null 2>&1
                     41:        if [ $? -eq 0 -a -f /etc/rc.shutdown ]; then
                     42:                echo /etc/rc.shutdown in progress...
                     43:                . /etc/rc.shutdown
                     44:                echo /etc/rc.shutdown complete.
                     45:                if [ "X${powerdown}" = X"YES" ]; then
                     46:                        exit 2
                     47:                fi
1.240     mcbride    48:
                     49:                # bring carp interfaces down gracefully
                     50:                for hn in /etc/hostname.carp[0-9]*; do
                     51:                        # Strip off /etc/hostname. prefix
                     52:                        if=${hn#/etc/hostname.}
1.241     cedric     53:                        test "$if" = "carp[0-9]*" && continue
1.240     mcbride    54:
1.243     deraadt    55:                        ifconfig $if > /dev/null 2>&1
                     56:                        if [ "$?" != "0" ]; then
                     57:                                ifconfig $if down
                     58:                        fi
1.240     mcbride    59:                done
1.108     deraadt    60:        else
                     61:                echo single user: not running /etc/rc.shutdown
                     62:        fi
                     63:        exit 0
                     64: fi
1.1       deraadt    65:
                     66: # Configure ccd devices.
1.17      deraadt    67: if [ -f /etc/ccd.conf ]; then
1.1       deraadt    68:        ccdconfig -C
                     69: fi
1.98      jakob      70:
                     71: # Configure raid devices.
                     72: for dev in 0 1 2 3; do
                     73:        if [ -f /etc/raid$dev.conf ]; then
                     74:                raidctl -c /etc/raid$dev.conf raid$dev
                     75:        fi
                     76: done
1.190     tdeval     77:
                     78: # Check parity on raid devices.
1.191     deraadt    79: raidctl -P all
1.1       deraadt    80:
1.172     miod       81: swapctl -A -t blk
1.170     deraadt    82:
1.17      deraadt    83: if [ -e /fastboot ]; then
1.1       deraadt    84:        echo "Fast boot: skipping disk checks."
1.17      deraadt    85: elif [ $1x = autobootx ]; then
1.1       deraadt    86:        echo "Automatic boot in progress: starting file system checks."
1.31      millert    87:        fsck -p
1.1       deraadt    88:        case $? in
                     89:        0)
                     90:                ;;
                     91:        2)
                     92:                exit 1
                     93:                ;;
                     94:        4)
                     95:                echo "Rebooting..."
                     96:                reboot
                     97:                echo "Reboot failed; help!"
                     98:                exit 1
                     99:                ;;
                    100:        8)
                    101:                echo "Automatic file system check failed; help!"
                    102:                exit 1
                    103:                ;;
                    104:        12)
                    105:                echo "Boot interrupted."
                    106:                exit 1
                    107:                ;;
                    108:        130)
                    109:                # interrupt before catcher installed
                    110:                exit 1
                    111:                ;;
                    112:        *)
                    113:                echo "Unknown error; help!"
                    114:                exit 1
                    115:                ;;
                    116:        esac
                    117: fi
                    118:
                    119: trap "echo 'Boot interrupted.'; exit 1" 3
                    120:
                    121: umount -a >/dev/null 2>&1
                    122: mount -a -t nonfs
1.57      niklas    123: mount -uw /            # root on nfs requires this, others aren't hurt
1.1       deraadt   124: rm -f /fastboot                # XXX (root now writeable)
1.177     deraadt   125:
                    126: # pick up option configuration
                    127: . /etc/rc.conf
1.1       deraadt   128:
                    129: # set flags on ttys.  (do early, in case they use tty for SLIP in netstart)
                    130: echo 'setting tty flags'
                    131: ttyflags -a
1.77      angelos   132:
1.186     deraadt   133: if [ "X${pf}" != X"NO" ]; then
1.211     mcbride   134:        RULES="block all"
1.228     henning   135:        RULES="$RULES\npass on lo0"
1.195     dhartmei  136:        RULES="$RULES\npass in proto tcp from any to any port 22 keep state"
1.208     camield   137:        RULES="$RULES\npass out proto { tcp, udp } from any to any port 53 keep state"
1.215     camield   138:        RULES="$RULES\npass out inet proto icmp all icmp-type echoreq keep state"
1.240     mcbride   139:        RULES="$RULES\npass proto { pfsync, carp }"
1.193     deraadt   140:        case `sysctl vfs.mounts.nfs 2>/dev/null` in
1.184     deraadt   141:        *[1-9]*)
                    142:                # don't kill NFS
1.218     cedric    143:                RULES="scrub in all no-df\n$RULES"
1.184     deraadt   144:                RULES="$RULES\npass in proto udp from any port { 111, 2049 } to any"
                    145:                RULES="$RULES\npass out proto udp from any to any port { 111, 2049 }"
                    146:                ;;
                    147:        esac
1.198     dhartmei  148:        echo $RULES | pfctl -f - -e
1.176     kjell     149: fi
                    150:
1.126     deraadt   151: if [ -f /etc/sysctl.conf ]; then
                    152: (
                    153:        # delete comments and blank lines
1.131     millert   154:        set -- `stripcom /etc/sysctl.conf`
1.126     deraadt   155:        while [ $# -ge 1 ] ; do
1.234     jmc       156:                sysctl $1
1.129     millert   157:                shift
1.126     deraadt   158:        done
                    159: )
                    160: fi
                    161:
1.1       deraadt   162: # set hostname, turn on network
                    163: echo 'starting network'
                    164: . /etc/netstart
1.176     kjell     165:
1.186     deraadt   166: if [ "X${pf}" != X"NO" ]; then
1.176     kjell     167:        if [ -f ${pf_rules} ]; then
1.198     dhartmei  168:                pfctl -f ${pf_rules}
1.176     kjell     169:        fi
                    170: fi
1.1       deraadt   171:
                    172: mount /usr >/dev/null 2>&1
                    173: mount /var >/dev/null 2>&1
1.180     deraadt   174:
1.149     deraadt   175: # if there's no /var/db/host.random, make one through /dev/urandom
                    176: if [ ! -f /var/db/host.random ]; then
                    177:        dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
                    178:                >/dev/null 2>&1
                    179:        chmod 600 /var/db/host.random >/dev/null 2>&1
                    180: else
                    181:        dd if=/var/db/host.random of=/dev/urandom bs=1024 count=64 \
                    182:            > /dev/null 2>&1
                    183:        dd if=/var/db/host.random of=/dev/arandom bs=1024 count=64 \
                    184:            > /dev/null 2>&1
                    185: fi
1.157     deraadt   186:
                    187: # reset seed file, so that if a shutdown-less reboot occurs,
                    188: # the next seed is not a repeat
                    189: dd if=/dev/urandom of=/var/db/host.random bs=1024 count=64 \
                    190:     > /dev/null 2>&1
1.29      deraadt   191:
1.55      deraadt   192: # clean up left-over files
                    193: rm -f /etc/nologin
                    194: rm -f /var/spool/lock/LCK.*
                    195: rm -f /var/spool/uucp/STST/*
1.192     millert   196: (cd /var/run && { test -r dhclient.pid && dhclient_pid=`cat dhclient.pid`; rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; test -n "$dhclient_pid" && echo "$dhclient_pid" > dhclient.pid; })
1.196     beck      197: (cd /var/authpf && rm -rf -- *)
                    198:
1.96      alex      199:
                    200: # save a copy of the boot messages
                    201: dmesg >/var/run/dmesg.boot
1.55      deraadt   202:
1.58      deraadt   203: echo 'starting system logger'
                    204: rm -f /dev/log
1.220     jakob     205: if [ "X${named_flags}" != X"NO" ]; then
                    206:        rm -f /var/named/dev/log
                    207:        syslogd_flags="${syslogd_flags} -a /var/named/dev/log"
1.216     millert   208: fi
                    209: if [ -d /var/empty ]; then
                    210:        rm -f /var/empty/dev/log
                    211:        mkdir -p -m 0555 /var/empty/dev
                    212:        syslogd_flags="${syslogd_flags} -a /var/empty/dev/log"
1.74      millert   213: fi
1.65      marc      214: syslogd ${syslogd_flags}
1.184     deraadt   215:
1.186     deraadt   216: if [ X"${pf}" != X"NO" -a X"${pflogd_flags}" != X"NO" ]; then
1.184     deraadt   217:        ifconfig pflog0 up
                    218:        pflogd ${pflogd_flags}
1.217     jakob     219: fi
                    220:
1.224     todd      221: # $named_flags is imported from /etc/rc.conf;
1.54      deraadt   222: # if $named_flags != NO, named is run.
                    223: if [ "X${named_flags}" != X"NO" ]; then
1.221     jakob     224:        if ! cmp -s /etc/rndc.key /var/named/etc/rndc.key ; then
                    225:                echo -n "rndc-confgen: generating new shared secret... "
                    226:                if /usr/sbin/rndc-confgen -a -t /var/named >/dev/null 2>&1; then
                    227:                        chmod 0640 /var/named/etc/rndc.key >/dev/null 2>&1
                    228:                        echo done.
                    229:                else
                    230:                        echo failed.
                    231:                fi
                    232:        fi
                    233:
1.58      deraadt   234:        echo 'starting named';          named $named_flags
1.94      deraadt   235: fi
                    236:
                    237: # $isakmpd_flags is imported from /etc/rc.conf;
1.185     angelos   238: # If $isakmpd_flags == NO or /etc/isakmpd/isakmpd.policy doesn't exist, then
1.94      deraadt   239: # isakmpd isn't run.
1.185     angelos   240: if [ "X${isakmpd_flags}" != X"NO" -a -e /etc/isakmpd/isakmpd.policy ]; then
1.94      deraadt   241:        echo 'starting isakmpd';        isakmpd ${isakmpd_flags}
1.40      provos    242: fi
1.1       deraadt   243:
                    244: echo -n 'starting rpc daemons:'
1.24      millert   245:
1.52      deraadt   246: # $portmap is imported from /etc/rc.conf;
1.24      millert   247: # if $portmap == YES, the portmapper is started.
                    248: if [ X"${portmap}" = X"YES" ]; then
1.23      deraadt   249:        echo -n ' portmap';             portmap
                    250: fi
1.1       deraadt   251:
1.174     deraadt   252: if [ -d /var/yp/binding -a X`domainname` != X ]; then
1.8       deraadt   253:        if [ -d /var/yp/`domainname` ]; then
                    254:                # yp server capabilities needed...
1.36      niklas    255:                echo -n ' ypserv';              ypserv ${ypserv_flags}
1.16      deraadt   256:                #echo -n ' ypxfrd';             ypxfrd
1.21      deraadt   257:        fi
                    258:
                    259:        echo -n ' ypbind';              ypbind
1.8       deraadt   260:
1.232     deraadt   261:        if [ X"${yppasswdd_flags}" != X"NO" -a -d /var/yp/`domainname` ]; then
1.8       deraadt   262:                # if we are the master server, run rpc.yppasswdd
                    263:                _host1=`ypwhich -m passwd 2> /dev/null`
                    264:                _host2=`hostname`
1.15      deraadt   265:                if [ `grep '^lookup' /etc/resolv.conf | grep yp | wc -c` -ne 0 ]; then
1.8       deraadt   266:                        _host1=`ypmatch $_host1 hosts | cut -d' ' -f2`
                    267:                        _host2=`ypmatch $_host2 hosts | cut -d' ' -f2 | head -1`
                    268:                else
                    269:                        _host1=`nslookup $_host1 | grep '^Name: ' | \
                    270:                            sed -e 's/^Name:    //'`
                    271:                        _host2=`nslookup $_host2 | grep '^Name: ' | \
                    272:                            sed -e 's/^Name:    //'`
                    273:                fi
1.13      deraadt   274:                if [ "$_host2" = "$_host1" ]; then
1.35      niklas    275:                        echo -n ' rpc.yppasswdd'
                    276:                        rpc.yppasswdd ${yppasswdd_flags}
1.8       deraadt   277:                fi
1.7       deraadt   278:        fi
1.1       deraadt   279: fi
                    280:
1.52      deraadt   281: # $nfs_server is imported from /etc/rc.conf;
1.1       deraadt   282: # if $nfs_server == YES, the machine is setup for being an nfs server
1.67      millert   283: if [ X${nfs_server} = X"YES" -a -s /etc/exports -a \
1.141     deraadt   284:     `sed -e '/^#/d' < /etc/exports | wc -l` -ne 0 ]; then
1.68      millert   285:        rm -f /var/db/mountdtab
1.1       deraadt   286:        echo -n > /var/db/mountdtab
                    287:        echo -n ' mountd';              mountd
1.42      niklas    288:        echo -n ' nfsd';                nfsd ${nfsd_flags}
                    289:        if [ X${lockd} = X"YES" ]; then
                    290:                echo -n ' rpc.lockd';   rpc.lockd
                    291:        fi
1.1       deraadt   292: fi
                    293:
1.165     deraadt   294: if [ X${amd} = X"YES" -a -e ${amd_master} ]; then
1.1       deraadt   295:        echo -n ' amd'
1.107     deraadt   296:        (cd /etc/amd; amd -l syslog -x error,noinfo,nostats -p \
                    297:            -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid )
1.146     matt      298: fi
                    299:
                    300: # run rdate before timed
1.148     millert   301: if [ X"${rdate_flags}" != X"NO" ]; then
1.230     deraadt   302:        echo -n ' rdate';       rdate -s ${rdate_flags}
1.1       deraadt   303: fi
                    304:
1.52      deraadt   305: # $timed_flags is imported from /etc/rc.conf;
1.1       deraadt   306: # if $timed_flags == NO, timed isn't run.
                    307: if [ "X${timed_flags}" != X"NO" ]; then
1.58      deraadt   308:        echo -n ' timed'; timed $timed_flags
1.1       deraadt   309: fi
                    310: echo '.'
1.58      deraadt   311:
                    312: mount -a -t nfs
1.172     miod      313:
                    314: swapctl -A -t noblk
1.1       deraadt   315:
                    316: # /var/crash should be a directory or a symbolic link
                    317: # to the crash directory if core dumps are to be saved.
                    318: if [ -d /var/crash ]; then
1.188     tholo     319:        savecore ${savecore_flags} /var/crash
1.1       deraadt   320: fi
                    321:
1.233     beck      322: if [ "X${afs}" = X"YES" -a -c /dev/xfs0 ]; then
1.90      art       323:        echo -n 'mounting afs:'
1.233     beck      324:        mkdir -p -m 0755 /afs
                    325:        mount -t xfs /dev/xfs0 /afs
1.245   ! deraadt   326:        /usr/libexec/afsd ${afsd_flags}
1.90      art       327:        echo ' done.'
                    328: fi
                    329:
1.41      downsj    330: if [ "X${check_quotas}" = X"YES" ]; then
                    331:        echo -n 'checking quotas:'
                    332:        quotacheck -a
                    333:        echo ' done.'
                    334:        quotaon -a
                    335: fi
1.1       deraadt   336:
                    337: # build ps databases
1.95      deraadt   338: echo -n 'building ps databases:'
                    339: echo -n " kvm"
1.88      millert   340: kvm_mkdb
1.95      deraadt   341: echo -n " dev"
1.1       deraadt   342: dev_mkdb
1.95      deraadt   343: echo "."
1.1       deraadt   344:
1.101     deraadt   345: chmod 666 /dev/tty[pqrstuvwxyzPQRST]*
1.226     millert   346: chown root:wheel /dev/tty[pqrstuvwxyzPQRST]*
1.1       deraadt   347:
                    348: # check the password temp/lock file
1.17      deraadt   349: if [ -f /etc/ptmp ]; then
1.1       deraadt   350:        logger -s -p auth.err \
                    351:        'password file may be incorrect -- /etc/ptmp exists'
1.32      deraadt   352: fi
                    353:
1.49      millert   354: echo clearing /tmp
                    355:
                    356: # prune quickly with one rm, then use find to clean up /tmp/[lq]*
                    357: # (not needed with mfs /tmp, but doesn't hurt there...)
                    358: (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
                    359:     find . ! -name . ! -name lost+found ! -name quota.user \
1.103     millert   360:        ! -name quota.group -execdir rm -rf -- {} \; -type d -prune)
1.49      millert   361:
1.203     hugh      362: # create Unix sockets directories  for X if needed and make sure they have
                    363: # correct permissions
1.210     henning   364: if [ -d /usr/X11R6/lib ]; then
1.203     hugh      365:        for d in /tmp/.X11-unix /tmp/.ICE-unix ; do
1.210     henning   366:                if [ -d $d ]; then
1.203     hugh      367:                        if [ `ls -ld $d | cut -d' ' -f4` != root ]; then
                    368:                                chown root $d
                    369:                        fi
                    370:                        if [ `ls -ld $d | cut -d' ' -f1` != drwxrwxrwt ]; then
                    371:                                chmod 1777 $d
                    372:                        fi
                    373:                elif [ -e $d ]; then
                    374:                        echo "Error: $d exists and isn't a directory."
                    375:                else
                    376:                        mkdir -m 1777 $d
                    377:                fi
                    378:        done
                    379: fi
                    380:
1.72      deraadt   381: [ -f /etc/rc.securelevel ] && . /etc/rc.securelevel
1.32      deraadt   382: if [ X${securelevel} != X"" ]; then
1.33      millert   383:        echo -n 'setting kernel security level: '
1.234     jmc       384:        sysctl kern.securelevel=${securelevel}
1.1       deraadt   385: fi
                    386:
1.34      deraadt   387: # patch /etc/motd
                    388: if [ ! -f /etc/motd ]; then
                    389:        install -c -o root -g wheel -m 664 /dev/null /etc/motd
                    390: fi
1.131     millert   391: T=`mktemp /tmp/_motd.XXXXXXXXXX`
1.105     millert   392: if [ $? -eq 0 ]; then
1.102     millert   393:        sysctl -n kern.version | sed 1q > $T
                    394:        echo "" >> $T
                    395:        sed '1,/^$/d' < /etc/motd >> $T
                    396:        cmp -s $T /etc/motd || cp $T /etc/motd
                    397:        rm -f $T
                    398: fi
1.34      deraadt   399:
1.1       deraadt   400: if [ -f /var/account/acct ]; then
                    401:        echo 'turning on accounting';   accton /var/account/acct
                    402: fi
                    403:
1.115     deraadt   404: if [ -f /sbin/ldconfig ]; then
                    405:        echo 'creating runtime link editor directory cache.'
                    406:        if [ -d /usr/local/lib ]; then
1.183     todd      407:                shlib_dirs="/usr/local/lib $shlib_dirs"
1.115     deraadt   408:        fi
                    409:        if [ -d /usr/X11R6/lib ]; then
1.183     todd      410:                shlib_dirs="/usr/X11R6/lib $shlib_dirs"
1.115     deraadt   411:        fi
                    412:        ldconfig $shlib_dirs
1.231     millert   413: fi
                    414:
                    415: if [ -x /usr/libexec/vi.recover ]; then
                    416:        echo 'preserving editor files'; /usr/libexec/vi.recover
1.115     deraadt   417: fi
                    418:
1.189     deraadt   419: if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
1.133     deraadt   420:        echo -n "ssh-keygen: generating new DSA host key... "
1.189     deraadt   421:        if /usr/bin/ssh-keygen -q -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''; then
1.163     deraadt   422:                echo done.
                    423:        else
                    424:                echo failed.
                    425:        fi
                    426: fi
1.189     deraadt   427: if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
1.163     deraadt   428:        echo -n "ssh-keygen: generating new RSA host key... "
1.189     deraadt   429:        if /usr/bin/ssh-keygen -q -t rsa -f /etc/ssh/ssh_host_rsa_key -N ''; then
1.133     deraadt   430:                echo done.
                    431:        else
                    432:                echo failed.
                    433:        fi
                    434: fi
1.189     deraadt   435: if [ ! -f /etc/ssh/ssh_host_key ]; then
1.187     markus    436:        echo -n "ssh-keygen: generating new RSA1 host key... "
1.189     deraadt   437:        if /usr/bin/ssh-keygen -q -t rsa1 -f /etc/ssh/ssh_host_key -N ''; then
1.244     markus    438:                echo done.
                    439:        else
                    440:                echo failed.
                    441:        fi
                    442: fi
                    443:
                    444: if [ ! -f /etc/isakmpd/private/local.key ]; then
                    445:        echo -n "openssl: generating new isakmpd RSA key... "
                    446:        if /usr/sbin/openssl genrsa -out /etc/isakmpd/private/local.key 1024 \
                    447:            > /dev/null 2>&1; then
                    448:                chmod 600 /etc/isakmpd/private/local.key
                    449:                openssl rsa -out /etc/isakmpd/private/local.pub \
                    450:                    -in /etc/isakmpd/private/local.key -pubout > /dev/null 2>&1
1.114     deraadt   451:                echo done.
                    452:        else
                    453:                echo failed.
                    454:        fi
                    455: fi
                    456:
1.1       deraadt   457: echo -n starting network daemons:
                    458:
1.227     ian       459: # $routed_flags are imported from /etc/rc.conf.
1.1       deraadt   460: # If $routed_flags == NO, routed isn't run.
1.227     ian       461: if [ "X${routed_flags}" != X"NO" ]; then
1.1       deraadt   462:        echo -n ' routed';              routed $routed_flags
                    463: fi
                    464:
1.52      deraadt   465: # $mrouted_flags is imported from /etc/rc.conf;
1.4       deraadt   466: # If $mrouted_flags == NO, then mrouted isn't run.
                    467: if [ "X${mrouted_flags}" != X"NO" ]; then
                    468:        echo -n ' mrouted';             mrouted $mrouted_flags
1.239     henning   469: fi
                    470:
                    471: if [ "X${bgpd_flags}" != X"NO" ]; then
                    472:        echo -n ' bgpd';                /usr/sbin/bgpd $bgpd_flags
1.4       deraadt   473: fi
1.1       deraadt   474:
1.86      form      475: # $dhcpd_flags is imported from /etc/rc.conf
                    476: # If $dhcpd_flags == NO or /etc/dhcpd.conf doesn't exist, then dhcpd isn't run.
                    477: if [ "X${dhcpd_flags}" != X"NO" -a -f /etc/dhcpd.conf ]; then
                    478:        touch /var/db/dhcpd.leases
                    479:        if [ -f /etc/dhcpd.interfaces ]; then
1.207     mpech     480:                dhcpd_ifs=`stripcom /etc/dhcpd.interfaces`
1.86      form      481:        fi
                    482:        echo -n ' dhcpd';       /usr/sbin/dhcpd ${dhcpd_flags} ${dhcpd_ifs}
1.127     itojun    483: fi
                    484:
                    485: if ifconfig lo0 inet6 >/dev/null 2>&1; then
                    486:        fw=`sysctl -n net.inet6.ip6.forwarding`
                    487:        if [ "X${fw}" == X"0" ]; then
                    488:                # $rtsold_flags is imported from /etc/rc.conf;
                    489:                # If $rtsold_flags == NO, then rtsold isn't run.
                    490:                if [ "X${rtsold_flags}" != X"NO" ]; then
                    491:                        echo -n ' rtsold'
                    492:                        /usr/sbin/rtsold ${rtsold_flags}
                    493:                fi
                    494:        else
                    495:                # $route6d_flags is imported from /etc/rc.conf;
                    496:                # If $route6d_flags == NO, then route6d isn't run.
                    497:                if [ "X${route6d_flags}" != X"NO" ]; then
                    498:                        echo -n ' route6d'
                    499:                        /usr/sbin/route6d ${route6d_flags}
                    500:                fi
                    501:                # $rtadvd_flags is imported from /etc/rc.conf;
1.147     itojun    502:                # If $rtadvd_flags == NO, then rtadvd isn't run.
                    503:                if [ "X${rtadvd_flags}" != X"NO" ]; then
1.127     itojun    504:                        echo -n ' rtadvd'
                    505:                        /usr/sbin/rtadvd ${rtadvd_flags}
                    506:                fi
                    507:        fi
1.86      form      508: fi
                    509:
1.52      deraadt   510: # $rwhod is imported from /etc/rc.conf;
1.1       deraadt   511: # if $rwhod == YES, rwhod is run.
                    512: if [ X${rwhod} = X"YES" ]; then
                    513:        echo -n ' rwhod';               rwhod
                    514: fi
                    515:
1.23      deraadt   516:
1.223     sturm     517: if [ "X${lpd_flags}" != X"NO" ]; then
1.173     fgsch     518:        echo -n ' printer';             lpd ${lpd_flags}
1.23      deraadt   519: fi
1.1       deraadt   520:
1.52      deraadt   521: # $sendmail_flags is imported from /etc/rc.conf;
1.154     millert   522: # If $sendmail_flags == NO or /etc/mailer.conf doesn't exist, then
1.6       deraadt   523: # sendmail isn't run.  We call sendmail with a full path so that
1.154     millert   524: # SIGHUP works.  Note that /usr/sbin/sendmail may actually call a
                    525: # mailer other than sendmail, depending on /etc/mailer.conf.
                    526: if [ "X${sendmail_flags}" != X"NO" -a -s /etc/mailer.conf ]; then
1.153     millert   527:        echo -n ' sendmail';            ( /usr/sbin/sendmail ${sendmail_flags} >/dev/null 2>&1 & )
1.212     deraadt   528: fi
                    529:
1.69      deraadt   530: if [ "X${httpd_flags}" != X"NO"  ]; then
1.143     espie     531:        # Clean up left-over httpd locks
                    532:        rm -f /var/www/logs/{ssl_mutex,httpd.lock,accept.lock}.*
1.160     angelos   533:        echo -n ' httpd';               /usr/sbin/httpd ${httpd_flags}
1.93      downsj    534: fi
                    535:
                    536: if [ "X${ftpd_flags}" != X"NO" ]; then
                    537:        echo -n ' ftpd';                /usr/libexec/ftpd ${ftpd_flags}
1.124     fgsch     538: fi
                    539:
                    540: if [ "X${identd_flags}" != X"NO" ]; then
                    541:        echo -n ' identd';              /usr/libexec/identd ${identd_flags}
1.1       deraadt   542: fi
                    543:
1.161     angelos   544: if [ X${inetd} = X"YES" -a -e /etc/inetd.conf ]; then
1.23      deraadt   545:        echo -n ' inetd';               inetd
1.237     deraadt   546: fi
                    547:
                    548: if [ X"${sshd_flags}" != X"NO" ]; then
                    549:        echo -n ' sshd';                /usr/sbin/sshd ${sshd_flags};
1.238     deraadt   550: fi
                    551:
                    552: if [ "X${spamd_flags}" != X"NO" ]; then
                    553:        if [ "X${spamd_grey}" != X"NO" ]; then
                    554:                spamd_flags="${spamd_flags} -g"
                    555:        fi
1.242     otto      556:        echo -n ' spamd';               eval /usr/libexec/spamd ${spamd_flags}
1.238     deraadt   557:        /usr/libexec/spamd-setup
                    558:        if [ "X${spamd_grey}" != X"NO" ]; then
                    559:                echo -n ' spamlogd'
                    560:                /usr/libexec/spamlogd
                    561:        fi
1.23      deraadt   562: fi
1.1       deraadt   563:
1.52      deraadt   564: # $rarpd_flags is imported from /etc/rc.conf;
1.1       deraadt   565: # If $rarpd_flags == NO or /etc/ethers doesn't exist, then
                    566: # rarpd isn't run.
1.67      millert   567: if [ "X${rarpd_flags}" != X"NO" -a -s /etc/ethers ]; then
1.1       deraadt   568:        echo -n ' rarpd';               rarpd ${rarpd_flags}
                    569: fi
                    570:
1.52      deraadt   571: # $bootparamd_flags is imported from /etc/rc.conf;
1.1       deraadt   572: # If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then
                    573: # bootparamd isn't run.
1.67      millert   574: if [ "X${bootparamd_flags}" != X"NO" -a -s /etc/bootparams ]; then
1.1       deraadt   575:        echo -n ' rpc.bootparamd';      rpc.bootparamd ${bootparamd_flags}
                    576: fi
                    577:
1.52      deraadt   578: # $rbootd_flags is imported from /etc/rc.conf;
1.1       deraadt   579: # If $rbootd_flags == NO or /etc/rbootd.conf doesn't exist, then
                    580: # rbootd isn't run.
1.67      millert   581: if [ "X${rbootd_flags}" != X"NO" -a -s /etc/rbootd.conf ]; then
1.1       deraadt   582:        echo -n ' rbootd';              rbootd ${rbootd_flags}
1.56      maja      583: fi
                    584:
                    585: # $mopd_flags is imported from /etc/rc.conf;
                    586: # If $mopd_flags == NO or /tftpboot/mop doesn't exist, then
                    587: # mopd isn't run.
                    588: if [ "X${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
                    589:        echo -n ' mopd';                mopd ${mopd_flags}
1.1       deraadt   590: fi
                    591:
                    592: echo '.'
1.178     mickey    593:
1.214     marc      594: if [ -x /sbin/wsconsctl -a -f /etc/wsconsctl.conf ]; then
1.178     mickey    595: (
                    596:        # delete comments and blank lines
1.225     marc      597:        save_IFS="$IFS"
1.214     marc      598:        IFS="
                    599: "
1.178     mickey    600:        set -- `stripcom /etc/wsconsctl.conf`
1.225     marc      601:        IFS="$save_IFS"
1.178     mickey    602:        while [ $# -ge 1 ] ; do
1.214     marc      603:                eval /sbin/wsconsctl -w $1
1.178     mickey    604:                shift
                    605:        done
                    606: )
                    607: fi
1.1       deraadt   608:
1.12      deraadt   609: if [ -f /sbin/kbd -a -f /etc/kbdtype ]; then
                    610:        kbd `cat /etc/kbdtype`
1.175     hin       611: fi
                    612:
                    613: # KerberosV master KDC
                    614: if [ X${krb5_master_kdc} = X"YES" ]; then
                    615:        echo 'KerberosV master KDC'
                    616:        /usr/libexec/kdc &
                    617:        /usr/libexec/kadmind &
                    618:        /usr/libexec/kpasswdd &
                    619: fi
                    620:
                    621: # KerberosV slave KDC
                    622: if [ X${krb5_slave_kdc} = X"YES" ]; then
                    623:        echo 'KerberosV slave KDC'
                    624:        /usr/libexec/kdc &
                    625:        # Remember to enable hpropd in inetd.conf
1.17      deraadt   626: fi
                    627:
1.72      deraadt   628: [ -f /etc/rc.local ] && . /etc/rc.local
1.73      millert   629:
                    630: echo -n standard daemons:
1.87      marc      631:
                    632: # $apmd_flags is imported from /etc/rc.conf;
                    633: # don't run daemon if $apmd_flags == NO or /usr/sbin/apmd doesn't exist
                    634: if [ "X${apmd_flags}" != X"NO" -a -x /usr/sbin/apmd ]; then
1.230     deraadt   635:        echo -n ' apmd';        /usr/sbin/apmd ${apmd_flags}
1.229     henning   636: fi
                    637:
                    638: if [ X"${sensorsd_flags}" != X"NO" ]; then
                    639:        echo -n ' sensorsd';    /usr/sbin/sensorsd ${sensorsd_flags}
1.87      marc      640: fi
                    641:
1.73      millert   642: echo -n ' cron';               cron
1.87      marc      643:
1.73      millert   644: echo '.'
1.1       deraadt   645:
                    646: date
1.71      deraadt   647:
1.168     deraadt   648: if [ "X${wsmoused_flags}" != X"NO" -a -x /usr/sbin/wsmoused ]; then
1.169     deraadt   649:        echo 'starting wsmoused...';    /usr/sbin/wsmoused ${wsmoused_flags}
1.155     aaron     650: fi
                    651:
1.71      deraadt   652: # Alternatively, on some architectures, xdm may be started in /etc/ttys.
                    653: if [ "X${xdm_flags}" != X"NO" ]; then
1.92      downsj    654:        echo 'starting xdm...';         /usr/X11R6/bin/xdm ${xdm_flags}
1.71      deraadt   655: fi
                    656:
1.1       deraadt   657: exit 0
1.90      art       658: