init.sh: Use readlink in pybin()

Use realpath only as a fallback.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2025-05-07 19:00:13 +01:00
parent a94bd3c093
commit cba04aa74b
2 changed files with 13 additions and 2 deletions
+1 -2
View File
@@ -80,8 +80,7 @@ pybin()
# ideally, don't rely on PATH or hardcoded paths if python venv.
# use the *real*, direct executable linked to by the venv symlink
if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then
# realpath isn't posix, but available mostly universally
pypath="$(realpath \
pypath="$(findpath \
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
[ -e "$pypath" ] && [ ! -d "$pypath" ] && \
[ -x "$pypath" ] && printf "%s\n" "$pypath" && return 0; :