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>
25.04_branch
Leah Rowe 2025-05-05 21:33:29 +01:00
parent 1bc8055e28
commit 92374e6071
2 changed files with 9 additions and 6 deletions

View File

@ -54,9 +54,7 @@ git_prep()
chkvars rev
tmpclone "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
if singletree "$project" || [ $# -gt 4 ]; then
[ -f "$mdir/module.list" ] && while read -r msrcdir; do
fetch_submodule "$msrcdir"
done < "$mdir/module.list"; :
dx_ fetch_submodule "$mdir/module.list"
fi
[ "$_loc" != "$XBMK_CACHE/repo/$project" ] && \

View File

@ -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 "$@")"