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=""
|
2011-07-28 14:50:43 +00:00
|
|
|
dracut_args="-H -o i18n -o plymouth --add shutdown -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
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2011-07-28 14:50:43 +00:00
|
|
|
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
|
2011-07-28 14:50:43 +00:00
|
|
|
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
|
2008-02-22 12:40:20 +00:00
|
|
|
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)
|
2011-07-28 14:50:43 +00:00
|
|
|
check_local "$config_val" 0
|
2010-06-13 19:20:48 +00:00
|
|
|
;;
|
2011-07-21 10:51:33 +00:00
|
|
|
raw)
|
2011-07-28 14:50:43 +00:00
|
|
|
check_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"
|
2011-07-28 14:50:43 +00:00
|
|
|
check_remote "$config_val"
|
2010-02-17 16:49:26 +00:00
|
|
|
;;
|
2011-07-25 10:02:37 +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"
|
2010-06-13 19:20:48 +00:00
|
|
|
fi
|
|
|
|
|
2011-07-21 10:51:33 +00:00
|
|
|
dracut $dracut_args "$@"
|
2011-07-28 14:50:43 +00:00
|
|
|
exit $?
|
2008-02-22 12:40:20 +00:00
|
|
|
|