Project

General

Profile

Download (1.3 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/bin/sh
2
#
3
# rc.dumpon
4
#
5
# part of pfSense (https://www.pfsense.org)
6
# Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
7
# All rights reserved.
8
#
9
# Based on src/etc/rc.d/dumpon from FreeBSD
10
#
11
# Licensed under the Apache License, Version 2.0 (the "License");
12
# you may not use this file except in compliance with the License.
13
# You may obtain a copy of the License at
14
#
15
# http://www.apache.org/licenses/LICENSE-2.0
16
#
17
# Unless required by applicable law or agreed to in writing, software
18
# distributed under the License is distributed on an "AS IS" BASIS,
19
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
# See the License for the specific language governing permissions and
21
# limitations under the License.
22

    
23
dumpon_try()
24
{
25
	if /sbin/dumpon "${1}" ; then
26
		# Make a symlink in devfs for savecore
27
		echo "Using ${1} for dump device."
28
		ln -fs "${1}" /dev/dumpdev
29
		return 0
30
	fi
31
	echo "Unable to specify $1 as a dump device."
32
	return 1
33
}
34

    
35
# Enable dumpdev so that savecore can see it. Enable it
36
# early so a crash early in the boot process can be caught.
37
#
38
while read dev mp type more ; do
39
	[ "${type}" = "swap" ] || continue
40
	[ -c "${dev}" ] || continue
41
	dumpon_try "${dev}" && works=true
42
done </etc/fstab
43
if [ "${works}" != "true" ]; then
44
	echo "No suitable dump device was found." 1>&2
45
	exit
46
fi
(31-31/83)