Deleted Added
full compact
rc (51210) rc (51231)
1#!/bin/sh
1#!/bin/sh
2# $FreeBSD: head/etc/rc 51210 1999-09-12 18:13:11Z roberto $
2# $FreeBSD: head/etc/rc 51231 1999-09-13 15:44:20Z sheldonh $
3# From: @(#)rc 5.27 (Berkeley) 6/5/91
4
5# System startup script run by init on autoboot
6# or after single-user.
7# Output and error are redirected to console by init,
8# and the console is the controlling terminal.
9
3# From: @(#)rc 5.27 (Berkeley) 6/5/91
4
5# System startup script run by init on autoboot
6# or after single-user.
7# Output and error are redirected to console by init,
8# and the console is the controlling terminal.
9
10# Note that almost all the user-configurable behavior is no longer in
11# this file, but rather in /etc/defaults/rc.conf. Please check this file
12# first before contemplating any changes here.
10# Note that almost all of the user-configurable behavior is no longer in
11# this file, but rather in /etc/defaults/rc.conf. Please check that file
12# first before contemplating any changes here. If you do need to change
13# this file for some reason, we would like to know about it.
13
14stty status '^T'
15
16# Set shell to ignore SIGINT (2), but not children;
17# shell catches SIGQUIT (3) and returns to single user after fsck.
14
15stty status '^T'
16
17# Set shell to ignore SIGINT (2), but not children;
18# shell catches SIGQUIT (3) and returns to single user after fsck.
19#
18trap : 2
19trap : 3 # shouldn't be needed
20
20trap : 2
21trap : 3 # shouldn't be needed
22
21HOME=/; export HOME
23HOME=/
22PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
24PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
23export PATH
25export HOME PATH
24
25# BOOTP diskless boot. We have to run the rc file early in order to
26# retarget various config files.
27#
26
27# BOOTP diskless boot. We have to run the rc file early in order to
28# retarget various config files.
29#
28if [ -f /etc/rc.diskless1 ]; then
30if [ -r /etc/rc.diskless1 ]; then
29 dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
30 if [ ${dlv:=0} != 0 ]; then
31 . /etc/rc.diskless1
32 fi
33fi
34
35# If there is a global system configuration file, suck it in.
36#
31 dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
32 if [ ${dlv:=0} != 0 ]; then
33 . /etc/rc.diskless1
34 fi
35fi
36
37# If there is a global system configuration file, suck it in.
38#
37if [ -f /etc/defaults/rc.conf ]; then
39if [ -r /etc/defaults/rc.conf ]; then
38 . /etc/defaults/rc.conf
40 . /etc/defaults/rc.conf
39elif [ -f /etc/rc.conf ]; then
41elif [ -r /etc/rc.conf ]; then
40 . /etc/rc.conf
41fi
42
43# Configure ccd devices.
42 . /etc/rc.conf
43fi
44
45# Configure ccd devices.
44if [ -f /etc/ccd.conf ]; then
46#
47if [ -r /etc/ccd.conf ]; then
45 ccdconfig -C
46fi
47
48 ccdconfig -C
49fi
50
48if [ "${start_vinum}" = "YES" ]; then
51case ${start_vinum} in
52[Yy][Ee][Ss])
49 vinum start
53 vinum start
50elif [ -n "${vinum_drives}" ]; then
51 vinum read ${vinum_drives}
52fi
54 ;;
55*)
56 if [ -n "${vinum_drives}" ]; then
57 vinum read ${vinum_drives}
58 fi
59 ;;
60esac
53
54swapon -a
55
61
62swapon -a
63
56if [ "$1" = "autoboot" ]; then
64case $1 in
65autoboot)
57 echo Automatic reboot in progress...
58 fsck -p
59 case $? in
60 0)
61 ;;
62 2)
63 exit 1
64 ;;

--- 14 unchanged lines hidden (view full) ---

79 # interrupt before catcher installed
80 exit 1
81 ;;
82 *)
83 echo "Unknown error in reboot"
84 exit 1
85 ;;
86 esac
66 echo Automatic reboot in progress...
67 fsck -p
68 case $? in
69 0)
70 ;;
71 2)
72 exit 1
73 ;;

