summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-09-17 10:40:55 +0100
committerLeah Rowe <leah@libreboot.org>2026-09-17 10:40:55 +0100
commite1c2525783d5ed65d1ab909102a64cb1ecf27ad6 (patch)
tree5ee1a4d6c4423fc7dc88b09c1a126afad446b269
parent69875b8e10fb1ae53c4f6aba38b4f604276d3f5b (diff)
lib.sh: make build_sbase a macro
sh macros are cool Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r--include/env/get.sh2
-rw-r--r--include/fw/vendor.sh4
-rw-r--r--include/lib.sh7
-rwxr-xr-xmk2
4 files changed, 6 insertions, 9 deletions
diff --git a/include/env/get.sh b/include/env/get.sh
index 9cd88174..67fdf976 100644
--- a/include/env/get.sh
+++ b/include/env/get.sh
@@ -242,7 +242,7 @@ bad_checksum()
e "$2" f missing && \
return 0
- build_sbase
+ eval "$build_sbase"
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
err "!sha512 '$2' $1" bad_checksum "$@"
diff --git a/include/fw/vendor.sh b/include/fw/vendor.sh
index 05f8b226..45cfa19a 100644
--- a/include/fw/vendor.sh
+++ b/include/fw/vendor.sh
@@ -473,7 +473,7 @@ prep()
mksha512()
{
- build_sbase
+ eval "$build_sbase"
[ "${1%/*}" != "$1" ] && \
x_ cd "${1%/*}"
@@ -571,7 +571,7 @@ vfile()
# must be called from a subshell
check_vendor_hashes()
{
- build_sbase
+ eval "$build_sbase"
x_ cd "$tmpromdir"
diff --git a/include/lib.sh b/include/lib.sh
index 03758982..74b75283 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -8,6 +8,8 @@
cbfstool="elf/coreboot/default/cbfstool"
rmodtool="elf/coreboot/default/rmodtool"
+build_sbase="[ ! -f \"\$sha512sum\" ] && x_ make -C util/sbase" # macro!
+
newvar()
{
printf "%s\n" "$*" | \
@@ -112,11 +114,6 @@ unpad_one_byte()
x_ mv "$unpaddedfile" "$1"
}
-build_sbase()
-{
- [ ! -f "$sha512sum" ] && x_ make -C "$xbmkpwd/util/sbase"; :
-}
-
remkdir()
{
x_ rm -Rf "$@"
diff --git a/mk b/mk
index 0611231e..f22aaf40 100755
--- a/mk
+++ b/mk
@@ -392,7 +392,7 @@ project_up_to_date()
"$@"
fi
- build_sbase
+ eval "$build_sbase"
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
err "!h $project $hashdir" \