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:
parent
c1c7f004c8
commit
fd7e7be483
@ -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()
|
||||||
|
5
mkdumprd
5
mkdumprd
@ -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=""
|
||||||
|
Loading…
Reference in New Issue
Block a user