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

Annotation of src/etc/rc, Revision 1.251

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