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

Annotation of src/etc/rc, Revision 1.456

1.456   ! rpe         1: #      $OpenBSD: rc,v 1.455 2015/08/03 04:19:25 yasuoka Exp $
1.1       deraadt     2:
1.450     rpe         3: # System startup script run by init on autoboot or after single-user.
                      4: # Output and error are redirected to console by init, and the console is the
                      5: # controlling terminal.
1.454     rpe         6:
                      7: # Turn off Strict Bourne shell.
                      8: set +o sh
1.1       deraadt     9:
1.131     millert    10: # Subroutines (have to come first).
                     11:
1.450     rpe        12:
1.456   ! rpe        13: # Strip in- and whole-line comments from a file.
        !            14: # Strip leading and trailing whitespace if IFS is set.
        !            15: # Usage: stripcom /path/to/file
1.131     millert    16: stripcom() {
1.456   ! rpe        17:        local _file=$1 _line
1.131     millert    18:
1.456   ! rpe        19:        [[ -s $_file ]] || return
        !            20:
        !            21:        while read _line ; do
        !            22:                _line=${_line%%#*}
        !            23:                [[ -n $_line ]] && print -r -- "$_line"
        !            24:        done <$_file
1.131     millert    25: }
                     26:
1.456   ! rpe        27: # Update resource limits based on login.conf settings.
        !            28: # Usage: update_limit -flag capability
1.265     millert    29: update_limit() {
1.456   ! rpe        30:        local _flag=$1          # ulimit flag
        !            31:        local _cap=$2 _val      # login.conf capability and its value
        !            32:        local _suffix
        !            33:
        !            34:        for _suffix in {,-cur,-max}; do
        !            35:                _val=$(getcap -f /etc/login.conf -s ${_cap}${_suffix} daemon 2>/dev/null)
        !            36:                [[ -n $_val ]] || continue
        !            37:                [[ $_val == infinity ]] && _val=unlimited
        !            38:
        !            39:                case $_suffix in
        !            40:                -cur)   ulimit -S $_flag $_val
        !            41:                        ;;
        !            42:                -max)   ulimit -H $_flag $_val
        !            43:                        ;;
        !            44:                *)      ulimit $_flag $_val
        !            45:                        return
        !            46:                        ;;
        !            47:                esac
1.265     millert    48:        done
                     49: }
                     50:
1.451     rpe        51: # Apply sysctl(8) settings.
1.265     millert    52: sysctl_conf() {
1.453     rpe        53:        [ -s /etc/sysctl.conf ] || return
1.267     millert    54:
1.265     millert    55:        # delete comments and blank lines
                     56:        set -- `stripcom /etc/sysctl.conf`
                     57:        while [ $# -ge 1 ] ; do
                     58:                sysctl $1
                     59:                # update limits if needed
                     60:                case $1 in
                     61:                kern.maxproc=*)
                     62:                        update_limit -p maxproc
                     63:                        ;;
                     64:                kern.maxfiles=*)
                     65:                        update_limit -n openfiles
                     66:                        ;;
                     67:                esac
                     68:                shift
                     69:        done
                     70: }
                     71:
1.450     rpe        72: # Apply mixerctl(1) settings.
1.452     rpe        73: mixerctl_conf() {
1.453     rpe        74:        [ -s /etc/mixerctl.conf ] || return
1.267     millert    75:
1.265     millert    76:        # delete comments and blank lines
                     77:        set -- `stripcom /etc/mixerctl.conf`
                     78:        while [ $# -ge 1 ] ; do
1.451     rpe        79:                mixerctl -q $1 >/dev/null 2>&1
1.265     millert    80:                shift
                     81:        done
                     82: }
                     83:
1.450     rpe        84: # Apply wscons system driver settings using wsconsctl(8).
1.452     rpe        85: wsconsctl_conf() {
1.267     millert    86:        local save_IFS="$IFS"
                     87:
1.453     rpe        88:        [ -x /sbin/wsconsctl -a -s /etc/wsconsctl.conf ] || return
1.267     millert    89:        # delete comments and blank lines
                     90:        IFS="
                     91: "
                     92:        set -- `stripcom /etc/wsconsctl.conf`
                     93:        IFS="$save_IFS"
                     94:        while [ $# -ge 1 ] ; do
1.356     deraadt    95:                eval wsconsctl $1
1.267     millert    96:                shift
                     97:        done
                     98: }
                     99:
1.452     rpe       100: random_seed() {
1.427     bluhm     101:        # push the old seed into the kernel
                    102:        dd if=/var/db/host.random of=/dev/random bs=65536 count=1 status=none
                    103:        chmod 600 /var/db/host.random
                    104:        # ... and create a future seed
                    105:        dd if=/dev/random of=/var/db/host.random bs=65536 count=1 status=none
                    106:        # and create a seed file for the boot-loader
                    107:        dd if=/dev/random of=/etc/random.seed bs=512 count=1 status=none
                    108:        chmod 600 /etc/random.seed
1.312     djm       109: }
                    110:
1.450     rpe       111: # Populate net.inet.(tcp|udp).baddynamic with the contents of /etc/services so
                    112: # as to avoid randomly allocating source ports that correspond to well-known
1.451     rpe       113: # services.
1.452     rpe       114: fill_baddynamic() {
1.390     halex     115:        local _service=$1
1.318     djm       116:        local _sysctl="net.inet.${_service}.baddynamic"
1.390     halex     117:        stripcom /etc/services |
                    118:        {
                    119:                # Variables are local
                    120:                while IFS="     /" read _name _port _srv _junk; do
1.391     halex     121:                        [ "x${_srv}" = "x${_service}" ] || continue
1.390     halex     122:                        _ban="${_ban:+${_ban},}+${_port}"
                    123:                        # Flush before argv gets too long
                    124:                        if [ ${#_ban} -gt 1024 ]; then
                    125:                                sysctl -q ${_sysctl}=${_ban}
                    126:                                _ban=""
                    127:                        fi
                    128:                done
                    129:                [ "${_ban}" ] && sysctl -q ${_sysctl}=${_ban}
                    130:        }
1.318     djm       131: }
                    132:
1.450     rpe       133: # Start daemon using the rc.d daemon control scripts.
1.451     rpe       134: # Usage: start_daemon daemon1 daemon2 daemon3
1.452     rpe       135: start_daemon() {
1.354     robert    136:        local _n
1.353     robert    137:        for _n; do
                    138:                eval _do=\${${_n}_flags}
                    139:                if [ X"${_do}" != X"NO" ]; then
                    140:                        /etc/rc.d/${_n} start
                    141:                fi
                    142:        done
                    143: }
                    144:
1.450     rpe       145: # Generate keys for isakmpd, iked and sshd if the don't exist yet.
1.452     rpe       146: make_keys() {
1.373     deraadt   147:        if [ ! -f /etc/isakmpd/private/local.key ]; then
                    148:                echo -n "openssl: generating isakmpd/iked RSA key... "
                    149:                if openssl genrsa -out /etc/isakmpd/private/local.key 2048 \
                    150:                    >/dev/null 2>&1; then
                    151:                        chmod 600 /etc/isakmpd/private/local.key
                    152:                        openssl rsa -out /etc/isakmpd/local.pub -in \
                    153:                            /etc/isakmpd/private/local.key -pubout \
                    154:                            >/dev/null 2>&1
                    155:                        echo done.
                    156:                else
                    157:                        echo failed.
                    158:                fi
                    159:        fi
                    160:
                    161:        if [ ! -f /etc/iked/private/local.key ]; then
                    162:                # Just copy the generated isakmpd key
                    163:                cp /etc/isakmpd/private/local.key /etc/iked/private/local.key
                    164:                chmod 600 /etc/iked/private/local.key
                    165:                cp /etc/isakmpd/local.pub /etc/iked/local.pub
                    166:        fi
                    167:
                    168:        ssh-keygen -A
                    169: }
                    170:
1.450     rpe       171: # Create Unix sockets directories for X if needed and make sure they have
                    172: # correct permissions.
1.452     rpe       173: setup_X_sockets() {
1.373     deraadt   174:        if [ -d /usr/X11R6/lib ]; then
                    175:                for d in /tmp/.X11-unix /tmp/.ICE-unix ; do
                    176:                        if [ -d $d ]; then
                    177:                                if [ `ls -ld $d | cut -d' ' -f4` \
                    178:                                    != root ]; then
                    179:                                        chown root $d
                    180:                                fi
                    181:                                if [ `ls -ld $d | cut -d' ' -f1` \
                    182:                                    != drwxrwxrwt ]; then
                    183:                                        chmod 1777 $d
                    184:                                fi
                    185:                        elif [ -e $d ]; then
                    186:                                echo "Error: $d exists and isn't a directory."
                    187:                        else
                    188:                                mkdir -m 1777 $d
                    189:                        fi
                    190:                done
                    191:        fi
                    192: }
                    193:
1.450     rpe       194: # Check filesystems, optionally by using a flag for fsck(8) passed as $1.
1.452     rpe       195: do_fsck() {
1.429     claudio   196:        local _flags=$1
                    197:
                    198:        fsck -p $_flags
                    199:        case $? in
                    200:        0)
                    201:                ;;
                    202:        2)
                    203:                exit 1
                    204:                ;;
                    205:        4)
                    206:                echo "Rebooting..."
                    207:                reboot
                    208:                echo "Reboot failed; help!"
                    209:                exit 1
                    210:                ;;
                    211:        8)
                    212:                echo "Automatic file system check failed; help!"
                    213:                exit 1
                    214:                ;;
                    215:        12)
                    216:                echo "Boot interrupted."
                    217:                exit 1
                    218:                ;;
                    219:        130)
