1 |
c3a56ba9
|
jim-p
|
#!/bin/sh
|
2 |
ac24dc24
|
Renato Botelho
|
#
|
3 |
|
|
# rc.dumpon
|
4 |
|
|
#
|
5 |
|
|
# part of pfSense (https://www.pfsense.org)
|
6 |
|
|
# Copyright (c) 2004-2016 Electric Sheep Fencing, LLC
|
7 |
|
|
# All rights reserved.
|
8 |
|
|
#
|
9 |
|
|
# Based on src/etc/rc.d/dumpon from FreeBSD
|
10 |
|
|
#
|
11 |
b12ea3fb
|
Renato Botelho
|
# 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 |
ac24dc24
|
Renato Botelho
|
#
|
15 |
b12ea3fb
|
Renato Botelho
|
# http://www.apache.org/licenses/LICENSE-2.0
|
16 |
ac24dc24
|
Renato Botelho
|
#
|
17 |
b12ea3fb
|
Renato Botelho
|
# 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 |
27d5c1dd
|
jim-p
|
|
23 |
c3a56ba9
|
jim-p
|
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 |
ac24dc24
|
Renato Botelho
|
fi
|