dracut/0024.patch
Pavel Valena a5ba84ec9e dracut-057-38.git20230725
Resolves: #1933787,#2180787,#2181541
2023-07-25 13:34:23 +02:00

47 lines
1.6 KiB
Diff

From 11cc7032853ea254a7d4cabed0b7bf3a605ccc6c Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Thu, 20 Jul 2023 04:36:01 +0100
Subject: [PATCH] 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 <sam@gentoo.org>
(Cherry-picked commit: 33a66ed04bdc30eccb172a0cd6dcc36d9d74f825)
Related: #2180787
---
dracut-functions.sh | 2 +-
dracut.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 7f05da6e..3c475ca7 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -1001,7 +1001,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 a6a27dcf..1ff51bb1 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -2593,7 +2593,7 @@ if [[ $uefi == yes ]]; then
done
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"