kexec-tools/mkdumprd
2011-07-21 21:04:09 +08:00

99 lines
1.6 KiB
Bash

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