summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-03 05:25:11 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-05 12:18:22 +0100
commita80aed7ee1f125aa56ab8a87831201942d39284a (patch)
tree5b1c3f1812d668e3388d33745e5a2909ecf00fe3 /include/lib.sh
parentaa39abfff850e5d4435dc4924ed636364c908668 (diff)
lib.sh: add fe_ which is fx_ but err on find
In the mk script, we need fx_ to not return errors on the find command, since it's searching a bunch of directories where some of them may not exist. All other instances where fx_ is used, must return an error if the directory being searched doesn't exist. For this, fe_() is introduced, which does the same as fx_ but with this much stricter check. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r--include/lib.sh13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 507a37c1..3f5e5d37 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -128,11 +128,22 @@ setvars()
printf "%s\n" "${_setvars% }"
}
+fe_()
+{
+ find_ex "x_" "$@"
+}
+
fx_()
{
+ find_ex "" "$@"
+}
+
+find_ex()
+{
+ errx="$1" && shift 1
fd="`mktemp`"
xx="$1" && shift 1
- find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\""
+ $errx find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\""
while read -r fx; do
"$xx" "$fx" || break; :
done < "$fd"