1.450     rpe       220:                # Interrupt before catcher installed.
1.429     claudio   221:                exit 1
                    222:                ;;
                    223:        *)
                    224:                echo "Unknown error; help!"
                    225:                exit 1
                    226:                ;;
                    227:        esac
                    228: }
                    229:
1.450     rpe       230: # End subroutines.
1.131     millert   231:
1.1       deraadt   232: stty status '^T'
                    233:
1.450     rpe       234: # Set shell to ignore SIGINT (2), but not children; shell catches SIGQUIT (3)
                    235: # and returns to single user after fsck.
1.1       deraadt   236: trap : 2
1.450     rpe       237: trap : 3       # Shouldn't be needed.
1.1       deraadt   238:
                    239: HOME=/; export HOME
1.349     robert    240: INRC=1; export INRC
1.1       deraadt   241: PATH=/sbin:/bin:/usr/sbin:/usr/bin
                    242: export PATH
1.395     deraadt   243:
1.450     rpe       244: # Must set the domainname before rc.conf, so YP startup choices can be made.
1.395     deraadt   245: if [ -f /etc/defaultdomain ]; then
                    246:        domainname `stripcom /etc/defaultdomain`
                    247: fi
1.108     deraadt   248:
1.450     rpe       249: # Need to get local functions from rc.subr.
1.428     robert    250: FUNCS_ONLY=1 . /etc/rc.d/rc.subr
                    251:
1.450     rpe       252: # Load rc.conf into scope.
1.428     robert    253: _rc_parse_conf
1.343     robert    254:
1.266     millert   255: if [ X"$1" = X"shutdown" ]; then
1.437     bluhm     256:        if echo 2>/dev/null >>/var/db/host.random || \
                    257:            echo 2>/dev/null >>/etc/random.seed; then
                    258:                random_seed
                    259:        else
                    260:                echo warning: cannot write random seed to disk
                    261:        fi
1.416     rpe       262:
1.419     millert   263:        # If we are in secure level 0, assume single user mode.
                    264:        if [ `sysctl -n kern.securelevel` -ne 0 ]; then
