mkdumprd: generate udev rules in modules-setup.sh

This commit is contained in:
Amerigo Wang 2011-08-01 23:40:35 +08:00
parent 386612d259
commit 1ec4f7b1b4
5 changed files with 46 additions and 35 deletions

View File

@ -1,14 +0,0 @@
#!/bin/sh
. /lib/dracut-lib.sh
while read config_opt config_val;
do
case "$config_opt" in
ext[234]|xfs|btrfs|minix|raw)
udevmatch $config_val >> $UDEVRULESD/99-localfs.rules
;;
esac
done < /etc/kdump.conf

View File

@ -38,9 +38,25 @@ add_to_fstab()
echo "$_mp"
}
to_dev_name()
{
local dev="$1"
case "$dev" in
UUID=*)
dev=`blkid -U "${dev#UUID=}"`
;;
LABEL=*)
dev=`blkid -L "${dev#LABEL=}"`
;;
esac
echo $dev
}
dump_localfs()
{
local _mp=`add_to_fstab $1`
local _dev=`to_dev_name $1`
local _mp=`add_to_fstab $_dev`
mount $_mp || return 1
mkdir -p $_mp/$KDUMP_PATH/$DATEDIR
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1
@ -82,21 +98,6 @@ dump_ssh()
return 0
}
to_dev_name()
{
local dev="$1"
case "$dev" in
UUID=*)
dev=`blkid -U "${dev#UUID=}"`
;;
LABEL=*)
dev=`blkid -L "${dev#LABEL=}"`
;;
esac
echo $dev
}
read_kdump_conf()
{
local conf_file="/etc/kdump.conf"
@ -105,7 +106,7 @@ read_kdump_conf()
do
case "$config_opt" in
ext[234]|xfs|btrfs|minix)
add_dump_code "dump_localfs "$(to_dev_name $config_val)" || do_default_action"
add_dump_code "dump_localfs $config_val || do_default_action"
;;
raw)
add_dump_code "dump_raw $config_val || do_default_action"

View File

@ -52,6 +52,27 @@ pull_dracut_modules() {
unset MAJOR MINOR
}
to_udev_name()
{
local dev="$1"
case "$dev" in
UUID=*)
dev=`blkid -U "${dev#UUID=}"`
;;
LABEL=*)
dev=`blkid -L "${dev#LABEL=}"`
;;
esac
echo ${dev#/dev/}
}
add_udev_rules()
{
udevmatch $1 >> $moddir/99-localfs.rules
printf ", SYMLINK+=$(to_udev_name $1)" >> $moddir/99-localfs.rules
}
depends() {
local _deps="base shutdown"
while read config_opt config_val;
@ -59,6 +80,7 @@ depends() {
case "$config_opt" in
ext[234]|xfs|btrfs|minix|raw)
_deps="$_deps `pull_dracut_modules "$config_val"`"
add_udev_rules $config_val
;;
esac
done < /etc/kdump.conf
@ -72,6 +94,6 @@ install() {
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
inst "/etc/kdump.conf" "/etc/kdump.conf"
inst_hook pre-pivot 01 "$moddir/kdump.sh"
inst_hook pre-udev 40 "$moddir/block-genrules.sh"
inst_rules "$moddir/99-localfs.rules"
}

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 2.0.2
Release: 19%{?dist}
Release: 20%{?dist}
License: GPLv2
Group: Applications/System
Summary: The kexec/kdump userspace component.
@ -168,7 +168,6 @@ make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf
tar -C $RPM_BUILD_ROOT/etc/kdump-adv-conf -jxvf %{SOURCE100}
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/module-setup.sh
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/block-genrules.sh
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/kdump.sh
@ -281,6 +280,9 @@ done
%changelog
* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-20
- Generate udev rules in module-setup.sh
* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-19
- Generate udev rules to handle device names.

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
f318d715bede3872928e705d1a48b94f dracut-files.tbz2
8f9fb6eedea9f0006e4561301faab570 dracut-files.tbz2