ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- module-setup.sh000075500000003310152347120730007527 0ustar00#!/bin/bash . /etc/sysconfig/kdump KDUMP_KERNEL="" KDUMP_INITRD="" check() { if [ ! -f /etc/sysconfig/kdump ] || [ ! -f /lib/kdump/kdump-lib.sh ]\ || [ -n "${IN_KDUMP}" ] then return 1 fi return 255 } depends() { echo "base shutdown" return 0 } prepare_kernel_initrd() { . /lib/kdump/kdump-lib.sh prepare_kdump_bootinfo # $kernel is a variable from dracut if [ "$KDUMP_KERNELVER" != $kernel ]; then dwarn "Using kernel version '$KDUMP_KERNELVER' for early kdump," \ "but the initramfs is generated for kernel version '$kernel'" fi } install() { prepare_kernel_initrd if [ ! -f "$KDUMP_KERNEL" ]; then derror "Could not find required kernel for earlykdump," \ "earlykdump will not work!" return 1 fi if [ ! -f "$KDUMP_INITRD" ]; then derror "Could not find required kdump initramfs for earlykdump," \ "please ensure kdump initramfs is generated first," \ "earlykdump will not work!" return 1 fi 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" inst_binary "/usr/bin/logger" "/usr/bin/logger" inst_binary "/usr/bin/printf" "/usr/bin/printf" inst_script "/lib/kdump/kdump-lib.sh" "/lib/kdump-lib.sh" inst_script "/lib/kdump/kdump-logger.sh" "/lib/kdump-logger.sh" inst_hook cmdline 00 "$moddir/early-kdump.sh" inst_binary "$KDUMP_KERNEL" inst_binary "$KDUMP_INITRD" ln_r "$KDUMP_KERNEL" "/boot/kernel-earlykdump" ln_r "$KDUMP_INITRD" "/boot/initramfs-earlykdump" chmod -x "${initdir}/$KDUMP_KERNEL" } early-kdump.sh000075500000003572152347120730007350 0ustar00#! /bin/sh KEXEC=/sbin/kexec standard_kexec_args="-p" EARLY_KDUMP_INITRD="" EARLY_KDUMP_KERNEL="" EARLY_KDUMP_CMDLINE="" EARLY_KDUMP_KERNELVER="" EARLY_KEXEC_ARGS="" . /etc/sysconfig/kdump . /lib/dracut-lib.sh . /lib/kdump-lib.sh . /lib/kdump-logger.sh #initiate the kdump logger dlog_init if [ $? -ne 0 ]; then echo "failed to initiate the kdump logger." exit 1 fi prepare_parameters() { EARLY_KDUMP_CMDLINE=$(prepare_cmdline "${KDUMP_COMMANDLINE}" "${KDUMP_COMMANDLINE_REMOVE}" "${KDUMP_COMMANDLINE_APPEND}") EARLY_KDUMP_KERNEL="/boot/kernel-earlykdump" EARLY_KDUMP_INITRD="/boot/initramfs-earlykdump" } early_kdump_load() { check_kdump_feasibility if [ $? -ne 0 ]; then return 1 fi if is_fadump_capable; then dwarn "WARNING: early kdump doesn't support fadump." return 1 fi check_current_kdump_status if [ $? == 0 ]; then return 1 fi prepare_parameters EARLY_KEXEC_ARGS=$(prepare_kexec_args "${KEXEC_ARGS}") # Here, only output the messages, but do not save these messages # to a file because the target disk may not be mounted yet, the # earlykdump is too early. ddebug "earlykdump: $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \ --command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \ $EARLY_KDUMP_KERNEL" $KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \ --command-line="$EARLY_KDUMP_CMDLINE" \ --initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL if [ $? == 0 ]; then dinfo "kexec: loaded early-kdump kernel" return 0 else derror "kexec: failed to load early-kdump kernel" return 1 fi } set_early_kdump() { if getargbool 0 rd.earlykdump; then dinfo "early-kdump is enabled." early_kdump_load else dinfo "early-kdump is disabled." fi return 0 } set_early_kdump