Handle rootfs correctly

This commit is contained in:
Cong Wang 2012-01-25 12:18:51 +08:00
parent 8e0b475887
commit 2630148dc7
2 changed files with 21 additions and 3 deletions

View File

@ -1,6 +1,6 @@
Name: kexec-tools
Version: 2.0.3
Release: 32%{?dist}
Release: 33%{?dist}
License: GPLv2
Group: Applications/System
Summary: The kexec/kdump userspace component.
@ -289,6 +289,9 @@ done
%changelog
* Wed Jan 25 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-33
- Handle rootfs correctly.
* Tue Jan 10 2012 Cong Wang <xiyou.wangcong@gmail.com> - 2.0.2-32
- Fix add_dracut_arg in mkdumprd.

View File

@ -65,6 +65,10 @@ to_dev_name() {
echo $dev
}
get_rootdev() {
mount | grep 'on / ' | grep -v rootfs | awk '{print $1}'
}
to_mount() {
local _dev=$(to_dev_name $1)
echo "$(grep "$_dev" /proc/mounts | cut -d' ' -f1-4)"
@ -75,6 +79,7 @@ check_remote() {
return
}
add_dracut_mount "$(to_mount "$(get_rootdev)")"
if [ -n "$conf_file" ]; then
while read config_opt config_val;
do
@ -83,7 +88,16 @@ if [ -n "$conf_file" ]; then
extra_modules="$extra_modules $config_val"
;;
ext[234]|xfs|btrfs|minix)
add_dracut_mount "$(to_mount $config_val)"
_dev=$(to_dev_name "$config_val")
_mnt=$(to_mount "$config_val")
if [ "$_dev" = "$(get_rootdev)" ]; then
:
elif [ -n "$_mnt" ]; then
add_dracut_mount "$_mnt"
else
echo "Dump target $config_val is probably not mounted."
exit 1
fi
;;
raw)
#TODO
@ -120,6 +134,7 @@ then
fi
dracut "${dracut_args[@]}" -M "$@"
_rc=$?
sync
exit $?
exit $_rc