From: Sam James Date: Thu, 20 Jul 2023 03:36:01 +0000 (+0100) Subject: fix(dracut.sh): use gawk for strtonum X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=33a66ed04bdc30eccb172a0cd6dcc36d9d74f825;p=thirdparty%2Fdracut.git fix(dracut.sh): use gawk for strtonum strtonum is a gawkism and is not available in all awks, e.g. mawk. Use gawk to avoid failure. Fixes: f32e95bcadbc5158843530407adc1e7b700561b1 Signed-off-by: Sam James --- diff --git a/dracut-functions.sh b/dracut-functions.sh index 5807b8c59..8afbbd801 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -1047,7 +1047,7 @@ pe_file_format() { if [[ $# -eq 1 ]]; then local magic magic=$(objdump -p "$1" \ - | awk '{if ($1 == "Magic"){print strtonum("0x"$2)}}') + | gawk '{if ($1 == "Magic"){print strtonum("0x"$2)}}') magic=$(printf "0x%x" "$magic") # 0x10b (PE32), 0x20b (PE32+) [[ $magic == 0x20b || $magic == 0x10b ]] && return 0 diff --git a/dracut.sh b/dracut.sh index 01aa43727..a67d12445 100755 --- a/dracut.sh +++ b/dracut.sh @@ -2467,7 +2467,7 @@ if [[ $uefi == yes ]]; then fi fi - offs=$(objdump -h "$uefi_stub" 2> /dev/null | awk 'NF==7 {size=strtonum("0x"$3);\ + offs=$(objdump -h "$uefi_stub" 2> /dev/null | gawk 'NF==7 {size=strtonum("0x"$3);\ offset=strtonum("0x"$4)} END {print size + offset}') if [[ $offs -eq 0 ]]; then dfatal "Failed to get the size of $uefi_stub to create UEFI image file"