diff --git a/kdump_dracut_modules/99kdumpbase/install b/kdump_dracut_modules/99kdumpbase/install index bfc4761..c237329 100755 --- a/kdump_dracut_modules/99kdumpbase/install +++ b/kdump_dracut_modules/99kdumpbase/install @@ -4,5 +4,7 @@ inst "/bin/date" "/bin/date" inst "/bin/sync" "/bin/sync" inst "/usr/bin/reboot" "/bin/reboot" inst "/sbin/makedumpfile" "/sbin/makedumpfile" +inst "/etc/kdump.conf" "/etc/kdump.conf" +inst "$moddir/kdump-lib.sh" "/lib/kdump-lib.sh" inst_hook pre-pivot 01 "$moddir/kdump_localfs.sh" diff --git a/kdump_dracut_modules/99kdumpbase/kdump-lib.sh b/kdump_dracut_modules/99kdumpbase/kdump-lib.sh new file mode 100755 index 0000000..51b2095 --- /dev/null +++ b/kdump_dracut_modules/99kdumpbase/kdump-lib.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +KDUMP_PATH="/var/crash" +CORE_COLLECTOR="makedumpfile -d 31 -c" + +read_kdump_conf() +{ + local conf_file="/etc/kdump.conf" + if [ -f "$conf_file" ]; then + while read config_opt config_val; + do + case "$config_opt" in + path) + KDUMP_PATH="$config_val" + ;; + core_collector) + CORE_COLLECTOR="$config_val" + ;; + default) + ;; + esac + done < $conf_file + fi +} + +do_default_action() +{ + return +} + diff --git a/kdump_dracut_modules/99kdumpbase/kdump_localfs.sh b/kdump_dracut_modules/99kdumpbase/kdump_localfs.sh index 513142b..96a27a8 100755 --- a/kdump_dracut_modules/99kdumpbase/kdump_localfs.sh +++ b/kdump_dracut_modules/99kdumpbase/kdump_localfs.sh @@ -1,13 +1,17 @@ #!/bin/sh +. /lib/kdump-lib.sh +read_kdump_conf set -x + # We have the root file system mounted under $NEWROOT, so copy # the vmcore there and call it a day # DATEDIR=`date +%d.%m.%y-%T` + mount -o remount,rw $NEWROOT/ -mkdir -p $NEWROOT/var/crash/$DATEDIR -cp /proc/vmcore $NEWROOT/var/crash/$DATEDIR/vmcore +mkdir -p $NEWROOT/$KDUMP_PATH/$DATEDIR +$CORE_COLLECTOR /proc/vmcore $NEWROOT/$KDUMP_PATH/$DATEDIR/vmcore sync # Once the copy is done, just reboot the system diff --git a/kexec-tools.spec b/kexec-tools.spec index a94d5ab..12a69e2 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -1,6 +1,6 @@ Name: kexec-tools Version: 2.0.2 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2 Group: Applications/System Summary: The kexec/kdump userspace component. @@ -281,6 +281,9 @@ done %changelog +* Mon Jul 25 2011 Cong Wang - 2.0.2-8 +- Move path/core_collector/default parsing code to initrd. + * Mon Jul 25 2011 Cong Wang - 2.0.2-7 - Remove obsolete code in kdumpctl.