summaryrefslogtreecommitdiffstats
path: root/etc/rc.dumpon
blob: fad1a82493ad01f923c883e597d0d70e5ffa6714 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/sh
# Based on:
# FreeBSD: src/etc/rc.d/dumpon,v 1.12.2.1.4.1 2010/06/14 02:09:06 kensmith Exp

# dumpon

dumpon_try()
{
	if /sbin/dumpon "${1}" ; then
		# Make a symlink in devfs for savecore
		echo "Using ${1} for dump device."
		ln -fs "${1}" /dev/dumpdev
		return 0
	fi
	echo "Unable to specify $1 as a dump device."
	return 1
}

# Enable dumpdev so that savecore can see it. Enable it
# early so a crash early in the boot process can be caught.
#
while read dev mp type more ; do
	[ "${type}" = "swap" ] || continue
	[ -c "${dev}" ] || continue
	dumpon_try "${dev}" && works=true
done </etc/fstab
if [ "${works}" != "true" ]; then
	echo "No suitable dump device was found." 1>&2
	exit
fi

# ddb
if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
	/sbin/ddb /etc/ddb.conf
fi
OpenPOWER on IntegriCloud