drcut-kdump.sh: cleanup kdump.conf check

move conf_file as a global variable to the top.
vivek: return earlier if kdump.conf is not found in read_kdump_conf to
avoid the deep indent.

Signed-off-by: Dave Young <dyoung@redhat.com>
Acked-by: Vivek Goyal <vgoyal@redhat.com>
This commit is contained in:
Dave Young 2012-06-14 09:55:54 +08:00
parent 16e24a1197
commit 33d933f800

View File

@ -13,6 +13,7 @@ KDUMP_SCRIPT_DIR="/kdumpscripts"
DD_BLKSIZE=512
FINAL_ACTION="reboot -f"
DUMP_RETVAL=0
conf_file="/etc/kdump.conf"
export PATH=$PATH:$KDUMP_SCRIPT_DIR
@ -124,8 +125,11 @@ dump_ssh()
read_kdump_conf()
{
local conf_file="/etc/kdump.conf"
if [ -f "$conf_file" ]; then
if [ ! -f "$conf_file" ]; then
echo "$conf_file not found"
return
fi
# first get the necessary variables
while read config_opt config_val;
do
@ -180,7 +184,6 @@ read_kdump_conf()
;;
esac
done < $conf_file
fi
}
read_kdump_conf