1.421     schwarze  265:                pkg_scripts=${pkg_scripts%%*( )}
1.413     deraadt   266:                if [ -n "${pkg_scripts}" ]; then
                    267:                        echo -n 'stopping package daemons:'
                    268:                        while [ -n "${pkg_scripts}" ]; do
                    269:                                _r=${pkg_scripts##* }
                    270:                                pkg_scripts=${pkg_scripts%%*( )${_r}}
                    271:                                [ -x /etc/rc.d/${_r} ] && /etc/rc.d/${_r} stop
                    272:                        done
                    273:                        echo '.'
                    274:                fi
                    275:
1.431     deraadt   276:                [ -f /etc/rc.shutdown ] && sh /etc/rc.shutdown
1.413     deraadt   277:        else
                    278:                echo single user: not running shutdown scripts
                    279:        fi
1.240     mcbride   280:
1.450     rpe       281:        # Bring carp interfaces down gracefully.
1.413     deraadt   282:        ifconfig | while read a b; do
                    283:                case $a in
                    284:                carp+([0-9]):) ifconfig ${a%:} down ;;
                    285:                esac
                    286:        done
1.246     mcbride   287:
1.108     deraadt   288:        exit 0
1.1       deraadt   289: fi
1.98      jakob     290:
1.172     miod      291: swapctl -A -t blk
1.170     deraadt   292:
1.17      deraadt   293: if [ -e /fastboot ]; then
1.1       deraadt   294:        echo "Fast boot: skipping disk checks."
1.266     millert   295: elif [ X"$1" = X"autoboot" ]; then
1.1       deraadt   296:        echo "Automatic boot in progress: starting file system checks."
1.429     claudio   297:        do_fsck
1.1       deraadt   298: fi
                    299:
                    300: trap "echo 'Boot interrupted.'; exit 1" 3
                    301:
                    302: umount -a >/dev/null 2>&1
1.303     grunk     303: mount -a -t nonfs,vnd
1.450     rpe       304: mount -uw /            # root on nfs requires this, others aren't hurt.
1.1       deraadt   305: rm -f /fastboot                # XXX (root now writeable)
1.177     deraadt   306:
1.450     rpe       307: # Set flags on ttys.  (Do early, in case they use tty for SLIP in netstart.)
1.1       deraadt   308: echo 'setting tty flags'
                    309: ttyflags -a
1.77      angelos   310:
1.252     mcbride   311: if [ -f /sbin/kbd -a -f /etc/kbdtype ]; then
                    312:        kbd `cat /etc/kbdtype`
                    313: fi
                    314:
1.279     deraadt   315: wsconsctl_conf
                    316:
1.266     millert   317: if [ X"${pf}" != X"NO" ]; then
1.211     mcbride   318:        RULES="block all"
1.228     henning   319:        RULES="$RULES\npass on lo0"
1.447     krw       320:        RULES="$RULES\npass in proto tcp from any to any port ssh keep state"
                    321:        RULES="$RULES\npass out proto { tcp, udp } from any to any port domain keep state"
1.215     camield   322:        RULES="$RULES\npass out inet proto icmp all icmp-type echoreq keep state"
1.420     claudio   323:        RULES="$RULES\npass out inet proto udp from any port bootpc to any port bootps"
                    324:        RULES="$RULES\npass in inet proto udp from any port bootps to any port bootpc"
1.257     grange    325:        if ifconfig lo0 inet6 >/dev/null 2>&1; then
1.258     itojun    326:                RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type neighbrsol"
                    327:                RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type neighbradv"
1.257     grange    328:                RULES="$RULES\npass out inet6 proto icmp6 all icmp6-type routersol"
                    329:                RULES="$RULES\npass in inet6 proto icmp6 all icmp6-type routeradv"
1.420     claudio   330:                RULES="$RULES\npass out inet6 proto udp from any port dhcpv6-client to any port dhcpv6-server"
                    331:                RULES="$RULES\npass in inet6 proto udp from any port dhcpv6-server to any port dhcpv6-client"
