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