summaryrefslogtreecommitdiff
path: root/include/lib.sh
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2025-05-05 21:33:29 +0100
committerLeah Rowe <leah@libreboot.org>2025-05-05 21:37:16 +0100
commit282b939d9dae58f2ef128b3a866ba8640f87739b (patch)
treea0c5af62f76744a55eb621fc8a440dabe2a37e80 /include/lib.sh
parent73074dedee33bfa66edfc9a19dd9625598911518 (diff)
init.sh: New function dx_ to execute path files
Generated by find, this is a wrapper in place of using for loops everywhere. This simplification temporarily increases the amount of code, because we don't do this a lot, but this will reduce the growth of the build system code size in future changes. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'include/lib.sh')
-rw-r--r--include/lib.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/include/lib.sh b/include/lib.sh
index 530ea170..572fcf68 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -160,12 +160,17 @@ find_ex()
xx="$1" && shift 1
$xmsg find "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \
err "!find $(echo "$@") > \"$fd\""
- while read -r fx; do
- $xx "$fx" || break; :
- done < "$fd"
+ dx_ "$xx" "$fd"
x_ rm -f "$fd"
}
+dx_()
+{
+ [ -f "$2" ] && while read -r fx; do
+ $1 "$fx"
+ done < "$2"; :
+}
+
x_()
{
[ $# -lt 1 ] || [ -n "$1" ] || err "Empty first arg: x_ $(echo "$@")"