--- 14 unchanged lines hidden (view full) ---

88 # interrupt before catcher installed
89 exit 1
90 ;;
91 *)
92 echo "Unknown error in reboot"
93 exit 1
94 ;;
95 esac
87else
96 ;;
97*)
88 echo Skipping disk checks ...
98 echo Skipping disk checks ...
89fi
99 ;;
100esac
90
91set -T
92trap "echo 'Reboot interrupted'; exit 1" 3
93
94# root normally must be read/write, but if this is a BOOTP NFS
95# diskless boot it does not have to be.
96#
101
102set -T
103trap "echo 'Reboot interrupted'; exit 1" 3
104
105# root normally must be read/write, but if this is a BOOTP NFS
106# diskless boot it does not have to be.
107#
108case ${root_rw_mount} in
109[Nn][Oo] | '')
110 ;;
111*)
112 if ! mount -u -o rw / ; then
113 echo "Mounting root filesystem rw failed, startup aborted"
114 exit 1
115 fi
116 ;;
117esac
97
118
98if [ "${root_rw_mount}" != "NO" ]; then
99 mount -u -o rw /
100fi
101
102if [ $? != 0 ]; then
103 echo "Filesystem mount failed, startup aborted"
104 exit 1
105fi
106
107umount -a >/dev/null 2>&1
108
119umount -a >/dev/null 2>&1
120
109if [ "${early_nfs_mounts}" != "YES" ]; then
110 mount -a -t nonfs
111else
121# Where/how would this get set?
122#
123case ${early_nfs_mounts} in
124[Yy][Ee][Ss])
112 mount -a
125 mount -a
113fi
114if [ $? != 0 ]; then
115 echo "Filesystem mount failed, startup aborted"
126 ;;
127*)
128 mount -a -t nonfs
129 ;;
130esac
131
132case $? in
1330)
134 ;;
135*)
136 echo "Mounting /etc/fstab filesystems failed, startup aborted"
116 exit 1
137 exit 1
117fi
138 ;;
139esac
118
119# Run custom disk mounting function here
120#
140
141# Run custom disk mounting function here
142#
121
122if [ -n "${diskless_mount}" ]; then
123 if [ -f "${diskless_mount}" ]; then
143if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
124 sh ${diskless_mount}
144 sh ${diskless_mount}
125 fi
126fi
127
128adjkerntz -i
129
130clean_var() {
131 if [ ! -f /var/run/clean_var ]; then
132 rm -rf /var/run/*
133 rm -f /var/spool/lock/*
134 rm -rf /var/spool/uucp/.Temp/*
135 # Keep a copy of the boot messages around
136 dmesg >/var/run/dmesg.boot
137 # And an initial utmp file
145fi
146
147adjkerntz -i
148
149clean_var() {
150 if [ ! -f /var/run/clean_var ]; then
151 rm -rf /var/run/*
152 rm -f /var/spool/lock/*
153 rm -rf /var/spool/uucp/.Temp/*
154 # Keep a copy of the boot messages around
155 dmesg >/var/run/dmesg.boot
156 # And an initial utmp file
138 (cd /var/run && cp /dev/null utmp && chmod 644 utmp; )
157 (cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
139 >/var/run/clean_var
140 fi
141}
142
143if [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then
144 # network_pass1() *may* end up writing stuff to /var - we don't want to
145 # remove it immediately afterwards - *nor* to we want to fail to clean
146 # an nfs-mounted /var.
147 clean_var
148fi
149
150# Add additional swapfile, if configured.
158 >/var/run/clean_var
159 fi
160}
161
162if [ -d /var/run -a -d /var/spool/lock -a -d /var/spool/uucp/.Temp ]; then
163 # network_pass1() *may* end up writing stuff to /var - we don't want to
164 # remove it immediately afterwards - *nor* to we want to fail to clean
165 # an nfs-mounted /var.
166 clean_var
167fi
168
169# Add additional swapfile, if configured.
151if [ "${swapfile}" != "NO" -a -w "${swapfile}" -a -b /dev/vn0b ]; then
152 echo "Adding ${swapfile} as additional swap."
153 vnconfig /dev/vn0b ${swapfile} && swapon /dev/vn0b
154fi
170#
171case ${swapfile} in
172[Nn][Oo] | '')
173 ;;
174*)
175 if [ -w "${swapfile}" -a -b /dev/vn0b ]; then
176 echo "Adding ${swapfile} as additional swap."
177 vnconfig /dev/vn0b ${swapfile} && swapon /dev/vn0b
178 fi
179 ;;
180esac
155
181
156# set sysctl variables early as we can
157if [ -f /etc/rc.sysctl ]; then
182# Set sysctl variables as early as we can
183#
184if [ -r /etc/rc.sysctl ]; then
158 . /etc/rc.sysctl
159fi
160
185 . /etc/rc.sysctl
186fi
187
161# configure serial devices
162if [ -f /etc/rc.serial ]; then
188# Configure serial devices
189#
190if [ -r /etc/rc.serial ]; then
163 . /etc/rc.serial
164fi
165
191 . /etc/rc.serial
192fi
193
166# start up PC-card configuration
167if [ -f /etc/rc.pccard ]; then
194# Start up PC-card configuration
195#
196if [ -r /etc/rc.pccard ]; then
168 . /etc/rc.pccard
169fi
170
197 . /etc/rc.pccard
198fi
199
171# start up the initial network configuration.
172if [ -f /etc/rc.network ]; then
200# Start up the initial network configuration.
201#
202if [ -r /etc/rc.network ]; then
173 . /etc/rc.network # We only need to do this once.
174 network_pass1
175fi
176
203 . /etc/rc.network # We only need to do this once.
204 network_pass1
205fi
206
207# Retest for early_nfs here?
208#
177echo -n "Mounting NFS file systems"
178mount -a -t nfs
179echo .
180
181# Whack the pty perms back into shape.
209echo -n "Mounting NFS file systems"
210mount -a -t nfs
211echo .
212
213# Whack the pty perms back into shape.
214#
182chflags 0 /dev/tty[pqrsPQRS]*
183chmod 666 /dev/tty[pqrsPQRS]*
184chown root:wheel /dev/tty[pqrsPQRS]*
185
215chflags 0 /dev/tty[pqrsPQRS]*
216chmod 666 /dev/tty[pqrsPQRS]*
217chown root:wheel /dev/tty[pqrsPQRS]*
218
186# clean up left-over files
219# Clean up left-over files
220#
187clean_var # If it hasn't already been done
188rm /var/run/clean_var
189
221clean_var # If it hasn't already been done
222rm /var/run/clean_var
223
190#
191# Clearing /tmp at boot-time seems to have a long tradition. It doesn't
192# help in any way for long-living systems, and it might accidentally
193# clobber files you would rather like to have preserved after a crash
194# (if not using mfs /tmp anyway).
195#
196# See also the example of another cleanup policy in /etc/periodic/daily.
197#
224# Clearing /tmp at boot-time seems to have a long tradition. It doesn't
225# help in any way for long-living systems, and it might accidentally
226# clobber files you would rather like to have preserved after a crash
227# (if not using mfs /tmp anyway).
228#
229# See also the example of another cleanup policy in /etc/periodic/daily.
230#
198if [ "${clear_tmp_enable}" = "YES" ]; then
231case ${clear_tmp_enable} in
232[Yy][Ee][Ss])
199 echo clearing /tmp
233 echo clearing /tmp
200
201 # prune quickly with one rm, then use find to clean up /tmp/[lq]*
202 # (not needed with mfs /tmp, but doesn't hurt there...)
203 (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
234 # prune quickly with one rm, then use find to clean up /tmp/[lq]*
235 # (not needed with mfs /tmp, but doesn't hurt there...)
236 (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
204 find -d . ! -name . ! -name lost+found ! -name quota.user \
205 ! -name quota.group -exec rm -rf -- {} \;)
237 find -d . ! -name . ! -name lost+found ! -name quota.user \
238 ! -name quota.group -exec rm -rf -- {} \;)
239 ;;
240esac
206
241
207fi
208
209# Remove X lock files, since they will prevent you from restarting X11
242# Remove X lock files, since they will prevent you from restarting X11
210# after a system crash.
243# after a system crash.
244#
211rm -f /tmp/.X*-lock /tmp/.X11-unix/*
212
245rm -f /tmp/.X*-lock /tmp/.X11-unix/*
246
213# snapshot any kernel -c changes back to disk here <someday>
214# this has changed with ELF and /kernel.config.
247# Snapshot any kernel -c changes back to disk here <someday>.
248# This has changed with ELF and /kernel.config.
215
216echo -n 'additional daemons:'
249
250echo -n 'additional daemons:'
217# start system logging and name service (named needs to start before syslogd
218# if you don't have a /etc/resolv.conf)
251
252# Start system logging and name service. Named needs to start before syslogd
253# if you don't have a /etc/resolv.conf.
219#
254#
220if [ "${syslogd_enable}" = "YES" ]; then
255case ${syslogd_enable} in
256[Yy][Ee][Ss])
221 # Transitional symlink (for the next couple of years :) until all
257 # Transitional symlink (for the next couple of years :) until all
222 # binaries had a chance to move towards /var/run/log.
223 if [ ! -h /dev/log ] ; then
258 # binaries have had a chance to move towards /var/run/log.
259 if [ ! -h /dev/log ]; then
224 # might complain for r/o root f/s
225 ln -sf /var/run/log /dev/log
226 fi
227
228 rm -f /var/run/log
260 # might complain for r/o root f/s
261 ln -sf /var/run/log /dev/log
262 fi
263
264 rm -f /var/run/log
229 echo -n ' syslogd'; syslogd ${syslogd_flags}
230fi
265 echo -n ' syslogd'; syslogd ${syslogd_flags}
266 ;;
267esac
268
231echo '.'
232
269echo '.'
270
233# enable dumpdev so that savecore can see it
271# Enable dumpdev so that savecore can see it.
234# /var/crash should be a directory or a symbolic link
235# to the crash directory if core dumps are to be saved.
272# /var/crash should be a directory or a symbolic link
273# to the crash directory if core dumps are to be saved.
236if [ "${dumpdev}" != "NO" -a -e ${dumpdev} -a -d /var/crash ]; then
237 dumpon ${dumpdev}
238 echo -n checking for core dump...
239 savecore /var/crash
240fi
274#
275case ${dumpdev} in
276[Nn][Oo] | '')
277 ;;
278*)
279 if [ -e "${dumpdev}" -a -d /var/crash ]; then
280 dumpon ${dumpdev}
281 echo -n checking for core dump...
282 savecore /var/crash
283 fi
284 ;;
285esac
241
242if [ -n "${network_pass1_done}" ]; then
243 network_pass2
244fi
245
246# Enable/Check the quotas (must be after ypbind if using NIS)
286
287if [ -n "${network_pass1_done}" ]; then
288 network_pass2
289fi
290
291# Enable/Check the quotas (must be after ypbind if using NIS)
247if [ "${enable_quotas}" = "YES" ]; then
292#
293case ${enable_quotas} in
294[Yy][Ee][Ss])
295 case ${check_quotas} in
296 [Yy][Ee][Ss])
297 echo -n 'checking quotas:'
298 quotacheck -a
299 echo ' done.'
300 ;;
301 esac
248
302
249 # Only check quotas if they have been previously enabled, and requested
250 if [ "${check_quotas}" = "YES" ]; then
251 echo -n 'checking quotas:'
252 quotacheck -a
253 echo ' done.'
254 fi
303 echo -n 'enabling quotas:'
304 quotaon -a
305 echo ' done.'
306 ;;
307esac
255
308
256 echo -n 'enabling quotas:'
257 quotaon -a
258 echo ' done.'
259fi
260
261if [ -n "${network_pass2_done}" ]; then
262 network_pass3
263fi
264
309if [ -n "${network_pass2_done}" ]; then
310 network_pass3
311fi
312
265
266# build ps databases
267kvm_mkdb
313# Build ps databases
314#
315kvm_mkdb
268dev_mkdb
269
316dev_mkdb
317
270# check the password temp/lock file
271if [ -f /etc/ptmp ]
272then
318# Check the password temp/lock file
319#
320if [ -e /etc/ptmp ]; then
273 logger -s -p auth.err \
274 "password file may be incorrect -- /etc/ptmp exists"
275fi
276
321 logger -s -p auth.err \
322 "password file may be incorrect -- /etc/ptmp exists"
323fi
324
277if [ "${accounting_enable}" = "YES" -a -d /var/account ]; then
278 echo 'turning on accounting'
279 if [ ! -e /var/account/acct ]; then
280 touch /var/account/acct
325case ${accounting_enable} in
326[Yy][Ee][Ss])
327 if [ -d /var/account ]; then
328 echo 'turning on accounting'
329 if [ ! -e /var/account/acct ]; then
330 touch /var/account/acct
331 fi
332 accton /var/account/acct
281 fi
333 fi
282 accton /var/account/acct
283fi
334 ;;
335esac
284
285# Make shared lib searching a little faster. Leave /usr/lib first if you
286# add your own entries or you may come to grief.
336
337# Make shared lib searching a little faster. Leave /usr/lib first if you
338# add your own entries or you may come to grief.
339#
287if [ -x /sbin/ldconfig ]; then
340if [ -x /sbin/ldconfig ]; then
288 if [ "`/usr/bin/objformat`" = "elf" ]; then
341 case `/usr/bin/objformat` in
342 elf)
289 _LDC=/usr/lib
290 for i in ${ldconfig_paths}; do
343 _LDC=/usr/lib
344 for i in ${ldconfig_paths}; do
291 if test -d ${i}; then
345 if [ -d "${i}" ]; then
292 _LDC="${_LDC} ${i}"
293 fi
294 done
295 echo 'setting ELF ldconfig path:' ${_LDC}
296 ldconfig -elf ${_LDC}
346 _LDC="${_LDC} ${i}"
347 fi
348 done
349 echo 'setting ELF ldconfig path:' ${_LDC}
350 ldconfig -elf ${_LDC}
297 fi
351 ;;
352 esac
298
299 # Legacy aout support for i386 only
353
354 # Legacy aout support for i386 only
300 if [ "`sysctl -n hw.machine`" = "i386" ]; then
355 case `sysctl -n hw.machine` in
356 i386)
301 # Default the a.out ldconfig path.
302 : ${ldconfig_paths_aout=${ldconfig_paths}}
303 _LDC=/usr/lib/aout
304 for i in ${ldconfig_paths_aout}; do
357 # Default the a.out ldconfig path.
358 : ${ldconfig_paths_aout=${ldconfig_paths}}
359 _LDC=/usr/lib/aout
360 for i in ${ldconfig_paths_aout}; do
305 if test -d ${i}; then
361 if [ -d "${i}" ]; then
306 _LDC="${_LDC} ${i}"
307 fi
308 done
309 echo 'setting a.out ldconfig path:' ${_LDC}
310 ldconfig -aout ${_LDC}
362 _LDC="${_LDC} ${i}"
363 fi
364 done
365 echo 'setting a.out ldconfig path:' ${_LDC}
366 ldconfig -aout ${_LDC}
311 fi
367 ;;
368 esac
312fi
313
314# Now start up miscellaneous daemons that don't belong anywhere else
315#
316echo -n starting standard daemons:
369fi
370
371# Now start up miscellaneous daemons that don't belong anywhere else
372#
373echo -n starting standard daemons:
317if [ "${inetd_enable}" != "NO" ]; then
374case ${inetd_enable} in
375[Nn][Oo])
376 ;;
377*)
318 echo -n ' inetd'; inetd ${inetd_flags}
378 echo -n ' inetd'; inetd ${inetd_flags}
319fi
379 ;;
380esac
320
381
321if [ "${cron_enable}" != "NO" ]; then
382case ${cron_enable} in
383[Nn][Oo])
384 ;;
385*)
322 echo -n ' cron'; cron
386 echo -n ' cron'; cron
323fi
387 ;;
388esac
324
389
325if [ "${lpd_enable}" = "YES" ]; then
326 echo -n ' printer'; ${lpd_program} ${lpd_flags}
327fi
390case ${lpd_enable} in
391[Yy][Ee][Ss])
392 echo -n ' printer'; ${lpd_program:-/usr/sbin/lpd} ${lpd_flags}
393 ;;
394esac
328
395
329if [ "${sendmail_enable}" = "YES" -a -r /etc/sendmail.cf ]; then
330 echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags}
331fi
396case ${sendmail_enable} in
397[Yy][Ee][Ss])
398 if [ -r /etc/sendmail.cf ]; then
399 echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags}
400 fi
401 ;;
402esac
332
403
333if [ "${usbd_enable}" = "YES" ]; then
404case ${usbd_enable} in
405[Yy][Ee][Ss])
334 echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags}
406 echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags}
335fi
407 ;;
408esac
336
337echo '.'
338
409
410echo '.'
411
339# configure implementation specific stuff
412# Configure implementation specific stuff
413#
340arch=`uname -m`
414arch=`uname -m`
341if [ -f /etc/rc.${arch} ]; then
415if [ -r /etc/rc.${arch} ]; then
342 . /etc/rc.${arch}
343fi
344
345# Recover vi editor files.
346find /var/tmp/vi.recover ! -type f -a ! -type d -delete
347vibackup=`echo /var/tmp/vi.recover/vi.*`
348if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then
349 echo 'Recovering vi editor sessions'
350 for i in ${vibackup}; do
351 # Only test files that are readable.
416 . /etc/rc.${arch}
417fi
418
419# Recover vi editor files.
420find /var/tmp/vi.recover ! -type f -a ! -type d -delete
421vibackup=`echo /var/tmp/vi.recover/vi.*`
422if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then
423 echo 'Recovering vi editor sessions'
424 for i in ${vibackup}; do
425 # Only test files that are readable.
352 if test ! -r ${i}; then
426 if [ ! -r "${i}" ]; then
353 continue
354 fi
355
356 # Unmodified nvi editor backup files either have the
357 # execute bit set or are zero length. Delete them.
427 continue
428 fi
429
430 # Unmodified nvi editor backup files either have the
431 # execute bit set or are zero length. Delete them.
358 if test -x ${i} -o ! -s ${i}; then
432 if [ -x "${i}" -o ! -s "${i}" ]; then
359 rm -f ${i}
360 fi
361 done
362
363 # It is possible to get incomplete recovery files, if the editor
364 # crashes at the right time.
365 virecovery=`echo /var/tmp/vi.recover/recover.*`
366 if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then
367 for i in ${virecovery}; do
368 # Only test files that are readable.
433 rm -f ${i}
434 fi
435 done
436
437 # It is possible to get incomplete recovery files, if the editor
438 # crashes at the right time.
439 virecovery=`echo /var/tmp/vi.recover/recover.*`
440 if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then
441 for i in ${virecovery}; do
442 # Only test files that are readable.
369 if test ! -r ${i}; then
443 if [ ! -r "${i}" ]; then
370 continue
371 fi
372
373 # Delete any recovery files that are zero length,
374 # corrupted, or that have no corresponding backup file.
375 # Else send mail to the user.
376 recfile=`awk '/^X-vi-recover-path:/{print $2}' < ${i}`
444 continue
445 fi
446
447 # Delete any recovery files that are zero length,
448 # corrupted, or that have no corresponding backup file.
449 # Else send mail to the user.
450 recfile=`awk '/^X-vi-recover-path:/{print $2}' < ${i}`
377 if test -n "${recfile}" -a -s "${recfile}"; then
451 if [ -n "${recfile}" -a -s "${recfile}" ]; then
378 sendmail -t < ${i}
379 else
380 rm -f ${i}
381 fi
382 done
383 fi
384fi
385
452 sendmail -t < ${i}
453 else
454 rm -f ${i}
455 fi
456 done
457 fi
458fi
459
386# make a bounds file for msgs(1) if there isn't one already
387if [ -d /var/msgs -a ! -f /var/msgs/bounds ]; then
460# Make a bounds file for msgs(1) if there isn't one already
461# "Delete important files with symlink" security hole?
462#
463if [ -d /var/msgs -a ! -f /var/msgs/bounds ]; then
388 echo 0 > /var/msgs/bounds
389fi
390
464 echo 0 > /var/msgs/bounds
465fi
466
391# for each valid dir in $local_startup, search for init scripts matching *.sh
392if [ "${local_startup}" != "NO" ]; then
467# For each valid dir in $local_startup, search for init scripts matching *.sh
468#
469case ${local_startup} in
470[Nn][Oo] | '')
471 ;;
472*)
393 echo -n 'Local package initialization:'
394 for dir in ${local_startup}; do
473 echo -n 'Local package initialization:'
474 for dir in ${local_startup}; do
395 [ -d ${dir} ] && for script in ${dir}/*.sh; do
396 [ -x ${script} ] && \
397 (set -T ; trap 'exit 1' 2 ; ${script} start)
398 done
475 if [ -d "${dir}" ]; then
476 for script in ${dir}/*.sh; do
477 if [ -x "${script}" ]; then
478 (set -T
479 trap 'exit 1' 2
480 ${script} start)
481 fi
482 done
483 fi
399 done
400 echo .
484 done
485 echo .
401fi
486 ;;
487esac
402
488
403if [ "${update_motd}" != "NO" ]; then
404 T=`mktemp /tmp/_motd.XXXXXX`
405 if [ $? -eq 0 ]; then
489case ${update_motd} in
490[Nn][Oo] | '')
491 ;;
492*)
493 if T=`mktemp /tmp/_motd.XXXXXX`; then
406 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
407 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
408 cmp -s ${T} /etc/motd || {
409 cp ${T} /etc/motd
410 chmod 644 /etc/motd
411 }
412 rm -f ${T}
413 fi
494 uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
495 awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
496 cmp -s ${T} /etc/motd || {
497 cp ${T} /etc/motd
498 chmod 644 /etc/motd
499 }
500 rm -f ${T}
501 fi
502 ;;
503esac
504
505# Run rc.devfs if readable to customize devfs
506#
507if [ -r /etc/rc.devfs ]; then
508 sh /etc/rc.devfs
414fi
415
509fi
510
416# Run rc.devfs if present to customize devfs
417[ -f /etc/rc.devfs ] && sh /etc/rc.devfs
418
419# Do traditional (but rather obsolete) rc.local file if it exists. If you
420# use this file and want to make it programmatic, source /etc/defaults/rc.conf
421# in /etc/rc.local and add your custom variables to /etc/rc.conf, as
422# shown below. Please do not put local extensions into /etc/rc itself.
423# Use /etc/rc.local
424#
511# Do traditional (but rather obsolete) rc.local file if it exists. If you
512# use this file and want to make it programmatic, source /etc/defaults/rc.conf
513# in /etc/rc.local and add your custom variables to /etc/rc.conf, as
514# shown below. Please do not put local extensions into /etc/rc itself.
515# Use /etc/rc.local
516#
425# ---- rc.local ----
426# if [ -f /etc/defaults/rc.conf ]; then
427# . /etc/defaults/rc.conf
428# fi
429#
430# ... additional startup conditionals ...
431# ---- rc.local ----
432#
433if [ -f /etc/rc.local ]; then
517# ---- rc.local ----
518# if [ -r /etc/defaults/rc.conf ]; then
519# . /etc/defaults/rc.conf
520# fi
521#
522# ... additional startup conditionals ...
523# ---- rc.local ----
524#
525if [ -r /etc/rc.local ]; then
434 echo -n 'starting local daemons:'
526 echo -n 'starting local daemons:'
435 sh /etc/rc.local
527 sh /etc/rc.local
436 echo '.'
437fi
438
439# Raise kernel security level. This should be done only after `fsck' has
440# repaired local file systems if you want the securelevel to be greater than 1.
528 echo '.'
529fi
530
531# Raise kernel security level. This should be done only after `fsck' has
532# repaired local file systems if you want the securelevel to be greater than 1.
441if [ "${kern_securelevel_enable}" = "YES" -a "${kern_securelevel}" -ge 0 ];
442then
443 echo 'Raising kernel security level'
444 sysctl -w kern.securelevel=${kern_securelevel}
445fi
533#
534case ${kern_securelevel_enable} in
535[Yy][Ee][Ss])
536 if [ "${kern_securelevel}" -ge 0 ]; then
537 echo 'Raising kernel security level'
538 sysctl -w kern.securelevel=${kern_securelevel}
539 fi
540 ;;
541esac
446
447date
448exit 0
542
543date
544exit 0