mkdumprd: generate udev rules to handle device names
This commit is contained in:
parent
1048810fe0
commit
386612d259
14
kdump_dracut_modules/99kdumpbase/block-genrules.sh
Executable file
14
kdump_dracut_modules/99kdumpbase/block-genrules.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
|
@ -25,13 +25,25 @@ add_dump_code()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
add_to_fstab()
|
||||||
|
{
|
||||||
|
local _mp
|
||||||
|
while read dev mp fs opts rest; do
|
||||||
|
if [ "$dev" = "$1" ]; then
|
||||||
|
_mp=$NEWROOT$mp
|
||||||
|
echo "$dev $NEWROOT$mp $fs ${opts},ro $rest"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done < "$NEWROOT/etc/fstab" >> /etc/fstab
|
||||||
|
echo "$_mp"
|
||||||
|
}
|
||||||
|
|
||||||
dump_localfs()
|
dump_localfs()
|
||||||
{
|
{
|
||||||
mount -o remount,rw $NEWROOT/ || return 1
|
local _mp=`add_to_fstab $1`
|
||||||
[ -d $NEWROOT/mnt ] || mkdir -p $NEWROOT/mnt
|
mount $_mp || return 1
|
||||||
mount -t $1 $2 $NEWROOT/mnt || return 1
|
mkdir -p $_mp/$KDUMP_PATH/$DATEDIR
|
||||||
mkdir -p $NEWROOT/mnt/$KDUMP_PATH/$DATEDIR
|
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1
|
||||||
$CORE_COLLECTOR /proc/vmcore $NEWROOT/mnt/$KDUMP_PATH/$DATEDIR/vmcore || return 1
|
|
||||||
umount /mnt || return 1
|
umount /mnt || return 1
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -72,14 +84,17 @@ dump_ssh()
|
|||||||
|
|
||||||
to_dev_name()
|
to_dev_name()
|
||||||
{
|
{
|
||||||
local _dev=$1
|
local dev="$1"
|
||||||
local _is_uuid=`echo $1 | grep UUID`
|
|
||||||
local _is_label=`echo $1 | grep LABEL`
|
case "$dev" in
|
||||||
if [ -n "$_is_uuid" -o -n "$_is_label" ]
|
UUID=*)
|
||||||
then
|
dev=`blkid -U "${dev#UUID=}"`
|
||||||
_dev=`findfs $1`
|
;;
|
||||||
fi
|
LABEL=*)
|
||||||
echo $_dev
|
dev=`blkid -L "${dev#LABEL=}"`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
echo $dev
|
||||||
}
|
}
|
||||||
|
|
||||||
read_kdump_conf()
|
read_kdump_conf()
|
||||||
@ -90,7 +105,7 @@ read_kdump_conf()
|
|||||||
do
|
do
|
||||||
case "$config_opt" in
|
case "$config_opt" in
|
||||||
ext[234]|xfs|btrfs|minix)
|
ext[234]|xfs|btrfs|minix)
|
||||||
add_dump_code "dump_localfs $config_opt "$(to_dev_name $config_val)" || do_default_action"
|
add_dump_code "dump_localfs "$(to_dev_name $config_val)" || do_default_action"
|
||||||
;;
|
;;
|
||||||
raw)
|
raw)
|
||||||
add_dump_code "dump_raw $config_val || do_default_action"
|
add_dump_code "dump_raw $config_val || do_default_action"
|
||||||
|
@ -69,9 +69,9 @@ depends() {
|
|||||||
install() {
|
install() {
|
||||||
inst "/bin/date" "/bin/date"
|
inst "/bin/date" "/bin/date"
|
||||||
inst "/bin/sync" "/bin/sync"
|
inst "/bin/sync" "/bin/sync"
|
||||||
inst "/sbin/findfs" "/sbin/findfs"
|
|
||||||
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
|
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
|
||||||
inst "/etc/kdump.conf" "/etc/kdump.conf"
|
inst "/etc/kdump.conf" "/etc/kdump.conf"
|
||||||
inst_hook pre-pivot 01 "$moddir/kdump.sh"
|
inst_hook pre-pivot 01 "$moddir/kdump.sh"
|
||||||
|
inst_hook pre-udev 40 "$moddir/block-genrules.sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Name: kexec-tools
|
Name: kexec-tools
|
||||||
Version: 2.0.2
|
Version: 2.0.2
|
||||||
Release: 18%{?dist}
|
Release: 19%{?dist}
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
Group: Applications/System
|
Group: Applications/System
|
||||||
Summary: The kexec/kdump userspace component.
|
Summary: The kexec/kdump userspace component.
|
||||||
@ -168,6 +168,7 @@ make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT
|
|||||||
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf
|
mkdir -p -m755 $RPM_BUILD_ROOT/etc/kdump-adv-conf
|
||||||
tar -C $RPM_BUILD_ROOT/etc/kdump-adv-conf -jxvf %{SOURCE100}
|
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/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
|
chmod 755 $RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/kdump.sh
|
||||||
|
|
||||||
|
|
||||||
@ -280,6 +281,9 @@ done
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-19
|
||||||
|
- Generate udev rules to handle device names.
|
||||||
|
|
||||||
* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-18
|
* Mon Aug 1 2011 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-18
|
||||||
- Fix dump to local filesystem and raw dump.
|
- Fix dump to local filesystem and raw dump.
|
||||||
|
|
||||||
|
2
sources
2
sources
@ -2,4 +2,4 @@ d9f2ecd3c3307905f24130a25816e6cc kexec-tools-2.0.0.tar.bz2
|
|||||||
3e802d638dce0080b910f15908c04a24 kexec-tools-po.tar.gz
|
3e802d638dce0080b910f15908c04a24 kexec-tools-po.tar.gz
|
||||||
e3a813bd6d7dace903a05c1296e20d57 makedumpfile-1.3.5.tar.gz
|
e3a813bd6d7dace903a05c1296e20d57 makedumpfile-1.3.5.tar.gz
|
||||||
8e359dd03731b93a2082bd37cc2a4a4c kexec-tools-2.0.2.tar.bz2
|
8e359dd03731b93a2082bd37cc2a4a4c kexec-tools-2.0.2.tar.bz2
|
||||||
354f51df313598f3ee0429c3ab19242c dracut-files.tbz2
|
f318d715bede3872928e705d1a48b94f dracut-files.tbz2
|
||||||
|
Loading…
Reference in New Issue
Block a user