move path/core_collector/default parsing code to initrd.

This commit is contained in:
Amerigo Wang 2011-07-25 19:38:43 +08:00
parent 4a7c912848
commit be4b40969b
4 changed files with 42 additions and 3 deletions

View File

@ -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"

View File

@ -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
}

View File

@ -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

View File

@ -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 <xiyou.wangcong@gmail.com> - 2.0.2-8
- Move path/core_collector/default parsing code to initrd.
* Mon Jul 25 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-7
- Remove obsolete code in kdumpctl.