detect_platform: %q-escape output so eval survives spaces in MODEL

The Jetson model string has spaces; emitted unquoted, eval ran its second word
as a command ("Jetson: command not found"). printf %q makes the output safe to
eval, which is how every other script consumes it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
AngePierreandClaude Opus 5 committed 2026-09-10 16:57:53 +02:00
1 parent 23b30ac1e8
commit e0727d957b
1 file changed
+9 -6
+9 -6
View File
@@ -49,9 +49,12 @@ case "$major" in
*) jetpack="unknown" ;;
esac
echo "L4T=${l4t:-unknown}"
echo "L4T_MAJOR=${major:-unknown}"
echo "JETPACK=${jetpack}"
echo "SOC=${soc}"
echo "ARCH=$(uname -m)"
echo "MODEL=${model}"
# %q-escaped so a caller can `eval` the output safely: MODEL holds spaces
# ("NVIDIA Jetson Orin Nano …"), which unquoted would make eval run "Jetson" as a
# command.
printf 'L4T=%q\n' "${l4t:-unknown}"
printf 'L4T_MAJOR=%q\n' "${major:-unknown}"
printf 'JETPACK=%q\n' "${jetpack}"
printf 'SOC=%q\n' "${soc}"
printf 'ARCH=%q\n' "$(uname -m)"
printf 'MODEL=%q\n' "${model}"