tts setup: detect libespeak-ng by file, ldconfig is not on a user's PATH

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-21 14:45:26 +02:00
parent 060b2351f7
commit 50fd4b1cad

View file

@ -8,7 +8,12 @@ cd "$(dirname "$0")"
missing=() missing=()
command -v ffmpeg >/dev/null || missing+=(ffmpeg) command -v ffmpeg >/dev/null || missing+=(ffmpeg)
ldconfig -p 2>/dev/null | grep -q libespeak-ng || missing+=(espeak-ng) # libespeak-ng (comes with espeak-ng). Look for the file: ldconfig is in /sbin, not on a normal user's PATH
has_espeak() {
compgen -G '/usr/lib/*/libespeak-ng.so*' >/dev/null || compgen -G '/usr/lib*/libespeak-ng.so*' >/dev/null ||
/sbin/ldconfig -p 2>/dev/null | grep -q libespeak-ng
}
has_espeak || missing+=(espeak-ng)
python3 -c 'import venv, ensurepip' 2>/dev/null || missing+=(python3-venv) python3 -c 'import venv, ensurepip' 2>/dev/null || missing+=(python3-venv)
if ((${#missing[@]})); then echo "First install: sudo apt install ${missing[*]}"; exit 1; fi if ((${#missing[@]})); then echo "First install: sudo apt install ${missing[*]}"; exit 1; fi