kdump.sh cleanup for fstab handling

This commit is contained in:
Cong Wang 2012-01-25 15:25:39 +08:00
parent 2630148dc7
commit 8a14c620b7
2 changed files with 9 additions and 9 deletions

View File

@ -25,16 +25,15 @@ add_dump_code()
fi fi
} }
add_to_fstab() get_mp()
{ {
local _mp local _mp
while read dev mp fs opts rest; do while read dev mp fs opts rest; do
if [ "$dev" = "$1" ]; then if [ "$dev" = "$1" ]; then
_mp=$NEWROOT$mp _mp="$mp"
echo "$dev $NEWROOT$mp $fs ${opts},rw $rest"
break break
fi fi
done < "$NEWROOT/etc/fstab" >> /etc/fstab done < /proc/mounts
echo "$_mp" echo "$_mp"
} }
@ -56,12 +55,10 @@ to_dev_name()
dump_localfs() dump_localfs()
{ {
local _dev=`to_dev_name $1` local _dev=`to_dev_name $1`
local _mp=`add_to_fstab $_dev` local _mp=`get_mp $_dev`
if [ $_mp = "$NEWROOT/" ] || [ $_mp = "$NEWROOT" ] if [ "$_mp" = "$NEWROOT/" ] || [ "$_mp" = "$NEWROOT" ]
then then
mount -o remount,rw $_mp || return 1 mount -o remount,rw $_mp || return 1
else
mount $_mp || return 1
fi fi
mkdir -p $_mp/$KDUMP_PATH/$DATEDIR mkdir -p $_mp/$KDUMP_PATH/$DATEDIR
$CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1 $CORE_COLLECTOR /proc/vmcore $_mp/$KDUMP_PATH/$DATEDIR/vmcore || return 1

View File

@ -1,6 +1,6 @@
Name: kexec-tools Name: kexec-tools
Version: 2.0.3 Version: 2.0.3
Release: 33%{?dist} Release: 34%{?dist}
License: GPLv2 License: GPLv2
Group: Applications/System Group: Applications/System
Summary: The kexec/kdump userspace component. Summary: The kexec/kdump userspace component.
@ -289,6 +289,9 @@ done
%changelog %changelog
* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-34
- kdump.sh cleanup for fstab handling, from Dave Young.
* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-33 * Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-33
- Handle rootfs correctly. - Handle rootfs correctly.