init.sh: don't use eval to read version files

it's not necessary, and was the cause of a recent issue,
which i mitigated, but why mitigate it?

prevent bugs. don't use eval unless absolutely necessary.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe 2025-04-29 12:01:13 +01:00
parent b63612871d
commit 34d134f2f2

View file

@ -161,9 +161,8 @@ xbmk_set_env()
xbmk_set_version()
{
for fv in version versiondate; do
eval "[ ! -f \"\.$fv\" ] || read -r $fv < \"\.$fv\" || :"
done
[ ! -f ".version" ] || read -r version < ".version" || :; :
[ ! -f ".versiondate" ] || read -r versiondate < ".versiondate" || :; :
[ -e ".git" ] || [ -f ".version" ] || printf "unknown\n" > ".version" \
|| $err "Cannot generate unknown .version file"