2018-05-22 10:15:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. /etc/sysconfig/kdump
|
|
|
|
|
|
|
|
KDUMP_KERNEL=""
|
|
|
|
KDUMP_INITRD=""
|
|
|
|
|
|
|
|
check() {
|
2021-09-08 09:20:51 +00:00
|
|
|
if [[ ! -f /etc/sysconfig/kdump ]] || [[ ! -f /lib/kdump/kdump-lib.sh ]]\
|
|
|
|
|| [[ -n "${IN_KDUMP}" ]]
|
2018-05-22 10:15:08 +00:00
|
|
|
then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 255
|
|
|
|
}
|
|
|
|
|
|
|
|
depends() {
|
|
|
|
echo "base shutdown"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
prepare_kernel_initrd() {
|
2021-01-19 14:23:16 +00:00
|
|
|
. /lib/kdump/kdump-lib.sh
|
|
|
|
|
2020-07-27 18:40:20 +00:00
|
|
|
prepare_kdump_bootinfo
|
|
|
|
|
|
|
|
# $kernel is a variable from dracut
|
2021-09-08 09:21:41 +00:00
|
|
|
if [[ "$KDUMP_KERNELVER" != "$kernel" ]]; then
|
2020-07-27 18:40:20 +00:00
|
|
|
dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
|
|
|
|
"but the initramfs is generated for kernel version '$kernel'"
|
2018-05-22 10:15:08 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install() {
|
2019-01-10 06:44:15 +00:00
|
|
|
prepare_kernel_initrd
|
2021-09-08 09:20:51 +00:00
|
|
|
if [[ ! -f "$KDUMP_KERNEL" ]]; then
|
2019-01-10 06:44:15 +00:00
|
|
|
derror "Could not find required kernel for earlykdump," \
|
|
|
|
"earlykdump will not work!"
|
|
|
|
return 1
|
|
|
|
fi
|
2021-09-08 09:20:51 +00:00
|
|
|
if [[ ! -f "$KDUMP_INITRD" ]]; then
|
2019-01-10 06:44:15 +00:00
|
|
|
derror "Could not find required kdump initramfs for earlykdump," \
|
|
|
|
"please ensure kdump initramfs is generated first," \
|
|
|
|
"earlykdump will not work!"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2018-05-22 10:15:08 +00:00
|
|
|
inst_multiple tail find cut dirname hexdump
|
|
|
|
inst_simple "/etc/sysconfig/kdump"
|
|
|
|
inst_binary "/usr/sbin/kexec"
|
|
|
|
inst_binary "/usr/bin/gawk" "/usr/bin/awk"
|
2020-10-27 09:04:22 +00:00
|
|
|
inst_binary "/usr/bin/logger" "/usr/bin/logger"
|
|
|
|
inst_binary "/usr/bin/printf" "/usr/bin/printf"
|
2018-05-22 10:15:08 +00:00
|
|
|
inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
2020-10-27 09:04:22 +00:00
|
|
|
inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
|
2018-05-22 10:15:08 +00:00
|
|
|
inst_hook cmdline 00 "$moddir/early-kdump.sh"
|
|
|
|
inst_binary "$KDUMP_KERNEL"
|
|
|
|
inst_binary "$KDUMP_INITRD"
|
2019-01-10 10:07:41 +00:00
|
|
|
|
2020-07-26 17:37:19 +00:00
|
|
|
ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump"
|
|
|
|
ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump"
|
2019-01-10 10:07:41 +00:00
|
|
|
|
2019-01-09 14:29:52 +00:00
|
|
|
chmod -x "${initdir}/$KDUMP_KERNEL"
|
2018-05-22 10:15:08 +00:00
|
|
|
}
|