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