mkdumprd: Use get_save_path instead of parsing config

get_save_path provides default value fail back and error check, no need
to repeat it again.

Also remove a redundant echo and grep in get_save_path

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
Kairui Song 2020-03-08 16:41:10 +08:00
parent c1c7f004c8
commit fd7e7be483
2 changed files with 3 additions and 6 deletions

View File

@ -138,11 +138,11 @@ get_root_fs_device()
get_save_path() get_save_path()
{ {
local _save_path=$(grep "^path" /etc/kdump.conf|awk '{print $2}') local _save_path=$(awk '$1 == "path" {print $2}' /etc/kdump.conf)
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH [ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
# strip the duplicated "/" # strip the duplicated "/"
echo $(echo $_save_path | tr -s /) echo $_save_path | tr -s /
} }
get_block_dump_target() get_block_dump_target()

View File

@ -13,10 +13,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf" conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa" SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(awk '/^path/ {print $2}' $conf_file) SAVE_PATH=$(get_save_path)
[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
# strip the duplicated "/"
SAVE_PATH=$(echo $SAVE_PATH | tr -s /)
OVERRIDE_RESETTABLE=0 OVERRIDE_RESETTABLE=0
extra_modules="" extra_modules=""