kexec-tools/mkdumprd

99 lines
1.6 KiB
Plaintext
Raw Normal View History

2006-07-20 03:36:18 +00:00
#!/bin/bash --norc
2011-07-21 10:51:33 +00:00
# New mkdumprd
2006-07-20 03:36:18 +00:00
#
2011-07-21 10:51:33 +00:00
# Copyright 2011 Red Hat, Inc.
2006-07-20 03:36:18 +00:00
#
2011-07-21 10:51:33 +00:00
# Written by Cong Wang <amwang@redhat.com>
2006-07-20 03:36:18 +00:00
#
2011-07-21 10:51:33 +00:00
export IN_KDUMP=1
2006-07-20 03:36:18 +00:00
2011-07-21 10:51:33 +00:00
conf_file="/etc/kdump.conf"
extra_modules=""
dracut_args="-H"
2006-07-20 03:36:18 +00:00
2011-07-21 10:51:33 +00:00
add_dracut_arg() {
dracut_args="$dracut_args $*"
2006-07-20 03:36:18 +00:00
}
while [ $# -gt 0 ]; do
case $1 in
2011-07-21 13:04:09 +00:00
-d)
shift
;;
2011-07-21 10:51:33 +00:00
--noconf)
conf_file=""
shift
;;
--debug)
add_dracut_arg "-v"
set -x
shift
;;
*)
break
;;
2006-07-20 03:36:18 +00:00
esac
done
2011-07-21 10:51:33 +00:00
# $1 target device
# $2 if this is a raw dump
dump_local() {
return
2006-07-20 03:36:18 +00:00
}
2011-07-21 10:51:33 +00:00
# $1 remote target
dump_remote() {
return
2006-07-20 03:36:18 +00:00
}
2011-07-21 10:51:33 +00:00
# $1 action
set_default() {
return
2006-07-20 03:36:18 +00:00
}
2011-07-21 10:51:33 +00:00
if [ -n "$conf_file" ]; then
while read config_opt config_val;
do
case "$config_opt" in
extra_modules)
2011-07-21 10:51:33 +00:00
extra_modules="$extra_modules $config_val"
2006-12-15 21:05:01 +00:00
;;
2011-07-21 10:51:33 +00:00
ext[234]|xfs|btrfs|minix)
dump_local "$config_val" 0
;;
2011-07-21 10:51:33 +00:00
raw)
dump_local "$config_val" 1
2006-12-15 21:05:01 +00:00
;;
2011-07-21 10:51:33 +00:00
net)
add_dracut_arg "--add network"
dump_remote "$config_val"
2010-02-17 16:49:26 +00:00
;;
2006-07-20 03:36:18 +00:00
*)
2011-07-21 10:51:33 +00:00
if [ -n $(echo $config_opt | grep "^#.*$") ]
2006-12-15 21:05:01 +00:00
then
2011-07-21 10:51:33 +00:00
continue
2006-12-15 21:05:01 +00:00
fi
2011-07-21 10:51:33 +00:00
dump_local ""
2006-07-20 03:36:18 +00:00
;;
esac
2011-07-21 10:51:33 +00:00
done < $conf_file
#Now parse the default actions
while read config_opt config_val;
do
2011-07-21 10:51:33 +00:00
case "$config_opt" in
default)
set_default "$config_val"
;;
2011-07-21 10:51:33 +00:00
esac
done < $conf_file
2006-07-20 03:36:18 +00:00
fi
2011-07-21 10:51:33 +00:00
if [ -n "$extra_modules" ]
then
add_dracut_arg "--add-drivers $extra_modules"
fi
2011-07-21 10:51:33 +00:00
dracut $dracut_args "$@"