Fixed speech-dispatcher library in Play Palace.
This commit is contained in:
@@ -1,17 +1,11 @@
|
||||
check_dependencies git uv
|
||||
check_dependencies git uv python-speechd:speechd
|
||||
|
||||
# shellcheck disable=SC2154 # installPath is exported by linux-game-manager.sh
|
||||
# shellcheck disable=SC2154 # set by linux-game-manager.sh
|
||||
gameRoot="${installPath}/PlayPalace11"
|
||||
desktopPath="${gameRoot}/clients/desktop"
|
||||
hostLibDir="${desktopPath}/.host-libs"
|
||||
speechdLibPath=""
|
||||
libCandidates=(
|
||||
"/usr/lib/libspeechd.so.2"
|
||||
"/usr/lib64/libspeechd.so.2"
|
||||
"/usr/lib/x86_64-linux-gnu/libspeechd.so.2"
|
||||
"/lib/x86_64-linux-gnu/libspeechd.so.2"
|
||||
"/lib64/libspeechd.so.2"
|
||||
)
|
||||
hostPythonDir="${desktopPath}/.host-python"
|
||||
speechdFilePath=""
|
||||
speechdCopySourcePath=""
|
||||
|
||||
if [[ -e "${gameRoot}" ]]; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "\"${gameRoot}\" already exists. Remove it first or choose a different game."
|
||||
@@ -40,30 +34,36 @@ if ! uv sync; then
|
||||
fi
|
||||
popd > /dev/null || exit 1
|
||||
|
||||
if command -v ldconfig > /dev/null 2>&1; then
|
||||
speechdLibPath="$(ldconfig -p 2> /dev/null | awk '/libspeechd\.so\.2/{print $NF; exit}')"
|
||||
fi
|
||||
|
||||
if [[ -z "${speechdLibPath}" ]]; then
|
||||
for libPath in "${libCandidates[@]}"; do
|
||||
if [[ -r "${libPath}" ]]; then
|
||||
speechdLibPath="${libPath}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ -z "${speechdLibPath}" ]]; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not find libspeechd.so.2.\nInstall speech-dispatcher (Arch) or a libspeechd package (Debian/Ubuntu) and try again."
|
||||
speechdFilePath="$(python3 -c 'import pathlib,speechd; print(pathlib.Path(speechd.__file__).resolve())' 2> /dev/null)"
|
||||
if [[ -z "${speechdFilePath}" ]]; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not import python module speechd from host Python.\nInstall speech-dispatcher python bindings and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${hostLibDir}" || {
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not create ${hostLibDir}."
|
||||
if [[ "${speechdFilePath##*/}" == "__init__.py" ]]; then
|
||||
speechdCopySourcePath="${speechdFilePath%/*}"
|
||||
elif [[ "${speechdFilePath##*/}" == "speechd.py" ]]; then
|
||||
speechdCopySourcePath="${speechdFilePath}"
|
||||
else
|
||||
speechdCopySourcePath="${speechdFilePath}"
|
||||
fi
|
||||
|
||||
if ! [[ -r "${speechdCopySourcePath}" ]]; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not read speechd python binding at ${speechdCopySourcePath}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${hostPythonDir}" || {
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not create ${hostPythonDir}."
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ! cp -Lf "${speechdLibPath}" "${hostLibDir}/libspeechd.so.2"; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not copy ${speechdLibPath} into ${hostLibDir}."
|
||||
if [[ -d "${speechdCopySourcePath}" ]]; then
|
||||
if ! cp -a "${speechdCopySourcePath}" "${hostPythonDir}/"; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not copy speechd package into ${hostPythonDir}."
|
||||
exit 1
|
||||
fi
|
||||
elif ! cp -a "${speechdCopySourcePath}" "${hostPythonDir}/speechd.py"; then
|
||||
ui_msgbox "Game Installer" "Game Installer" "Could not copy speechd module into ${hostPythonDir}."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user