kdumpctl: simplify local_fs_dump_target

Make use of the new ${OPT[]} array and simplify local_fs_dump_target to
remove one more file operations.

While at it rename the local_fs_dump_target to is_local_target

Signed-off-by: Philipp Rudo <prudo@redhat.com>
Reviewed-by: Tao Liu <ltao@redhat.com>
Reviewed-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Philipp Rudo 2022-03-25 15:47:11 +01:00 committed by Coiby Xu
parent ac5968218f
commit 55b5c4e2b0

View File

@ -850,27 +850,22 @@ save_raw()
return 0 return 0
} }
local_fs_dump_target() is_local_target()
{ {
local _target [[ ${OPT[_fstype]} =~ ^ext[234]|^xfs|^btrfs|^minix ]]
if _target=$(grep -E "^ext[234]|^xfs|^btrfs|^minix" /etc/kdump.conf); then
echo "$_target" | awk '{print $2}'
fi
} }
path_to_be_relabeled() path_to_be_relabeled()
{ {
local _path _target _mnt="/" _rmnt local _path _mnt="/" _rmnt
if is_user_configured_dump_target; then if is_user_configured_dump_target; then
if is_mount_in_dracut_args; then if is_mount_in_dracut_args; then
return return
fi fi
_target=$(local_fs_dump_target) if is_local_target; then
if [[ -n $_target ]]; then _mnt=$(get_mntpoint_from_target "${OPT[_target]}")
_mnt=$(get_mntpoint_from_target "$_target")
if ! is_mounted "$_mnt"; then if ! is_mounted "$_mnt"; then
return return
fi fi