mirror of
https://github.com/mudler/LocalAI.git
synced 2026-06-26 01:16:58 -04:00
fix(backends): quote $CURDIR in run.sh so backends work in paths with spaces The backend launcher scripts derive their own directory with CURDIR=$(dirname "$(realpath $0)") and then referenced it unquoted as $CURDIR (e.g. [ -f $CURDIR/lib/ld.so ], export LD_LIBRARY_PATH=$CURDIR/lib:..., exec $CURDIR/<binary> "$@"). When a backend is installed under a path that contains a space - notably macOS's ~/Library/Application Support/... - bash word-splits the unquoted $CURDIR, so the test builtin fails with "binary operator expected" and exec tries to run ".../Library/Application", yielding "No such file or directory". The backend never starts, surfacing as a gRPC "service not ready" error and an HTTP 500. Quote $CURDIR (and the realpath "$0") in every affected run.sh; no logic changes. Co-authored-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
703 B
Bash
Executable File
23 lines
703 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
CURDIR=$(dirname "$(realpath "$0")")
|
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
|
export DYLD_LIBRARY_PATH="$CURDIR/lib:"$CURDIR":${DYLD_LIBRARY_PATH:-}"
|
|
export PARAKEET_LIBRARY="$CURDIR/lib/libparakeet.dylib"
|
|
else
|
|
export LD_LIBRARY_PATH="$CURDIR/lib:"$CURDIR":${LD_LIBRARY_PATH:-}"
|
|
export PARAKEET_LIBRARY="$CURDIR/lib/libparakeet.so"
|
|
fi
|
|
|
|
# If a self-contained ld.so was packaged, route through it so the
|
|
# packaged libc / libstdc++ are used instead of the host's (matches the
|
|
# whisper backend's runtime layout). Linux only.
|
|
if [ -f "$CURDIR/lib/ld.so" ]; then
|
|
echo "Using lib/ld.so"
|
|
exec "$CURDIR/lib/ld.so" "$CURDIR/parakeet-cpp-grpc" "$@"
|
|
fi
|
|
|
|
exec "$CURDIR/parakeet-cpp-grpc" "$@"
|