lib.sh: support any command on find_exec()

right now, we assume "find", but it adds any number of
arguments next to that.

change it instead to support any command, where the
assumption is that it would generate a list of files
and directories.

Signed-off-by: Leah Rowe <leah@libreboot.org>
25.04_branch
Leah Rowe 2025-05-07 13:27:25 +01:00
parent bd5d85569f
commit add92cd405
5 changed files with 9 additions and 11 deletions

View File

@ -108,7 +108,7 @@ tmpclone()
(
[ $# -gt 5 ] || git clone "$repodir" "$3" || err "!clone $repodir $3"
git -C "$3" reset --hard "$4" || err "!reset $1 $2 $3 $4 $5"
fx_ "eval x_ git -C \"$3\" am" "$5" -type f
fx_ "eval x_ git -C \"$3\" am" find "$5" -type f
) || repofail="y"
[ "$repofail" = "y" ] && [ $# -lt 6 ] && tmpclone "$@" retry

View File

@ -13,9 +13,6 @@ ifdtool="elf/ifdtool/default/ifdtool"
cv="CONFIG_GBE_BIN_PATH CONFIG_IFD_BIN_PATH"
eval "`setvars "" tree new_mac archive boarddir rom cbdir xchanged \
tmpromdir IFD_platform ifdprefix xromsize $cv`"
inject()
{
remkdir "$tmpromdel"
@ -89,7 +86,7 @@ readcfg()
readkconfig()
{
x_ rm -f "$xbmktmp/cbcfg"
fe_ scankconfig "$boarddir/config" -type f
fe_ scankconfig find "$boarddir/config" -type f
eval "`setcfg "$xbmktmp/cbcfg" 1`"
}
@ -133,7 +130,7 @@ modify_mac()
[ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \
x_ "$nvm" "$xbmklocal/gbe" setmac "$new_mac"
fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
fe_ newmac find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
printf "\nGbE NVM written to '%s':\n" "$archive"
x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || :

View File

@ -140,7 +140,8 @@ chkvars()
# e.g. coreboot is multi-tree, so 1
singletree()
{
( fx_ "exit 1" "config/$1/"*/ -type f -name "target.cfg" ) || return 1
( fx_ "exit 1" find "config/$1/"*/ -type f -name "target.cfg" ) || \
return 1
}
fe_()
@ -158,7 +159,7 @@ find_ex()
xmsg="$1" && shift 1
fd="`mktemp`" && x_ rm -f "$fd" && x_ touch "$fd"
xx="$1" && shift 1
$xmsg find "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \
$xmsg "$@" 2>/dev/null | sort 1>"$fd" 2>/dev/null || \
err "!find $(echo "$@") > \"$fd\""
dx_ "$xx" "$fd" || break
x_ rm -f "$fd"

View File

@ -190,7 +190,7 @@ mkseagrub()
[ "$payload_grubsea" = "y" ] && pname="grub"
[ "$payload_grubsea" = "y" ] || \
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
fe_ "cprom" "$grubdata/keymap" -type f -name "*.gkb"
fe_ cprom find "$grubdata/keymap" -type f -name "*.gkb"
}
add_uboot()

4
mk
View File

@ -277,7 +277,7 @@ check_project_hashes()
[ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \
read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree"
fx_ "x_ sha512sum" "$datadir" "$configdir/$tree" "$mdir" \
fx_ "x_ sha512sum" find "$datadir" "$configdir/$tree" "$mdir" \
-type f -not -path "*/.git*/*" | awk '{print $1}' > \
"$xbmktmp/project.hash" || err "!h $project $tree"
@ -369,7 +369,7 @@ check_defconfig()
elfcheck()
{
# TODO: *STILL* very hacky check. do it properly (based on build.list)
( fx_ "exit 1" "$dest_dir" -type f ) || return 1; :
( fx_ "exit 1" find "$dest_dir" -type f ) || return 1; :
}
handle_makefile()