1.257     grange    332:        fi
1.424     henning   333:        RULES="$RULES\npass in proto carp keep state (no-sync)"
                    334:        RULES="$RULES\npass out proto carp !received-on any keep state (no-sync)"
1.193     deraadt   335:        case `sysctl vfs.mounts.nfs 2>/dev/null` in
1.184     deraadt   336:        *[1-9]*)
1.450     rpe       337:                # Don't kill NFS.
1.324     henning   338:                RULES="set reassemble yes no-df\n$RULES"
1.447     krw       339:                RULES="$RULES\npass in proto { tcp, udp } from any port { sunrpc, nfsd } to any"
                    340:                RULES="$RULES\npass out proto { tcp, udp } from any to any port { sunrpc, nfsd } !received-on any"
1.184     deraadt   341:                ;;
                    342:        esac
1.269     dhartmei  343:        echo $RULES | pfctl -f -
                    344:        pfctl -e
1.176     kjell     345: fi
1.318     djm       346:
1.450     rpe       347: # Fill net.inet.(tcp|udp).baddynamic lists from /etc/services.
1.318     djm       348: fill_baddynamic udp
                    349: fill_baddynamic tcp
1.176     kjell     350:
1.267     millert   351: sysctl_conf
1.260     jsg       352:
1.450     rpe       353: # Set hostname, turn on network.
1.1       deraadt   354: echo 'starting network'
1.289     henning   355: ifconfig -g carp carpdemote 128
1.264     deraadt   356: if [ -f /etc/resolv.conf.save ]; then
1.334     deraadt   357:        mv -f /etc/resolv.conf.save /etc/resolv.conf
1.264     deraadt   358:        touch /etc/resolv.conf
                    359: fi
1.439     ajacouto  360: sh /etc/netstart
1.451     rpe       361: dmesg >/dev/random     # Any write triggers a rekey.
1.176     kjell     362:
1.450     rpe       363: # Load pf rules and bring up pfsync interface.
1.266     millert   364: if [ X"${pf}" != X"NO" ]; then
1.449     ajacouto  365:        if [ -f /etc/pf.conf ]; then
                    366:                pfctl -f /etc/pf.conf
1.309     mpf       367:        fi
1.450     rpe       368:        # Bring up pfsync after the working ruleset has been loaded.
1.367     deraadt   369:        if [ -f /etc/hostname.pfsync0 ]; then
1.435     deraadt   370:                sh /etc/netstart pfsync0
1.367     deraadt   371:        fi
1.176     kjell     372: fi
1.1       deraadt   373:
1.278     otto      374: mount -s /usr >/dev/null 2>&1
                    375: mount -s /var >/dev/null 2>&1
1.180     deraadt   376:
1.389     deraadt   377: random_seed
1.29      deraadt   378:
1.450     rpe       379: # Clean up left-over files.
1.376     deraadt   380: rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
1.247     henning   381: (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; })
1.196     beck      382: (cd /var/authpf && rm -rf -- *)
1.96      alex      383:
1.450     rpe       384: # Save a copy of the boot messages.
1.96      alex      385: dmesg >/var/run/dmesg.boot
1.55      deraadt   386:
1.373     deraadt   387: make_keys
                    388:
1.379     deraadt   389: echo -n 'starting early daemons:'
1.440     deraadt   390: start_daemon syslogd ldattach pflogd nsd unbound ntpd
1.429     claudio   391: start_daemon iscsid isakmpd iked sasyncd ldapd npppd
1.353     robert    392: echo '.'
1.280     hshoexer  393:
1.450     rpe       394: # Load IPsec rules.
1.280     hshoexer  395: if [ X"${ipsec}" != X"NO" ]; then
1.449     ajacouto  396:        if [ -f /etc/ipsec.conf ]; then
                    397:                ipsecctl -f /etc/ipsec.conf
1.280     hshoexer  398:        fi
1.40      provos    399: fi
1.1       deraadt   400:
1.379     deraadt   401: echo -n 'starting RPC daemons:'
1.399     dlg       402: start_daemon portmap ypldap
1.376     deraadt   403: if [ X"`domainname`" != X"" ]; then
1.385     deraadt   404:        start_daemon ypserv ypbind yppasswdd
1.376     deraadt   405: fi
1.399     dlg       406: start_daemon mountd nfsd lockd statd amd
1.1       deraadt   407: echo '.'
1.58      deraadt   408:
1.278     otto      409: mount -a
1.172     miod      410: swapctl -A -t noblk
1.429     claudio   411:
1.450     rpe       412: # Check and mount networked filesystems.
1.429     claudio   413: do_fsck -N
                    414: mount -a -N
1.1       deraadt   415:
1.450     rpe       416: # /var/crash should be a directory or a symbolic link to the crash directory
                    417: # if core dumps are to be saved.
1.1       deraadt   418: if [ -d /var/crash ]; then
1.188     tholo     419:        savecore ${savecore_flags} /var/crash
1.90      art       420: fi
                    421:
1.266     millert   422: if [ X"${check_quotas}" = X"YES" ]; then
1.41      downsj    423:        echo -n 'checking quotas:'
                    424:        quotacheck -a
                    425:        echo ' done.'
                    426:        quotaon -a
                    427: fi
1.1       deraadt   428:
1.376     deraadt   429: kvm_mkdb                       # build kvm(3) databases
1.1       deraadt   430: dev_mkdb
1.101     deraadt   431: chmod 666 /dev/tty[pqrstuvwxyzPQRST]*
1.226     millert   432: chown root:wheel /dev/tty[pqrstuvwxyzPQRST]*
1.1       deraadt   433:
1.450     rpe       434: # Check the password temp/lock file.
1.17      deraadt   435: if [ -f /etc/ptmp ]; then
1.1       deraadt   436:        logger -s -p auth.err \
1.376     deraadt   437:            'password file may be incorrect -- /etc/ptmp exists'
1.32      deraadt   438: fi
                    439:
1.49      millert   440: echo clearing /tmp
                    441:
1.450     rpe       442: # Prune quickly with one rm, then use find to clean up /tmp/[lqv]*
                    443: # (not needed with mfs /tmp, but doesn't hurt there...).
1.444     deraadt   444: (cd /tmp && rm -rf [a-km-pr-uw-zA-Z]*)
1.339     sthen     445: (cd /tmp &&
1.443     millert   446:     find . -maxdepth 1 ! -name . ! -name lost+found ! -name quota.user \
1.444     deraadt   447:        ! -name quota.group ! -name vi.recover -execdir rm -rf -- {} \;)
1.373     deraadt   448:
                    449: setup_X_sockets
1.203     hugh      450:
1.431     deraadt   451: [ -f /etc/rc.securelevel ] && sh /etc/rc.securelevel
1.450     rpe       452: # rc.securelevel did not specifically set -1 or 2, so select the default: 1.
1.432     ajacouto  453: if [ `sysctl -n kern.securelevel` -eq 0 ]; then
                    454:        sysctl kern.securelevel=1
1.433     ajacouto  455: fi
1.1       deraadt   456:
1.450     rpe       457: # Patch /etc/motd.
1.34      deraadt   458: if [ ! -f /etc/motd ]; then
                    459:        install -c -o root -g wheel -m 664 /dev/null /etc/motd
                    460: fi
1.364     guenther  461: if T=`mktemp /tmp/_motd.XXXXXXXXXX`; then
1.451     rpe       462:        sysctl -n kern.version | sed 1q >$T
                    463:        echo "" >>$T
                    464:        sed '1,/^$/d' </etc/motd >>$T
1.102     millert   465:        cmp -s $T /etc/motd || cp $T /etc/motd
                    466:        rm -f $T
                    467: fi
