dracut-early-kdump.sh: make it POSIX compatible

Refactor and remove bash only syntax.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
Kairui Song 2021-09-13 16:40:25 +08:00
parent ee337c6f49
commit 4c39ad9a0c

View File

@ -14,9 +14,8 @@ EARLY_KEXEC_ARGS=""
. /lib/kdump-lib.sh
. /lib/kdump-logger.sh
#initiate the kdump logger
dlog_init
if [ $? -ne 0 ]; then
# initiate the kdump logger
if ! dlog_init; then
echo "failed to initiate the kdump logger."
exit 1
fi
@ -30,8 +29,7 @@ prepare_parameters()
early_kdump_load()
{
check_kdump_feasibility
if [ $? -ne 0 ]; then
if ! check_kdump_feasibility; then
return 1
fi
@ -40,8 +38,7 @@ early_kdump_load()
return 1
fi
check_current_kdump_status
if [ $? == 0 ]; then
if check_current_kdump_status; then
return 1
fi
@ -61,10 +58,9 @@ early_kdump_load()
--command-line=$EARLY_KDUMP_CMDLINE --initrd=$EARLY_KDUMP_INITRD \
$EARLY_KDUMP_KERNEL"
$KEXEC ${EARLY_KEXEC_ARGS} $standard_kexec_args \
if $KEXEC $EARLY_KEXEC_ARGS $standard_kexec_args \
--command-line="$EARLY_KDUMP_CMDLINE" \
--initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL
if [ $? == 0 ]; then
--initrd=$EARLY_KDUMP_INITRD $EARLY_KDUMP_KERNEL; then
dinfo "kexec: loaded early-kdump kernel"
return 0
else