Always use get_save_path to get the 'path' option

This help deduplicate the code. Use a single function instead of
repeat the same logic.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
Kairui Song 2019-11-30 23:46:55 +08:00
parent d10f202996
commit 03111c797b
2 changed files with 7 additions and 17 deletions

View File

@ -428,12 +428,7 @@ default_dump_target_install_conf()
is_user_configured_dump_target && return
_save_path=$(get_option_value "path")
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
# strip the duplicated "/"
_save_path=$(echo $_save_path | tr -s /)
_save_path=$(get_save_path)
_mntpoint=$(get_mntpoint_from_path $_save_path)
_target=$(get_target_from_path $_save_path)
@ -472,13 +467,9 @@ default_dump_target_install_conf()
adjust_bind_mount_path()
{
local _target=$1
local _save_path=$(get_option_value "path")
[ -z "$_save_path" ] && _save_path=$DEFAULT_PATH
# strip the duplicated "/"
_save_path=$(echo $_save_path | tr -s /)
local _save_path=$(get_save_path)
local _absolute_save_path=$(get_mntpoint_from_target $_target)/$_save_path
_absolute_save_path=$(echo "$_absolute_save_path" | tr -s /)
local _mntpoint=$(get_mntpoint_from_path $_absolute_save_path)

View File

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