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

Annotation of src/etc/rc, Revision 1.459

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