|
|
db7d74 |
#!/bin/bash
|
|
|
db7d74 |
|
|
|
db7d74 |
. /etc/sysconfig/kdump
|
|
|
db7d74 |
|
|
|
db7d74 |
KDUMP_KERNEL=""
|
|
|
db7d74 |
KDUMP_INITRD=""
|
|
|
db7d74 |
|
|
|
db7d74 |
check() {
|
|
|
4a6108 |
if [[ ! -f /etc/sysconfig/kdump ]] || [[ ! -f /lib/kdump/kdump-lib.sh ]] \
|
|
|
4a6108 |
|| [[ -n ${IN_KDUMP} ]]; then
|
|
|
db7d74 |
return 1
|
|
|
db7d74 |
fi
|
|
|
db7d74 |
return 255
|
|
|
db7d74 |
}
|
|
|
db7d74 |
|
|
|
db7d74 |
depends() {
|
|
|
db7d74 |
echo "base shutdown"
|
|
|
db7d74 |
return 0
|
|
|
db7d74 |
}
|
|
|
db7d74 |
|
|
|
db7d74 |
prepare_kernel_initrd() {
|
|
|
db7d74 |
. /lib/kdump/kdump-lib.sh
|
|
|
db7d74 |
|
|
|
db7d74 |
prepare_kdump_bootinfo
|
|
|
db7d74 |
|
|
|
db7d74 |
# $kernel is a variable from dracut
|
|
|
4a6108 |
if [[ $KDUMP_KERNELVER != "$kernel" ]]; then
|
|
|
db7d74 |
dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \
|
|
|
db7d74 |
"but the initramfs is generated for kernel version '$kernel'"
|
|
|
db7d74 |
fi
|
|
|
db7d74 |
}
|
|
|
db7d74 |
|
|
|
db7d74 |
install() {
|
|
|
db7d74 |
prepare_kernel_initrd
|
|
|
4a6108 |
if [[ ! -f $KDUMP_KERNEL ]]; then
|
|
|
db7d74 |
derror "Could not find required kernel for earlykdump," \
|
|
|
db7d74 |
"earlykdump will not work!"
|
|
|
db7d74 |
return 1
|
|
|
db7d74 |
fi
|
|
|
4a6108 |
if [[ ! -f $KDUMP_INITRD ]]; then
|
|
|
db7d74 |
derror "Could not find required kdump initramfs for earlykdump," \
|
|
|
db7d74 |
"please ensure kdump initramfs is generated first," \
|
|
|
db7d74 |
"earlykdump will not work!"
|
|
|
db7d74 |
return 1
|
|
|
db7d74 |
fi
|
|
|
db7d74 |
|
|
|
db7d74 |
inst_multiple tail find cut dirname hexdump
|
|
|
db7d74 |
inst_simple "/etc/sysconfig/kdump"
|
|
|
db7d74 |
inst_binary "/usr/sbin/kexec"
|
|
|
db7d74 |
inst_binary "/usr/bin/gawk" "/usr/bin/awk"
|
|
|
db7d74 |
inst_binary "/usr/bin/logger" "/usr/bin/logger"
|
|
|
db7d74 |
inst_binary "/usr/bin/printf" "/usr/bin/printf"
|
|
|
455616 |
inst_binary "/usr/bin/xargs" "/usr/bin/xargs"
|
|
|
db7d74 |
inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
|
|
455616 |
inst_script "/lib/kdump/kdump-lib-initramfs.sh" "/lib/kdump/kdump-lib-initramfs.sh"
|
|
|
db7d74 |
inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh"
|
|
|
db7d74 |
inst_hook cmdline 00 "$moddir/early-kdump.sh"
|
|
|
db7d74 |
inst_binary "$KDUMP_KERNEL"
|
|
|
db7d74 |
inst_binary "$KDUMP_INITRD"
|
|
|
db7d74 |
|
|
|
db7d74 |
ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump"
|
|
|
db7d74 |
ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump"
|
|
|
db7d74 |
|
|
|
db7d74 |
chmod -x "${initdir}/$KDUMP_KERNEL"
|
|
|
db7d74 |
}
|