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>
This commit is contained in:
Leah Rowe
2025-05-07 13:27:25 +01:00
parent 2b7f6b7d7c
commit 0faef89946
5 changed files with 15 additions and 14 deletions
+1 -1
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
+8 -8
View File
@@ -49,7 +49,7 @@ download()
readkconfig()
{
x_ rm -f "$xbmktmp/cbcfg"
fe_ scankconfig "$boarddir/config" -type f
fe_ scankconfig find "$boarddir/config" -type f
eval "`setcfg "$xbmktmp/cbcfg" 1`"
@@ -148,7 +148,7 @@ extract_intel_me()
chkvars ME11delta ME11version ME11sku ME11pch
[ "$ME11bootguard" = "y" ] && x_ ./mk -f deguard
set +u +e && fe_ extract_intel_me_bruteforce "$xbmkpwd/$appdir" -type f
set +u +e && fe_ find_me find "$xbmkpwd/$appdir" -type f
[ "$ME11bootguard" != "y" ] && x_ mv "$_metmp" "$_me" && return 0
( x_ cd src/deguard/
@@ -158,7 +158,7 @@ extract_intel_me()
) || err "Error running deguard for $_me - $dontflash"; :
}
extract_intel_me_bruteforce()
find_me()
{
e "$_metmp" f && x_ rm -Rf "$xbmklocal/metmp" && return 1
[ -L "$1" ] && return 0
@@ -169,7 +169,7 @@ extract_intel_me_bruteforce()
"$mecleaner" $mfs $_r -t -O "$_metmp" "$1" || "$me7updateparser" \
-O "$_metmp" "$1" || extract_archive "$1" "$_7ztest" || return 0
fe_ extract_intel_me_bruteforce "$_7ztest" -type f || return 1; :
fe_ find_me find "$_7ztest" -type f || return 1; :
}
extract_archive()
@@ -228,7 +228,7 @@ extract_sch5545ec()
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
extract_tbfw()
{
chkvars TBFW_size && fe_ copy_tbfw "$appdir" -type f -name "TBT.bin"
chkvars TBFW_size; fe_ copy_tbfw find "$appdir" -type f -name "TBT.bin"
}
copy_tbfw()
@@ -344,7 +344,7 @@ patch_release_roms()
done
if readkconfig; then
fe_ prep_rom "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
fe_ preprom find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
[ "$nukemode" != "nuke" ] || \
printf "Make sure you inserted vendor files: %s\n" \
"$vguide" > "$tmpromdir/README.md" || :
@@ -378,7 +378,7 @@ patch_release_roms()
"$archive" || err "'$archive' -> Can't overwrite - $dontflash"; :
}
prep_rom()
preprom()
{
_xrom="$1"
_xromname="${1##*/}"
@@ -492,7 +492,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" || :
+3 -2
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"
+1 -1
View File
@@ -192,7 +192,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()
+2 -2
View File
@@ -279,7 +279,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"
@@ -371,7 +371,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()