#!/bin/bash echo "NOTICE: Currently you must move & rename the installer directories to the following:" echo "Base Game: ${HOME}/D2" echo "Expansion: ${HOME}/LOD" echo "Then run this script with the following option:" echo "${0} -a" echo "The script will then kick off the process of grabbing debs, setting the prefix and installing the game." echo "User intervention is required to click through the installer setups" # Wine Prefix Environment PREFIX="/home/$USER/diablo" ARCH="win32" installD2(){ D2_INSTALLER_PATH="/home/$USER/D2" echo -e "\nInstalling Diablo II...\n" if [ ! -d "${D2_INSTALLER_PATH}" ];then echo -e "${D2_INSTALLER_PATH} not found, edit script and set correct path\n" exit 0; fi cd "${D2_INSTALLER_PATH}" || exit 1 WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine Installer.exe } installLOD(){ LOD_INSTALLER_PATH="/home/$USER/LOD" echo -e "\nInstalling Diablo II: Lord of Destruction...\n" if [ ! -d "${LOD_INSTALLER_PATH}" ];then echo -e "${LOD_INSTALLER_PATH} not found, edit script and set correct path\n" exit 0; fi cd "${LOD_INSTALLER_PATH}" || exit 1 WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine Installer.exe } getDeps(){ if [ ! -f /usr/bin/wine ];then echo -e "\nInstall wine\n" exit 0; fi if [ ! -f /usr/bin/winetricks ];then echo -e "\n Install winetricks\n" exit 0; fi } getTricks(){ WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" winetricks directx9 directplay comctl32ocx echo -e "\nGetting Glide for D2\n" } getGlide(){ if [ ! -f /tmp/gl32ogl14e.zip ];then cd /tmp || exit 1 wget http://www.svenswrapper.de/gl32ogl14e.zip unzip gl32ogl14e.zip echo -e "\nCopying Files to Diablo game directory...\n" cp -v {glide-init.exe,glide3x.dll} "${PREFIX}/drive_c/Program Files/Diablo II/" echo -e "\nCleaning up temp files...\n" rm {glide-readme.txt,glide-liesmich.txt,glide-init.exe,glide3x.dll,gl32ogl14e.zip} cd "${PREFIX}/drive_c/"Program Files"/"Diablo II"/" || exit 1 WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine glide-init.exe echo -e "\nDone!\n" fi } runGame(){ cd "${PREFIX}/drive_c/"Program Files"/"Diablo II"/" || exit 1 echo -n -e "\nRun game now?(Y/n): " read choice if [ "${choice}" = "n" ];then exit 0; fi WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine "Diablo II.exe" " -3dfx" } run_glide(){ cd "${PREFIX}/drive_c/"Program Files"/"Diablo II"/" || exit 1 WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" wine "glide-init.exe" } run_tricks(){ WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" winetricks "${1}" "${2}" } runWinecfg(){ WINEPREFIX="${PREFIX}" WINEARCH="${ARCH}" winecfg } case "${1}" in play|-p) runGame ;; getdeps|-gd) getDeps ;; gettricks|-gt) getTricks ;; getglide| -gg) getGlide ;; id2|--install-d2) installD2 ;; ilod|--install-lod) installLOD ;; cfg|-c) runWinecfg ;; rg| --run-glide) run_glide ;; tricks) run_tricks "${1}" "${2}" ;; all|-a) getDeps installD2 installLOD getTricks getGlide runGame ;; *) echo -e "\nUsage: $0 [-a] [all] [-p] [play] [-gt] [gettricks] [-gd] [getdeps] [getglide] [-gg] [id2] [--install-d2] [ilod] [--install-lod]\n" ;; esac