Skip to content

Commit

Permalink
fix(dracut.sh): use gawk for strtonum
Browse files Browse the repository at this point in the history
strtonum is a gawkism and is not available in all awks, e.g. mawk. Use gawk
to avoid failure.

Fixes: f32e95b
Signed-off-by: Sam James <sam@gentoo.org>
  • Loading branch information
thesamesam authored and LaszloGombos committed Jul 20, 2023
1 parent 6af3fcf commit 33a66ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dracut-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion dracut.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 33a66ed

Please sign in to comment.