mkdumprd: install modified kdump.conf in initrd

This commit is contained in:
Amerigo Wang 2011-08-02 16:42:21 +08:00
parent 9ea3801214
commit b9f39e444a
3 changed files with 17 additions and 4 deletions

View File

@ -69,7 +69,6 @@ to_udev_name() {
add_lvm_code() {
local dev="/dev/$(to_udev_name $1)"
local lv
printf '#!/bin/sh\n' > $moddir/kdump-prepare.sh
printf "lvm lvchange -ay --sysinit ">> $moddir/kdump-prepare.sh
lv=$(lvm lvdisplay $dev | awk '/LV Name/ {print $3}')
echo ${lv#/dev/} >> $moddir/kdump-prepare.sh
@ -92,6 +91,14 @@ add_udev_rules() {
udevmatch $1 >> $moddir/90-localfs.rules
}
gen_new_conf () {
if [ ! -f $2 ]
then
sed -ne '/^#/!p' /etc/kdump.conf > $2
fi
sed -i -e "s#$1#/dev/$(to_udev_name $1)#" $2
}
depends() {
local _deps="base shutdown"
while read config_opt config_val;
@ -108,13 +115,16 @@ depends() {
install() {
echo -n "" > $moddir/90-localfs.rules
printf '#!/bin/sh\n' > $moddir/kdump-prepare.sh
chmod +x $moddir/kdump-prepare.sh
while read config_opt config_val;
do
case "$config_opt" in
ext[234]|xfs|btrfs|minix|raw)
add_udev_rules $config_val
add_lvm_code $config_val
gen_new_conf $config_val /tmp/$$-kdump.conf
;;
esac
done < /etc/kdump.conf
@ -122,7 +132,7 @@ install() {
inst "/bin/date" "/bin/date"
inst "/bin/sync" "/bin/sync"
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
inst "/etc/kdump.conf" "/etc/kdump.conf"
inst "/tmp/$$-kdump.conf" "/etc/kdump.conf"
inst_hook pre-pivot 01 "$moddir/kdump-prepare.sh"
inst_hook pre-pivot 02 "$moddir/kdump.sh"
inst_rules "$moddir/90-localfs.rules"

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 2.0.2
Release: 22%{?dist}
Release: 23%{?dist}
License: GPLv2
Group: Applications/System
Summary: The kexec/kdump userspace component.
@ -280,6 +280,9 @@ done
%changelog
* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-23
- Install modified kdump.conf in initrd.
* Tue Aug 2 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-22
- Handle lvm in pre-pivot hook.

View File

@ -2,4 +2,4 @@ d9f2ecd3c3307905f24130a25816e6cc kexec-tools-2.0.0.tar.bz2
3e802d638dce0080b910f15908c04a24 kexec-tools-po.tar.gz
e3a813bd6d7dace903a05c1296e20d57 makedumpfile-1.3.5.tar.gz
8e359dd03731b93a2082bd37cc2a4a4c kexec-tools-2.0.2.tar.bz2
ed5b216591c1913eeac70449ca810cf7 dracut-files.tbz2
dccb3e4bfa087c2cad6d4eccaa452b66 dracut-files.tbz2