Skip to content

Instantly share code, notes, and snippets.

@tonylambiris
Last active August 8, 2019 10:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tonylambiris/2c00a4c7f4b3b0a00b32548d2ff676f8 to your computer and use it in GitHub Desktop.
Save tonylambiris/2c00a4c7f4b3b0a00b32548d2ff676f8 to your computer and use it in GitHub Desktop.
Wine setup script for creating a minimalist gaming environment
#!/bin/bash
# run this script with environmental variables like so:
# env WINEARCH=win64 WINEPREFIX=$HOME/Documents/Wine/Overwatch ~/wine_gaming.sh
#
# the above will create a new wine prefix, removing it if it already exists
# you will be prompted to hit enter before continuing or aborting with a ctrl-c
#
# it will also download/run the latest Battle.net client but this is optional
# ensure wine-staging, winetricks, wineasio and dxvk are installed prior to running
#
# i prefer to copy the winetricks script out of the master branch from the official
# github repo to my local ~/bin directory so it can run self-updates (not mandatory)
# https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
TRICKS=()
TRICKS+=(corefonts)
# dotnet452 is by far the most stable
TRICKS+=(dotnet452)
#TRICKS+=(dotnet462)
#TRICKS+=(dotnet472)
TRICKS+=(vcrun2005)
TRICKS+=(vcrun2008)
TRICKS+=(vcrun2015)
test -z "$WINEPREFIX" && WINEPREFIX="${1:-$HOME/.wine}"
test -z "$WINEARCH" && WINEARCH="${2:-win64}"
if test -d "${WINEPREFIX}"; then
echo
echo "WARNING!"
echo "WARNING! This will wipe all data from \$WINEPREFIX to ensure a clean setup."
echo "WARNING! Ensure winetricks, wineasio and dxvk are installed before proceeding!"
echo "WARNING!"
echo
fi
echo "WINEARCH=${WINEARCH} WINEPREFIX=${WINEPREFIX}"
echo
read -p "Hit enter to continue..." ans; wineserver -ks
test -d "${WINEPREFIX}" && rm -rf "${WINEPREFIX}"
[[ "${WINEARCH}" == "win64" ]] && wine64 wineboot -i || wine wineboot -i
wineboot -r -f
test -w $(command -v winetricks) &>/dev/null && winetricks --self-update
set -e
for trick in "${TRICKS[@]}"; do
echo -n "Installing $trick, please wait..."
if winetricks --country=US --force -q "${trick}" 1>>/tmp/winetricks.log 2>>/tmp/winetricks.err; then
echo " ok"
else
echo " err"
fi
done
env WINEPREFIX="${WINEPREFIX}" regsvr32 wineasio.dll
env WINEPREFIX="${WINEPREFIX}" setup_dxvk install
wineserver -ks
echo "Configuring wine..."
echo
winecfg
setup="/tmp/Battle.net-Setup.exe"
test -f "$setup" || wget -c -O "$setup" \
'https://www.battle.net/download/getInstallerForGame?os=win&locale=enUS&version=LIVE&gameProgram=BATTLENET_APP'
wine "$setup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment