diff --git a/kdump-lib.sh b/kdump-lib.sh index 24a02b5..8624e19 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -14,7 +14,7 @@ is_fadump_capable() # Check if firmware-assisted dump is enabled # if no, fallback to kdump check if [[ -f $FADUMP_ENABLED_SYS_NODE ]]; then - rc=$(cat $FADUMP_ENABLED_SYS_NODE) + rc=$(<$FADUMP_ENABLED_SYS_NODE) [[ $rc -eq 1 ]] && return 0 fi return 1 @@ -59,13 +59,14 @@ to_dev_name() { case "$dev" in UUID=*) - dev=$(blkid -U "${dev#UUID=}") + blkid -U "${dev#UUID=}" ;; LABEL=*) - dev=$(blkid -L "${dev#LABEL=}") + blkid -L "${dev#LABEL=}" ;; + *) + echo "$dev" esac - echo $dev } is_user_configured_dump_target() @@ -93,12 +94,12 @@ get_block_dump_target() fi _target=$(get_user_configured_dump_disk) - [[ -n "$_target" ]] && echo $(to_dev_name $_target) && return + [[ -n "$_target" ]] && to_dev_name $_target && return # Get block device name from local save path _path=$(get_save_path) _target=$(get_target_from_path $_path) - [[ -b "$_target" ]] && echo $(to_dev_name $_target) + [[ -b "$_target" ]] && to_dev_name $_target } is_dump_to_rootfs() @@ -113,7 +114,7 @@ get_failure_action_target() if is_dump_to_rootfs; then # Get rootfs device name _target=$(get_root_fs_device) - [[ -b "$_target" ]] && echo $(to_dev_name $_target) && return + [[ -b "$_target" ]] && to_dev_name $_target && return # Then, must be nfs root echo "nfs" fi @@ -441,7 +442,7 @@ check_crash_mem_reserved() { local mem_reserved - mem_reserved=$(cat /sys/kernel/kexec_crash_size) + mem_reserved=$(