Cut down on repeating tasks for existing wine bottles.

This commit is contained in:
Storm Dragon
2025-08-05 04:31:39 -04:00
parent e5e7ef49ed
commit 35fabf8ecd

View File

@@ -95,8 +95,21 @@ install_wine_bottle() {
# Modern wine is unified - no separate wine32/wine64 executables # Modern wine is unified - no separate wine32/wine64 executables
export WINE="wine" export WINE="wine"
export WINESERVER="wineserver" export WINESERVER="wineserver"
# Arguments to the function are dependancies to be installed.
# Get location of mono and gecko. # Check if bottle already exists and is properly initialized
local bottleExists=false
if [[ -d "$WINEPREFIX" ]] && [[ -f "$WINEPREFIX/system.reg" ]] && [[ -f "$WINEPREFIX/user.reg" ]]; then
bottleExists=true
echo "Using existing wine${architecture} bottle at $WINEPREFIX"
fi
# Only do basic setup if bottle doesn't exist
if [[ "$bottleExists" == false ]]; then
echo -n "Creating new wine${architecture} bottle - Using "
wine --version
DISPLAY="" wineboot -u | agm_progressbox "Wine Setup" "Initializing wine bottle..."
# Install mono and gecko only for new bottles
monoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name mono 2> /dev/null)" monoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name mono 2> /dev/null)"
geckoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name "gecko" 2> /dev/null)" geckoPath="$(find /usr/share/wine/ -maxdepth 1 -type d -name "gecko" 2> /dev/null)"
if [[ -z "$monoPath" ]]; then if [[ -z "$monoPath" ]]; then
@@ -107,28 +120,35 @@ install_wine_bottle() {
download 'http://dl.winehq.org/wine/wine-gecko/2.40/wine_gecko-2.40-x86.msi' download 'http://dl.winehq.org/wine/wine-gecko/2.40/wine_gecko-2.40-x86.msi'
geckoPath="${cache}/wine_gecko-2.40-x86.msi" geckoPath="${cache}/wine_gecko-2.40-x86.msi"
fi fi
echo -n "Using " wine msiexec /i z:"$monoPath" /quiet | agm_progressbox "Wine Setup" "Installing .NET Framework..."
wine --version wine msiexec /i z:"$geckoPath" /quiet | agm_progressbox "Wine Setup" "Installing Web Browser support..."
DISPLAY="" wineboot -u | agm_progressbox "Wine Setup" "Initializing wine bottle..." fi
wine msiexec /i z:"$monoPath" /quiet | agm_progressbox "Wine Setup" "Installing .NET Framework..."
wine msiexec /i z:"$geckoPath" /quiet | agm_progressbox "Wine Setup" "Installing Web Browser support..." # Install RHVoice only if needed and not already installed
if [[ "${*}" =~ (speechsdk|sapi) ]]; then if [[ "${*}" =~ (speechsdk|sapi) ]]; then
install_rhvoice install_rhvoice
fi fi
if [[ "${WINEARCH}" == "win64" ]]; then
download "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd" # Setup nvda2speechd for wine64 bottles (only once)
fi if [[ "${WINEARCH}" == "win64" ]]; then
if [[ "${WINEARCH}" == "win64" ]] && [[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" ]]; then download "https://github.com/RastislavKish/nvda2speechd/releases/download/v0.1/nvda2speechd"
cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" if [[ ! -f "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" ]]; then
chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd" cp "${cache}/nvda2speechd" "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
fi chmod +x "${XDG_DATA_HOME:-$HOME/.local/share}/audiogame-manager/nvda2speechd"
winetricks -q isolate_home "$@" "${winVer:-win7}" ${winetricksSettings} | agm_progressbox "Wine Setup" "Installing wine dependencies..." fi
fi
# Set default voice for speech-enabled games
if [[ ${#defaultVoice} -ge 2 ]] && [[ "$*" =~ (speechsdk|sapi) ]]; then # Install winetricks dependencies - this is more complex to optimize
echo "Setting default voice for wine${architecture}." # For now, let winetricks handle checking if packages are already installed
"${0%/*}/speech/set-voice.sh" -b "wine${architecture}" -r "${defaultRate:-7}" -v "${defaultVoice}" if [[ $# -gt 0 ]] || [[ -n "${winVer}" ]] || [[ -n "${winetricksSettings}" ]]; then
fi winetricks -q isolate_home "$@" "${winVer:-win7}" ${winetricksSettings} | agm_progressbox "Wine Setup" "Installing wine dependencies..."
fi
# Set default voice for speech-enabled games (only if not already set)
if [[ ${#defaultVoice} -ge 2 ]] && [[ "$*" =~ (speechsdk|sapi) ]]; then
echo "Setting default voice for wine${architecture}."
"${0%/*}/speech/set-voice.sh" -b "wine${architecture}" -r "${defaultRate:-7}" -v "${defaultVoice}"
fi
} }
add_launcher() { add_launcher() {