Environment setting for custom Wine usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Helper script for wine_run.sh / winetricks_run.sh | |
# Sets environment and detects prefix arch. See wine_run.sh for details | |
# on configurable variables usage. | |
function get_wine_arch() { | |
local prefix="${WINEPREFIX:-"${HOME}/.wine"}" | |
local registry_winearch=$(perl -ne 'print $1 if /#arch=(win\d+)/' "${prefix}/system.reg" 2>/dev/null) | |
wine_arch=${WINEARCH:-"$registry_winearch"} | |
if [[ "$wine_arch" == "" ]]; then | |
# WINEARCH was not set and prefix has no info, using win64 as default. | |
wine_arch="win64" | |
elif [[ "$wine_arch" != "win64" ]] && [[ "$wine_arch" != "win32" ]]; then | |
echo "Unexpected Wine arch ${wine_arch} encountered. Aborting!" >&2 | |
echo "WINEARCH='${WINEARCH}', registry_winearch='${registry_winearch}'" >&2 | |
exit 1 | |
fi | |
printf $wine_arch | |
} | |
export wine_arch=$(get_wine_arch) | |
arch_suffix="" | |
if [[ "$wine_arch" == "win64" ]]; then | |
arch_suffix="64" | |
fi | |
export wine_bin=${wine_bin:-"wine${arch_suffix}"} | |
if [[ "${WINEPATH+isset}" ]]; then | |
export PATH=${WINEPATH}/bin:$PATH | |
export LD_LIBRARY_PATH="${WINEPATH}/lib64/wine/x86_64-unix:${WINEPATH}/lib/wine/i386-unix:${LD_LIBRARY_PATH}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment