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

Annotation of src/etc/rc, Revision 1.452

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