freebsd-dev/etc/rc.d/dumpon
obrien 44676e4d9e 'dumpon' can run before 'initrandom' so make it.
This gives a better chance of debugging /dev/random related panics.
2005-04-05 18:59:24 +00:00

58 lines
930 B
Bash

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: dumpon
# REQUIRE: rcconf
# BEFORE: disks savecore initrandom
# KEYWORD: nojail
. /etc/rc.subr
name="dumpon"
start_cmd="dumpon_start"
stop_cmd="dumpon_stop"
dumpon_start()
{
# Enable dumpdev so that savecore can see it. Enable it
# early so a crash early in the boot process can be caught.
#
case ${dumpdev} in
[Nn][Oo] | '')
;;
[Aa][Uu][Tt][Oo])
while read dev mp type more ; do
[ "${type}" = "swap" ] || continue
[ -c "${dev}" ] || continue
if /sbin/dumpon -v "${dev}" 2>/dev/null; then
# Make a symlink in devfs for savecore
ln -s ${dev} /dev/dumpdev
return 0
fi
done </etc/fstab
echo "No suitable dump device was found." 1>&2
return 1
;;
*)
/sbin/dumpon -v ${dumpdev}
;;
esac
}
dumpon_stop()
{
case ${dumpdev} in
[Nn][Oo] | '')
;;
*)
rm -f /dev/dumpdev
/sbin/dumpon -v off
;;
esac
}
load_rc_config $name
run_rc_command "$1"