#!/bin/bash # Copyright (C) 2007-2010 PlayOnLinux Team # Copyright (C) 2007 Pâris Quentin # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # wine.lib # -------- # # This lib contains wine's api Set_OS () { # Set fake windows OS # Usage: Set_OS [1] [2] # # 1 : Possible values : vista, win2003, winxp, win2k, winnt, winme, win98, win95, win31 # 2 : Service Pack : sp3, sp3, sp2 POL_Debug_Message "Setting Windows OS to $1 $2" if [ ! "$1" = "" ] then echo "[HKEY_CURRENT_USER\Software\Wine]" > "$REPERTOIRE/tmp/makeos.reg" echo "\"Version\"=\"$1\"" >> "$REPERTOIRE/tmp/makeos.reg" wine regedit "$REPERTOIRE/tmp/makeos.reg" rm -f "$REPERTOIRE/tmp/makeos.reg" fi if [ ! "$2" = "" ] # A tester then [ "$2" = "sp1" ] && n=1 [ "$2" = "sp2" ] && n=2 [ "$2" = "sp3" ] && n=3 cat << EOF > "$REPERTOIRE/tmp/makeos.reg" [HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion] "CSDVersion"="Service Pack $n" [HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Windows] "CSDVersion"=dword:00000${n}00 EOF wine regedit "$REPERTOIRE/tmp/makeos.reg" rm -f "$REPERTOIRE/tmp/makeos.reg" fi } Set_Managed () { # Let the windows manager to control wine # Usage: Set_Managed (On|Off) if [ "$1" = "On" ] then echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/managed.reg" echo "\"Managed\"=\"Y\"" >> "$REPERTOIRE/tmp/managed.reg" wine regedit "$REPERTOIRE/tmp/managed.reg" rm -f "$REPERTOIRE/tmp/managed.reg" fi if [ "$1" = "Off" ] then echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/managed.reg" echo "\"Managed\"=\"N\"" >> "$REPERTOIRE/tmp/managed.reg" wine regedit "$REPERTOIRE/tmp/managed.reg" rm -f "$REPERTOIRE/tmp/managed.reg" fi } Set_SoundDriver () { # Set the sound driver # Usage: Set_SoundDriver [Driver] # Disabled in Mac OS if [ ! "$1" = "" ] && [ "$POL_OS" = "Linux" ] then echo "[HKEY_CURRENT_USER\Software\Wine\Drivers]" > "$REPERTOIRE/tmp/alsa.reg" echo "\"Audio\"=\"$1\"" >> "$REPERTOIRE/tmp/alsa.reg" wine regedit "$REPERTOIRE/tmp/alsa.reg" rm -f "$REPERTOIRE/tmp/alsa.reg" fi } POL_Wine_Direct3D () { # Change a Direct3D value in registry # Usage POL_Wine_Direct3D Key Value # Example :: POL_Wine_Direct3D UseGLSL [default / enabled / disabled] # default : remove the key [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "POL_Wine_Direct3D : WINEPREFIX not set" wineserver -k if [ "$2" = "default" ] then echo "[HKEY_CURRENT_USER\Software\Wine\Direct3D]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=-" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" else echo "[HKEY_CURRENT_USER\Software\Wine\Direct3D]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=\"$2\"" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" fi wineserver -k } POL_Wine_X11Drv () { # Change a X11Drv value in registry # Usage POL_Wine_X11Drv Key Value # Example :: POL_Wine_X11Drv UseGLSL [default / enabled / disabled] # default : remove the key [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "POL_Wine_X11 Driver : WINEPREFIX not set" wineserver -k if [ "$2" = "default" ] then echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=-" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" else echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=\"$2\"" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" fi wineserver -k } POL_Wine_DirectSound () { # Same that POL_Wine_Direct3D, but for DirectSound [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "POL_Wine_DirectSound : WINEPREFIX not set" wineserver -k if [ "$2" = "default" ] then echo "[HKEY_CURRENT_USER\Software\Wine\DirectSound]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=-" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" else echo "[HKEY_CURRENT_USER\Software\Wine\DirectSound]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=\"$2\"" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" fi wineserver -k } POL_Wine_DirectInput () { # Same that POL_Wine_Direct3D, but for DirectInput [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "POL_Wine_DirectInput : WINEPREFIX not set" wineserver -k if [ "$2" = "default" ] then echo "[HKEY_CURRENT_USER\Software\Wine\DirectInput]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=-" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" else echo "[HKEY_CURRENT_USER\Software\Wine\DirectInput]" > "$REPERTOIRE/tmp/wine.reg" echo "\"$1\"=\"$2\"" >> "$REPERTOIRE/tmp/wine.reg" POL_Wine regedit "$REPERTOIRE/tmp/wine.reg" rm -f "$REPERTOIRE/tmp/wine.reg" fi wineserver -k } POL_Wine_GetRegValue() { # Get a value in registry # Example : POL_Wine_GetReg_Value Multisampling # # Read http://wiki.winehq.org/UsefulRegistryKeys [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "POL_Wine_GetRegValue : WINEPREFIX not set" value="$(cat "$WINEPREFIX/user.reg" 2> /dev/null | grep "$1" | head -n 1 | tr -d "\"" | cut -d\= -f2)" [ "$value" = "" ] && printf "default" || printf "$value" } Set_DXGrab () { # Enable or disable DXGrab # Usage: Set_DXGrab (On|Off) # On ou Off if [ "$1" = "On" ] then echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/managed.reg" echo "\"DXGrab\"=\"Y\"" >> "$REPERTOIRE/tmp/managed.reg" POL_Wine regedit "$REPERTOIRE/tmp/managed.reg" rm -f "$REPERTOIRE/tmp/managed.reg" fi if [ "$1" = "Off" ] then echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/managed.reg" echo "\"DXGrab\"=\"N\"" >> "$REPERTOIRE/tmp/managed.reg" POL_Wine regedit "$REPERTOIRE/tmp/managed.reg" rm -f "$REPERTOIRE/tmp/managed.reg" fi } Set_Iexplore () { # Make a fake IE6 installation # Usage: Set_Iexplore echo "[HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer]" > "$REPERTOIRE/tmp/ie.reg" echo "\"Version\"=\"6.0.2900.2180\"" >> "$REPERTOIRE/tmp/ie.reg" POL_Wine regedit "$REPERTOIRE/tmp/ie.reg" rm -f "$REPERTOIRE/tmp/ie.reg" } Set_Desktop () { # Set a desktop environement # Usage: Set_Desktop (on|off) [width] [height] echo "[HKEY_CURRENT_USER\Software\Wine\X11 Driver]" > "$REPERTOIRE/tmp/DesktopRoot.reg" if [ "$1" = "On" ] then echo "\"Desktop\"=\"$2x$3\"" >> "$REPERTOIRE/tmp/DesktopRoot.reg" fi if [ "$1" = "Off" ] then echo "\"Desktop\"=\"-1\"" >> "$REPERTOIRE/tmp/DesktopRoot.reg" fi POL_Wine regedit "$REPERTOIRE/tmp/DesktopRoot.reg" rm -f "$REPERTOIRE/tmp/DesktopRoot.reg" } Set_SoundSampleRate () { # Set Sound sample rate # Usage: Set_SoundSampleRate [value] # values can be: 48000, 44100, 22050, 16000, 11025, 8000 if [ ! "$1" = "" ] then echo "[HKEY_CURRENT_USER\Software\Wine\DirectSound]" > "$REPERTOIRE/tmp/sndSampleRate.reg" echo "\"DefaultSampleRate\"=\"$1\"" >> "$REPERTOIRE/tmp/sndSampleRate.reg" POL_Wine regedit "$REPERTOIRE/tmp/sndSampleRate.reg" rm -f "$REPERTOIRE/tmp/sndSampleRate.reg" fi } Set_SoundBitsPerSample () { # Set Sound bits per sample rate # Usage: Set_SoundBitsPerSaple [value] # values: 8, 16 if [ "$1" != "" ] then echo "[HKEY_CURRENT_USER\Software\Wine\DirectSound]" > "$REPERTOIRE/tmp/sndBitsPerSample.reg" echo "\"DefaultBitsPerSample\"=\"$1\"" >> "$REPERTOIRE/tmp/sndBitsPerSample.reg" POL_Wine regedit "$REPERTOIRE/tmp/sndBitsPerSample.reg" rm -f "$REPERTOIRE/tmp/sndBitsPerSample.reg" fi } POL_Wine_InstallFonts() { # Install microsoft fonts # Usage: POL_Wine_InstallFonts OLDDIR="$PWD" POL_Debug_Message "Installing microsoft fonts" rm "$WINEPREFIX/drive_c/windows/Fonts" 2> /dev/null # It's a symlink? If yes, remove it mkdir -p "$WINEPREFIX/drive_c/windows/Fonts" cd "$WINEPREFIX/drive_c/windows/Fonts" cp "$POL_USER_ROOT/fonts/"* ./ cd "$OLDDIR" } Set_SoundHardwareAcceleration () { # Set sound driver hardware acceleration # Values : Full, Standard, Basic, Emulation if [ ! "$1" = "" ] then echo "[HKEY_CURRENT_USER\Software\Wine\DirectSound]" > "$REPERTOIRE/tmp/sndSoundHardwareAcceleration.reg" echo "\"HardwareAcceleration\"=\"$1\"" >> "$REPERTOIRE/tmp/sndSoundHardwareAcceleration.reg" POL_Wine regedit "$REPERTOIRE/tmp/sndSoundHardwareAcceleration.reg" rm -f "$REPERTOIRE/tmp/SoundHardwareAcceleration.reg" fi } Set_SoundEmulDriver () { # Set sound emul driver # Usage: Set_SoundEmulDriver(Y|N) if [ ! "$1" = "" ] then echo "[HKEY_CURRENT_USER\Software\Wine\DirectSound]" > "$REPERTOIRE/tmp/sndSoundEmulDriver.reg" echo "\"EmulDriver\"=\"$1\"" >> "$REPERTOIRE/tmp/sndSoundEmulDriver.reg" POL_Wine regedit "$REPERTOIRE/tmp/sndSoundEmulDriver.reg" rm -f "$REPERTOIRE/tmp/sndSoundEmulDriver.reg" fi } POL_LoadVar_PROGRAMFILES() { # Get Program Files folder name and store it to PROGRAMFILES variable # Usage: POL_LoadVar_PROGRAMFILES PROGRAMFILES=`POL_Wine --keep-output cmd /c echo "%ProgramFiles%" |tr -d '\015' | tr -d '\012'` if [ "${PROGRAMFILES}" = "%ProgramFiles%" ] then # Var is not defined by wine export PROGRAMFILES="Program Files" else export PROGRAMFILES="${PROGRAMFILES:3}" fi } Set_WineWindowTitle () { #name of windowed title:$1 REG="$REPERTOIRE/tmp/reg.reg" cat << EOF > "$REG" [HKEY_CURRENT_USER\\Software\\Wine\\Explorer] "Desktop"="$1" EOF POL_Wine regedit "$REG" rm -f "$REG" } POL_LoadVar_Device () { # Get GPU device id and vendor id # Results are stored in VendorID and DeviceID variables POL_Debug_Message "Gettings GPU informations" if [ "$POL_OS" = "Linux" ] then VGA_ID1=`lspci | grep -iE "nvidia|ATI|AMD|intel" | grep VGA | awk '{ print $1 }' | head -n 1` VGA_ID2=`lspci -n | grep $VGA_ID1 | awk '{ print $3 }'` export VendorID=`echo $VGA_ID2 | awk -F: '{ print $1 }'` export DeviceID=`echo $VGA_ID2 | awk -F: '{ print $2 }'` fi if [ "$POL_OS" = "Mac" ] then export DeviceID="$(system_profiler | grep -A 10 "Graphics/Displays:" | grep "Device ID" | awk '{print $3}' | cut -d x -f2)" export VendorID="$(system_profiler | grep -A 10 "Graphics/Displays:" | grep "Vendor:" | awk '{print $3}' | tr -d "()" | cut -d x -f2)" fi POL_Debug_Message "VendorID : $VendorID" POL_Debug_Message "DeviceID : $DeviceID" } POL_Wine_SetVideoDriver() { # Set wine video driver # Usage POL_Wine_SetVideoDriver POL_LoadVar_Device cd "$WINEPREFIX/drive_c/windows/temp/" if [ "$VendorID" == "10de" ]; then DRVID="nv4_disp.dll" elif [ "$VendorID" == "1002" ]; then DRVID="ati2dvag.dll" elif [ "$VendorID" == "8086" ]; then DRVID="ig4icd32.dll" else DRVID="vga.dll" fi cat << EOF > "$POL_USER_ROOT/tmp/VGA_ID_fix.reg" [HKEY_CURRENT_USER\\Software\\Wine\\Direct3D] "VideoPCIVendorID"="dword:0000$VendorID" "VideoPCIDeviceID"="dword:0000$DeviceID" "VideoDriver"="$DRVID" EOF regedit "$POL_USER_ROOT/tmp/VGA_ID_fix.reg" } POL_AutoWine () { # Detect if the file is a .exe or a .msi file and run it with POL_Wine # Same usage than "wine" SETUP_PATH="$@" extension=$(echo "$SETUP_PATH" | sed 's/.*\.//g') if [ "$extension" = "msi" ] then POL_Wine msiexec /i "$SETUP_PATH" else POL_Wine "$SETUP_PATH" fi } POL_Wine () { # Run the good wineversion and store the result to a logfile # Same usage than "wine" if [ "$1" == "--keep-output" ] then KeepOutput="True" shift fi if [ "$1" == "--ignore-errors" ] then NoErrors="True" shift fi POL_Wine_AutoSetVersionEnv POL_Debug_Message "Running wine-$POL_WINEVERSION "$@"" if [ "$LOGFILE" = "/dev/null" ] || [ "$KeepOutput" = "True" ] then wine "$@" else wine "$@" >> "$LOGFILE" 2>> "$LOGFILE" fi errors="$?" if [ ! "$NoErrors" = "True" ] then [ "$?" = "0" ] || POL_Debug_Error "$(eval_gettext "Wine seems to have crashed\n\nIf you're program is running, just ignore this message")" fi POL_Debug_Message "Wine return: $errors" return $errors } POL_Wine_SelectPrefix() { # Select a wineprefix and remove unexpected chars # Usage: POL_Wine_SelectPrefix [prefixname] PREFNAME=`printf "$1"| tr -c [[a-zA-Z0-9]\.] '_'` POL_Debug_Message "Selecting prefix: $PREFIXNAME" export WINEPREFIX="$POL_USER_ROOT/wineprefix/$PREFNAME" export DOSPREFIX="$WINEPREFIX" export POL_WINEVERSION="$(POL_Config_PrefixRead VERSION)" } POL_Wine_PrefixExists() { # Checks if a prefix exists # Usage: POL_Wine_PrefixExists # Return True or False PREFNAME=`printf "$1"| tr -c [[a-zA-Z0-9]\.] '_'` [ -d "$POL_USER_ROOT/wineprefix/$PREFNAME" ] && echo "True" || echo "False" } POL_Wine_InstallVersion() { # Install a wineverison # Usage: POL_Wine_InstallVersion [VERSION] [ ! "$1" = "" ] && export POL_WINEVERSION="$1" [ "$POL_WINEVERSION" = "" ] && POL_Debug_Fatal "No POL_WINEVERSION set" [ "$POL_ARCH" = "" ] && POL_System_SetArch "auto" POL_Debug_Message "Installing wine version path: $POL_WINEVERSION, $POL_ARCH" [ "$POL_OS" = "Mac" ] && ARCH_PREFIX="darwin" [ "$POL_OS" = "Linux" ] && ARCH_PREFIX="linux" OLDPATH="$PWD" WINE_SECTION="$ARCH_PREFIX-$POL_ARCH" WINEDIR="$REPERTOIRE/wine/$WINE_SECTION" touch "$WINEDIR/installing" if [ ! -e "$WINEDIR/$POL_WINEVERSION" ] then WINE_ADDRESS=$(wget -4 "$WINE_SITE/$WINE_SECTION.lst" -O- | grep ";$POL_WINEVERSION;" | tail -n 1 | cut -d ";" -f1) if [ "$WINE_ADDRESS" = "" ] && [ "$POL_ARCH" = "amd64" ] then POL_Debug_Warning "Wine $1 amd64 does not exist. Switching to x86" POL_System_SetArch "x86" POL_Wine_InstallVersion "$1" else if [ "$WINE_ADDRESS" = "" ] then POL_Debug_Error "$(eval_gettext "Unable to find version: ")$POL_WINEVERSION" POL_SetupWindow_Close exit fi cd "$REPERTOIRE/tmp" POL_SetupWindow_download "$(eval_gettext "Downloading Wine: ")$POL_WINEVERSION" "Wine" "$WINE_SITE/$WINE_SECTION/$WINE_ADDRESS" POL_SetupWindow_wait_next_signal "$(eval_gettext "Downloading Wine: ")$POL_WINEVERSION" "Wine" sleep 1 sha1=$(wget -4 "$WINE_SITE/$WINE_SECTION/$WINE_ADDRESS.sha1" -O- | awk '{print $1}') sha1_file=$(shasum "./$WINE_ADDRESS" | awk '{print $1}') echo "Server sha1 : $sha1" echo "Client sha1 : $sha1_file" if [ ! "$sha1" = "$sha1_file" ] then POL_SetupWindow_message "$(eval_gettext 'The download seems to have failed.')" "Wine $POL_WINEVERSION" else POL_SetupWindow_wait "$(eval_gettext 'Extracting Wine...')" "Wine $POL_WINEVERSION" "$PLAYONLINUX/playonlinux-pkg" -i "$PWD/$WINE_ADDRESS" fi rm "$WINE_ADDRESS" fi fi rm "$WINEDIR/installing" } POL_Wine_AutoSetVersionEnv() { # Get the current prefix's version and set PATH environement variable # Usage: POL_Wine_AutoSetVersionEnv [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "WINEPREFIX is not set!" POL_WINEVERSION="$(POL_Config_PrefixRead "VERSION")" POL_ARCH="$(POL_Config_PrefixRead "ARCH")" [ "$POL_WINEVERSION" = "" ] || POL_Wine_SetVersionEnv } POL_Wine_SetVersionEnv() { # Usage: POL_Wine_SetWineVersion [VERSION] # Get first argument's wine version and set PATH environement variable [ ! "$1" = "" ] && export POL_WINEVERSION="$1" [ "$POL_WINEVERSION" = "" ] && POL_Debug_Warning "No POL_WINEVERSION set, assuming it is reset" [ "$POL_WINEVERSION" = "" ] && export POL_WINEVERSION="--reset" if [ ! "$POL_WINEVERSION" = "" ] then [ "$POL_ARCH" = "" ] && POL_System_SetArch "auto" POL_Debug_Message "Setting wine version path: $POL_WINEVERSION, $POL_ARCH" [ "$POL_OS" = "Mac" ] && ARCH_PREFIX="darwin" [ "$POL_OS" = "Linux" ] && ARCH_PREFIX="linux" OLDPATH="$PWD" WINEDIR="$REPERTOIRE/wine/$ARCH_PREFIX-$POL_ARCH" mkdir -p "$WINEDIR" cd "$WINEDIR" if [ "$POL_WINEVERSION" = "--reset" ] then export PATH="$PATH_ORIGIN" export LD_LIBRARY_PATH="$LD_PATH_ORIGIN" export POL_WINEVERSION="" else if [ ! -e "$WINEDIR/$POL_WINEVERSION" ] then POL_Debug_Message "Wine $POL_WINEVERSION not installed" POL_Wine_InstallVersion "$POL_WINEVERSION" else POL_Debug_Message "\"$WINEDIR/$POL_WINEVERSION\" exists" fi export PATH="$WINEDIR/$POL_WINEVERSION/bin/:$PATH" export LD_LIBRARY_PATH="$WINEDIR/$POL_WINEVERSION/lib/:$LD_LIBRARY_PATH" fi fi cd "$OLDPATH" } POL_Wine_SetVersionPrefix() { # Usage: POL_Wine_SetVersionPrefix [VERSION] # Change a prefix wine version [ ! "$1" = "" ] && export POL_WINEVERSION="$1" [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "WINEPREFIX is not set!" POL_Config_PrefixWrite "VERSION" "$POL_WINEVERSION" } POL_Wine_PrefixCreate() { # Create a wineprefix # Usage: POL_Wine_PrefixCreate [VERSION] POL_Debug_Message "Creating prefix ($1)..." POL_SetupWindow_wait "$(eval_gettext 'Please wait while the virtual drive is being created...')" "$TITLE" [ "$POL_ARCH" = "" ] && POL_System_SetArch "auto" [ "$WINEPREFIX" = "" ] && POL_Debug_Fatal "WINEPREFIX is not set!" if [ -e "$WINEPREFIX" ] then POL_Debug_Message "Prefix already exists" [ ! "$1" = "" ] && export POL_WINEVERSION="$1" if [ ! "$POL_WINEVERSION" = "" ] then POL_Debug_Message "Setting version to $POL_WINEVERSION" POL_Wine_SetVersionPrefix "$POL_WINEVERSION" POL_Wine_SetVersionEnv fi else [ ! "$1" = "" ] && export POL_WINEVERSION="$1" if [ "$POL_WINEVERSION" = "" ] then POL_Debug_Message "No version specified. Using system version ($(wine --version))" wine wineboot if [ -e "$WINEPREFIX/drive_c/windows/syswow64" ] # It is a 64 bits prefix then POL_Config_PrefixWrite "ARCH" "amd64" else POL_Config_PrefixWrite "ARCH" "x86" fi POL_LoadVar_PROGRAMFILES else mkdir -p "$WINEPREFIX" POL_Debug_Message "Using wine $POL_WINEVERSION" POL_Wine_InstallVersion "$POL_WINEVERSION" POL_Config_PrefixWrite "ARCH" "$POL_ARCH" POL_Config_PrefixWrite "VERSION" "$POL_WINEVERSION" which wineprefixcreate && POL_Wine wineprefixcreate POL_Wine wineboot POL_LoadVar_PROGRAMFILES fi fi sleep 3 # We wait 3 seconds, so that we are sure that .reg file are created POL_LoadVar_PROGRAMFILES } POL_Wine_OverrideDLL() { # Override DLLs mode=$1 [ "$mode" = "disabled" ] && unset mode shift cat << EOF > "$POL_USER_ROOT/tmp/override-dll.reg" REGEDIT4 [HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides] EOF while test "$1" != "" do echo "\"*$1\"=\"$mode\"" >> "$POL_USER_ROOT/tmp/override-dll.reg" shift done POL_Debug_Message "Overriting DLLs" POL_SetupWindow_wait_next_signal "Please wait" "$TITLE" POL_Wine regedit "$POL_USER_ROOT/tmp/override-dll.reg" } POL_Wine_OverrideDLL_App() { APP="$1" MODE="$2" DLL="$3" cd "$POL_USER_ROOT/ressources" [ -e "$POL_USER_ROOT/ressources/app_dll_override.reg" ] && rm app_dll_override.reg echo "REGEDIT4" > app_dll_override.reg echo "" >> app_dll_override.reg echo "[HKEY_CURRENT_USER\\Software\\Wine\\AppDefaults\\$APP\\DllOverrides]" >> app_dll_override.reg until [ "$DLL" == "" ]; do if [ "$DLL" = "comctl32" ]; then rm -rf "$WINEPREFIX/winsxs/manifests/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef.manifest" fi echo "\"$DLL\"=\"$MODE\"" >> app_dll_override.reg shift DLL="$3" done regedit app_dll_override.reg rm app_dll_override.reg } POL_Wine_WaitExit () { # Lock bash commands until wine is exited if [ "$1" = "--force-input" ] then forceInput="true" shift fi SOFTNAME="$1" [ "$1" = "" ] && message="$(eval_gettext "Please wait...")" || message="$(eval_gettext 'Please wait while $SOFTNAME is installed...')" POL_SetupWindow_wait "$message" "$TITLE" wineserver -w || POL_SetupWindow_message "$(eval_gettext 'Press next only when the installation process is finished')" "$TITLE" [ "$forceInput" = "true" ] && POL_SetupWindow_message "$(eval_gettext 'Press next only when the installation process is finished')" "$TITLE" } POL_Wine_reboot () { # Simulate windows reboot POL_SetupWindow_wait_next_signal "$(eval_gettext 'Please wait while $APPLICATION_TITLE is simulating a Windows reboot')" "Wine" POL_Wine wineboot }