1.34      deraadt   468:
1.298     ajacouto  469: if [ X"${accounting}" = X"YES" ]; then
                    470:        if [ ! -f /var/account/acct ]; then
                    471:                touch /var/account/acct
                    472:        fi
1.451     rpe       473:        echo 'turning on accounting'; accton /var/account/acct
1.1       deraadt   474: fi
                    475:
1.363     deraadt   476: if [ -f /sbin/ldconfig ]; then
1.115     deraadt   477:        echo 'creating runtime link editor directory cache.'
                    478:        if [ -d /usr/local/lib ]; then
1.183     todd      479:                shlib_dirs="/usr/local/lib $shlib_dirs"
1.115     deraadt   480:        fi
                    481:        if [ -d /usr/X11R6/lib ]; then
1.183     todd      482:                shlib_dirs="/usr/X11R6/lib $shlib_dirs"
1.115     deraadt   483:        fi
                    484:        ldconfig $shlib_dirs
1.231     millert   485: fi
                    486:
1.451     rpe       487: echo 'preserving editor files.'; /usr/libexec/vi.recover
1.244     markus    488:
1.353     robert    489: echo -n 'starting network daemons:'
1.404     kettenis  490: start_daemon ldomd sshd snmpd ldpd ripd ospfd ospf6d bgpd ifstated
1.455     yasuoka   491: start_daemon relayd dhcpd dhcrelay mrouted dvmrpd radiusd
1.127     itojun    492:
                    493: if ifconfig lo0 inet6 >/dev/null 2>&1; then
                    494:        fw=`sysctl -n net.inet6.ip6.forwarding`
1.446     florian   495:        if [ X"${fw}" = X"1" ]; then
1.376     deraadt   496:                start_daemon route6d rtadvd
1.127     itojun    497:        fi
1.281     reyk      498: fi
                    499:
1.442     matthieu  500: start_daemon hostapd lpd smtpd slowcgi httpd ftpd
1.407     ajacouto  501: start_daemon ftpproxy tftpd tftpproxy identd inetd rarpd bootparamd
1.425     ajacouto  502: start_daemon rbootd mopd spamd spamlogd sndiod
1.377     robert    503: echo '.'
1.335     deraadt   504:
1.450     rpe       505: # If rc.firsttime exists, run it just once, and make sure it is deleted.
1.335     deraadt   506: if [ -f /etc/rc.firsttime ]; then
                    507:        mv /etc/rc.firsttime /etc/rc.firsttime.run
1.384     halex     508:        . /etc/rc.firsttime.run 2>&1 | tee /dev/tty |
1.392     halex     509:                mail -Es "`hostname` rc.firsttime output" root >/dev/null
1.335     deraadt   510: fi
                    511: rm -f /etc/rc.firsttime.run
1.352     ajacouto  512:
1.450     rpe       513: # Run rc.d(8) scripts from packages.
1.380     ajacouto  514: if [ -n "${pkg_scripts}" ]; then
1.352     ajacouto  515:        echo -n 'starting package daemons:'
1.380     ajacouto  516:        for _r in $pkg_scripts; do
1.410     espie     517:                if [ -x /etc/rc.d/${_r} ]; then
                    518:                        start_daemon ${_r}
                    519:                else
                    520:                        echo -n " ${_r}(absent)"
                    521:                fi
1.352     ajacouto  522:        done
                    523:        echo '.'
                    524: fi
1.17      deraadt   525:
1.431     deraadt   526: [ -f /etc/rc.local ] && sh /etc/rc.local
1.73      millert   527:
1.379     deraadt   528: ifconfig -g carp -carpdemote 128       # disable carp interlock
1.286     mcbride   529:
1.379     deraadt   530: mixerctl_conf
                    531: echo -n 'starting local daemons:'
1.386     deraadt   532: start_daemon apmd sensorsd hotplugd watchdogd cron wsmoused xdm
1.73      millert   533: echo '.'
1.1       deraadt   534:
                    535: date
                    536: exit 0