|
|
b9e861 |
#!/bin/bash
|
|
|
b9e861 |
|
|
|
b9e861 |
. /etc/sysconfig/kdump
|
|
|
b9e861 |
. /lib/kdump/kdump-lib.sh
|
|
|
b9e861 |
|
|
|
b9e861 |
KDUMP_KERNEL=""
|
|
|
b9e861 |
KDUMP_INITRD=""
|
|
|
b9e861 |
|
|
|
b9e861 |
check() {
|
|
|
b9e861 |
if [ ! -f /etc/sysconfig/kdump ] || [ ! -f /lib/kdump/kdump-lib.sh ]\
|
|
|
b9e861 |
|| [ -n "${IN_KDUMP}" ]
|
|
|
b9e861 |
then
|
|
|
b9e861 |
return 1
|
|
|
b9e861 |
fi
|
|
|
b9e861 |
return 255
|
|
|
b9e861 |
}
|
|
|
b9e861 |
|
|
|
b9e861 |
depends() {
|
|
|
b9e861 |
echo "base shutdown"
|
|
|
b9e861 |
return 0
|
|
|
b9e861 |
}
|
|
|
b9e861 |
|
|
|
b9e861 |
prepare_kernel_initrd() {
|
|
|
b9e861 |
KDUMP_BOOTDIR=$(check_boot_dir "${KDUMP_BOOTDIR}")
|
|
|
b9e861 |
if [ -z "$KDUMP_KERNELVER" ]; then
|
|
|
b9e861 |
kdump_kver=`uname -r`
|
|
|
b9e861 |
if [ "$kernel" != "$kdump_kver" ]; then
|
|
|
b9e861 |
dwarn "Using current kernel version '$kdump_kver' for early kdump," \
|
|
|
b9e861 |
"but the initramfs is generated for kernel version '$kernel'"
|
|
|
b9e861 |
fi
|
|
|
b9e861 |
else
|
|
|
b9e861 |
kdump_kver=$KDUMP_KERNELVER
|
|
|
b9e861 |
fi
|
|
|
b9e861 |
KDUMP_KERNEL="${KDUMP_BOOTDIR}/${KDUMP_IMG}-${kdump_kver}${KDUMP_IMG_EXT}"
|
|
|
b9e861 |
KDUMP_INITRD="${KDUMP_BOOTDIR}/initramfs-${kdump_kver}kdump.img"
|
|
|
b9e861 |
}
|
|
|
b9e861 |
|
|
|
b9e861 |
install() {
|
|
|
b9e861 |
prepare_kernel_initrd
|
|
|
b9e861 |
if [ ! -f "$KDUMP_KERNEL" ]; then
|
|
|
b9e861 |
derror "Could not find required kernel for earlykdump," \
|
|
|
b9e861 |
"earlykdump will not work!"
|
|
|
b9e861 |
return 1
|
|
|
b9e861 |
fi
|
|
|
b9e861 |
if [ ! -f "$KDUMP_INITRD" ]; then
|
|
|
b9e861 |
derror "Could not find required kdump initramfs for earlykdump," \
|
|
|
b9e861 |
"please ensure kdump initramfs is generated first," \
|
|
|
b9e861 |
"earlykdump will not work!"
|
|
|
b9e861 |
return 1
|
|
|
b9e861 |
fi
|
|
|
b9e861 |
|
|
|
b9e861 |
inst_multiple tail find cut dirname hexdump
|
|
|
b9e861 |
inst_simple "/etc/sysconfig/kdump"
|
|
|
b9e861 |
inst_binary "/usr/sbin/kexec"
|
|
|
b9e861 |
inst_binary "/usr/bin/gawk" "/usr/bin/awk"
|
|
|
b9e861 |
inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh"
|
|
|
b9e861 |
inst_hook cmdline 00 "$moddir/early-kdump.sh"
|
|
|
b9e861 |
inst_binary "$KDUMP_KERNEL"
|
|
|
b9e861 |
inst_binary "$KDUMP_INITRD"
|
|
|
b9e861 |
|
|
|
b9e861 |
ln_r "$KDUMP_KERNEL" "${KDUMP_BOOTDIR}/${KDUMP_IMG}-earlykdump${KDUMP_IMG_EXT}"
|
|
|
b9e861 |
ln_r "$KDUMP_INITRD" "${KDUMP_BOOTDIR}/initramfs-earlykdump.img"
|
|
|
b9e861 |
|
|
|
b9e861 |
chmod -x "${initdir}/$KDUMP_KERNEL"
|
|
|
b9e861 |
}
|