linuxkm/linuxkm-fips-hash-wrapper.sh: make sure awk is gawk.

This commit is contained in:
Daniel Pouzzner
2026-02-20 11:35:47 -06:00
parent 70aa3dc5b1
commit f84377ed69
+21 -1
View File
@@ -26,7 +26,27 @@ set -o noclobber -o nounset -o pipefail -o errexit
mod_path=$1
shift
readarray -t fenceposts < <(readelf --wide --sections --symbols "$mod_path" | awk '
# require Gnu Awk, for strtonum().
if [[ -v AWK ]] && ! "$AWK" --version 2>&1 | grep -F -q 'GNU Awk'; then
unset AWK
fi
if [[ ! -v AWK ]]; then
if command -v gawk >/dev/null; then
AWK='gawk'
else
AWK='awk'
fi
fi
if ! "$AWK" --version 2>&1 | grep -F -q 'GNU Awk'; then
echo "Couldn't find required GNU Awk executable." >&2
exit 1
fi
# shellcheck disable=SC2016 # using $AWK instead of awk confuses shellcheck.
readarray -t fenceposts < <(readelf --wide --sections --symbols "$mod_path" | "$AWK" '
BEGIN {
fips_fenceposts["wc_linuxkm_pie_reloc_tab"] = "reloc_tab_start";
fips_fenceposts["wc_linuxkm_pie_reloc_tab_length"] = "reloc_tab_len_start";