]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix(dracut.sh): use gawk for strtonum
authorSam James <sam@gentoo.org>
Thu, 20 Jul 2023 03:36:01 +0000 (04:36 +0100)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Thu, 20 Jul 2023 12:25:46 +0000 (08:25 -0400)
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 <sam@gentoo.org>
dracut-functions.sh
dracut.sh

index 5807b8c59eeb2d4b48b74a1addd22ee77c04ce51..8afbbd801ed428225511a31141da7901b0038e39 100755 (executable)
@@ -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
index 01aa437279d8b3e054b25960813e77a31eb17534..a67d124456d3be8158abe2855501360b9d459280 100755 (executable)
--- 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"