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>25.04_branch
parent
afb5e7d3d5
commit
6c7da73782
|
@ -138,7 +138,7 @@ modify_mac()
|
||||||
x_ "$nvm" tmp/gbe setmac "$new_mac"
|
x_ "$nvm" tmp/gbe setmac "$new_mac"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fx_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
fe_ newmac "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
||||||
|
|
||||||
printf "\nGbE NVM written to '%s':\n" "$archive"
|
printf "\nGbE NVM written to '%s':\n" "$archive"
|
||||||
x_ "$nvm" tmp/gbe dump | grep -v "bytes read from file" || :
|
x_ "$nvm" tmp/gbe dump | grep -v "bytes read from file" || :
|
||||||
|
|
|
@ -128,11 +128,22 @@ setvars()
|
||||||
printf "%s\n" "${_setvars% }"
|
printf "%s\n" "${_setvars% }"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fe_()
|
||||||
|
{
|
||||||
|
find_ex "x_" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
fx_()
|
fx_()
|
||||||
{
|
{
|
||||||
|
find_ex "" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
find_ex()
|
||||||
|
{
|
||||||
|
errx="$1" && shift 1
|
||||||
fd="`mktemp`"
|
fd="`mktemp`"
|
||||||
xx="$1" && shift 1
|
xx="$1" && shift 1
|
||||||
find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\""
|
$errx find "$@" | sort > "$fd" || $err "!find $(echo "$@") > \"$fd\""
|
||||||
while read -r fx; do
|
while read -r fx; do
|
||||||
"$xx" "$fx" || break; :
|
"$xx" "$fx" || break; :
|
||||||
done < "$fd"
|
done < "$fd"
|
||||||
|
|
Loading…
Reference in New Issue