kexec-tools/mkdumprd

95 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="-m kdumpbase --add dash -c /dev/null"
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
}
add_dracut_module() {
add_dracut_arg "--add $1"
}
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
check_local() {
2011-07-21 10:51:33 +00:00
return
2006-07-20 03:36:18 +00:00
}
2011-07-21 10:51:33 +00:00
# $1 remote target
check_remote() {
2011-07-21 10:51:33 +00:00
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)
check_local "$config_val" 0
;;
2011-07-21 10:51:33 +00:00
raw)
check_local "$config_val" 1
2006-12-15 21:05:01 +00:00
;;
2011-07-21 10:51:33 +00:00
net)
check_remote "$config_val"
add_dracut_module "nfs"
2010-02-17 16:49:26 +00:00
;;
core_collector)
add_dracut_arg "-I ${config_val% *}"
;;
extra_bins)
add_dracut_arg "-I $config_val"
;;
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
2006-07-20 03:36:18 +00:00
;;
esac
2011-07-21 10:51:33 +00:00
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
dracut $dracut_args -M "$@"
exit $?