Lines 55-66
Link Here
|
55 |
fi |
55 |
fi |
56 |
fi |
56 |
fi |
57 |
|
57 |
|
|
|
58 |
# Now that we have the filesystems mount in R/W mode, save the FreeBSD |
59 |
# core file if present; this needs to be done before enabling swap, or |
60 |
# the core will be lost for good |
61 |
freebsd_savecore() { |
62 |
[[ $(uname) != "FreeBSD" ]] && return 0 |
63 |
|
64 |
local dumpdir=${KERNEL_DUMP_DIR:-/var/crash} |
65 |
if ! [[ -d "${dumpdir}" ]]; then |
66 |
mkdir -p "${dumpdir}" |
67 |
chmod 700 "${dumpdir}" |
68 |
fi |
69 |
|
70 |
# Don't quote ${KERNEL_DUMP_DEVICE}, so that if it's unset, savecore |
71 |
# will check on the partitions listed in fstab without errors in the |
72 |
# output |
73 |
savecore -C "${dumpdir}" ${KERNEL_DUMP_DEVICE} >/dev/null || return 0 |
74 |
|
75 |
local savecoreopts="${dumpdir} ${KERNEL_DUMP_DEVICE}" |
76 |
[[ ${KERNEL_DUMP_COMPRESS} == "yes" ]] && savecoreopts="-z ${savecoreopts}" |
77 |
|
78 |
ebegin $"Saving kernel core dump" |
79 |
savecore ${savecoreopts} >/dev/null |
80 |
eend $? |
81 |
} |
82 |
|
83 |
freebsd_savecore |
84 |
|
58 |
# We do our swapping here instead of rc so we can get urandom started |
85 |
# We do our swapping here instead of rc so we can get urandom started |
59 |
# before us for people that like an encrypted swap. |
86 |
# before us for people that like an encrypted swap. |
60 |
ebegin $"Activating (possible) swap" |
87 |
ebegin $"Activating (possible) swap" |
61 |
swapon -a >/dev/null |
88 |
swapon -a >/dev/null |
62 |
eend 0 # If swapon has nothing todo it errors, so always return 0 |
89 |
eend 0 # If swapon has nothing todo it errors, so always return 0 |
63 |
|
90 |
|
|
|
91 |
# Now that the swap devices are enabled, FreeBSD users might request to |
92 |
# enable kernel dumps during panic, so run dumpon if needed. |
93 |
if [[ $(uname) == "FreeBSD" ]] && [[ -n "${KERNEL_DUMP_DEVICE}" ]]; then |
94 |
ebegin $"Activating kernel core dump device." |
95 |
dumpon "${KERNEL_DUMP_DEVICE}" |
96 |
eend $? |
97 |
fi |
98 |
|
64 |
# Start dm-crypt mappings, if any |
99 |
# Start dm-crypt mappings, if any |
65 |
start_addon dm-crypt |
100 |
start_addon dm-crypt |
66 |
|
101 |
|