#!/bin/bash # # Future Pinball v1.6b.20061029 install script # Script version 0.9.40b (2007-07-07) by LvR # Get lastest version at http://fprelease.free.fr/fpwine/ # # Changelog : # v0.9.40b : The script now modify menu entries and I change dlloverriding # v0.9.40 : Create a winecfg launcher, auto sound config # v0.9.39c : Set alternative method to install vbscript.dll # v0.9.39b : Add native urlmon.dll installation # v0.9.39 : First release # # Script Configuration winePrefix="$HOME/.fpwine" nativeOle="n" urlDcom="http://download.microsoft.com/download/d/1/3/d13cd456-f0cf-4fb2-a17f-20afc79f8a51/DCOM98.EXE" nativeCrypt="n" urlCrypt="http://fprelease.free.fr/fpwine/dlls/crypt32.dll" urlRsa="http://fprelease.free.fr/fpwine/dlls/rsaenh.dll" nativeUrlmon="n" urlUrlmon="http://fprelease.free.fr/fpwine/dlls/urlmon.dll" urlFP="http://www.futurepinball.com/downloads/FuturePinballSetup_v1.6b.20061029.exe" urlVbs="http://download.microsoft.com/download/IE60/Patch/Q318089/W9XNT4Me/EN-US/vbs56men.exe" # Some usefull functions execute() { eval $1 if [ "$?" != "0" ] then echo -n "Error : can't execute '$1'" if [ -z "$2" ] then echo else echo ", $2" fi exit 1 fi } download() { if [ ! -r "$1" ] then if [ "$auto" = "n" ] then echo -n "Can't find $1, try to download it ? [Y/n] : " read answer else answer="" fi if [ -z "$answer" ] || [ "$answer" = "Y" ] || [ "$answer" = "y" ] then wget "$2" if [ "$?" != "0" ] then echo "error : can't download $1" else echo "$1 successfully downloaded" fi fi fi } # Disclaimer echo "-----------------------------------------------------------" echo " Future Pinball v1.6b.20061029 install script" echo " Script version 0.9.40b (2007-07-07) by LvR" echo " Get lastest version at http://fprelease.free.fr/fpwine/" echo "-----------------------------------------------------------" echo " Configured for wine 0.9.40" echo " With older version, use --noauto switch and choose : " echo " - for wine < 0.9.39 : install natives crypto dlls" echo " - for wine < 0.9.40 : try low quality sound config" echo "-----------------------------------------------------------" # Help if [ "$1" = "--help" ] then echo " Usage :" echo " `basename $0` [--help] [-n] [--noauto]" echo " Options :" echo " -n,--noauto : ask user for installing some components, " echo " mainly for testing FP with differents" echo " wine versions/configurations" echo " --help : display this help" echo "-----------------------------------------------------------" exit 0 fi # Automatic installation ? if [ "$1" = "--noauto" ] || [ "$1" = "-n" ] then auto="n" else auto="y" fi # Check if wine is installed echo echo -n "Checking wine version : " execute 'wine --version' 'you must install wine before installing Future Pinball' # Check if 3d acceleration is ok execute 'accel=`glxinfo | grep "direct rendering" | cut -d ":" -f2`' accel=`echo $accel` #trim accel echo echo -n "Checking 3D acceleration : " if [ "$accel" = "Yes" ] then echo "ok" else echo "not found" echo "Error : you need 3D acceleration activated to run Future Pinball." exit 1 fi # Choose wine prefix echo if [ "$auto" = "n" ] then echo -n "Enter wine prefix [$winePrefix] : " read answer else answer="" fi if [ -z "$answer" ] then echo "Using default prefix : $winePrefix" else winePrefix="$answer" echo "Using prefix : $winePrefix" fi # Delete previous wine root echo if [ "$auto" = "n" ] then echo -n "Delete old $winePrefix directory [Y/n] : " read answer else answer="" fi if [ -z "$answer" ] || [ "$answer" = "Y" ] || [ "$answer" = "y" ] then rm -rf "$winePrefix" echo "$winePrefix deleted" fi # Initialize wineprefix execute "WINEPREFIX=$winePrefix wineprefixcreate" echo "$winePrefix initialized" # Install Windows Script Host : VBScript only download "`basename $urlVbs`" "$urlVbs" if [ ! -r "vbs56men.exe" ] then echo "Error : needed vbs56men.exe not found. Please download it and retry" exit 1 fi execute "WINEPREFIX=$winePrefix wine vbs56men.exe /Q" # Install native OLE echo if [ "$auto" = "n" ] then echo -n "Install native ole dlls [Y/n] : " read answer else answer="" fi if [ -z "$answer" ] || [ "$answer" = "Y" ] || [ "$answer" = "y" ] then download "`basename $urlDcom`" "$urlDcom" if [ ! -r "DCOM98.EXE" ] then echo "Error : needed DCOM98.EXE not found. Please download it and retry" exit 1 fi echo "Installing DCOM98.EXE ..." echo 'REGEDIT4' > win98.reg echo '' >> win98.reg echo '[HKEY_CURRENT_USER\Software\Wine]' >> win98.reg echo '"Version"="win98"' >> win98.reg execute "WINEPREFIX=$winePrefix wine regedit win98.reg" execute "rm $winePrefix/drive_c/windows/system32/ole32.dll" execute "rm $winePrefix/drive_c/windows/system32/oleaut32.dll" execute "rm $winePrefix/drive_c/windows/system32/olepro32.dll" execute "rm $winePrefix/drive_c/windows/system32/rpcrt4.dll" execute "WINEPREFIX=$winePrefix WINEDLLOVERRIDES=ole32,advpack=n wine DCOM98.EXE /Q" execute "rm win98.reg" nativeOle="y" fi # Install native urlmon.dll echo if [ "$auto" = "n" ] then echo -n "Install native urlmon.dll [Y/n] : " read answer else answer="" fi if [ -z "$answer" ] || [ "$answer" = "Y" ] || [ "$answer" = "y" ] then download "`basename $urlUrlmon`" "$urlUrlmon" if [ ! -r "urlmon.dll" ] then echo "Error : needed urlmon.dll not found. Please download it and retry" exit 1 fi echo "Installing native urlmon.dll ..." execute "cp urlmon.dll $winePrefix/drive_c/windows/system32/" nativeUrlmon="y" fi # Install native crypto dlls echo if [ "$auto" = "n" ] then echo -n "Install natives crypto dlls [y/N] : " read answer else answer="" fi if [ "$answer" = "Y" ] || [ "$answer" = "y" ] then download "`basename $urlCrypt`" "$urlCrypt" if [ ! -r "crypt32.dll" ] then echo "Error : needed crypt32.dll not found. Please download it and retry" exit 1 fi download "`basename $urlRsa`" "$urlRsa" if [ ! -r "rsaenh.dll" ] then echo "Error : needed crypt32.dll not found. Please download it and retry" exit 1 fi echo "Installing natives crypt32.dll and rsaenh.dll ..." execute "cp crypt32.dll $winePrefix/drive_c/windows/system32/" execute "cp rsaenh.dll $winePrefix/drive_c/windows/system32/" nativeCrypt="y" fi # Set winxp compatibility echo echo "Setting windows XP compatibility" echo 'REGEDIT4' > winxp.reg echo '' >> winxp.reg echo '[HKEY_CURRENT_USER\Software\Wine]' >> winxp.reg echo '"Version"="winxp"' >> winxp.reg execute "WINEPREFIX=$winePrefix wine regedit winxp.reg" execute "rm winxp.reg" # Setting sound config echo if [ "$auto" = "n" ] then echo "Select a sound config : " PS3="Your choice : " select answer in 'High quality' 'Low quality' 'No sound' do case "$answer" in 'High quality') break; ;; 'Low quality') break; ;; 'No sound') break; ;; *) echo "Invalid choice !" esac done PS3="" else answer='High quality' fi echo 'REGEDIT4' > soundcfg.reg echo '' >> soundcfg.reg case "$answer" in 'High quality') echo "Setting high quality sound ..." echo '[HKEY_CURRENT_USER\Software\Wine\Drivers]' >> soundcfg.reg echo '"Audio"="oss"' >> soundcfg.reg echo '' >> soundcfg.reg echo '[HKEY_CURRENT_USER\Software\Wine\DirectSound]' >> soundcfg.reg echo '"DefaultSampleRate"="22050"' >> soundcfg.reg echo '"HardwareAcceleration"="Emulation"' >> soundcfg.reg ;; 'Low quality') echo "Setting low quality sound ..." echo '[HKEY_CURRENT_USER\Software\Wine\Drivers]' >> soundcfg.reg echo '"Audio"="oss"' >> soundcfg.reg echo '' >> soundcfg.reg echo '[HKEY_CURRENT_USER\Software\Wine\DirectSound]' >> soundcfg.reg echo '"DefaultSampleRate"="11025"' >> soundcfg.reg echo '"EmulDriver"="Y"' >> soundcfg.reg echo '"HardwareAcceleration"="Emulation"' >> soundcfg.reg ;; 'No sound') echo "Setting no sound ..." echo '[HKEY_CURRENT_USER\Software\Wine\Drivers]' >> soundcfg.reg echo '"Audio"=""' >> soundcfg.reg ;; *) echo "Error : bad luck, it's a script error :(" exit 1 esac execute "WINEPREFIX=$winePrefix wine regedit soundcfg.reg" execute "rm soundcfg.reg" # Set dlls overridding if [ "$nativeUrlmon" = "y" ] || [ "$nativeCrypt" = "y" ] || [ "$nativeOle" = "y" ] then echo echo "Setting dlls overridding" echo 'REGEDIT4' > dlls.reg echo '' >> dlls.reg echo '[HKEY_CURRENT_USER\Software\Wine\DllOverrides]' >> dlls.reg if [ "$nativeUrlmon" = "y" ] then echo '"urlmon"="native,builtin"' >> dlls.reg fi if [ "$nativeCrypt" = "y" ] then echo '"crypt32"="native,builtin"' >> dlls.reg echo '"rsaenh"="native,builtin"' >> dlls.reg fi if [ "$nativeOle" = "y" ] then echo '"ole32"="native,builtin"' >> dlls.reg echo '"oleaut32"="native,builtin"' >> dlls.reg fi execute "WINEPREFIX=$winePrefix wine regedit dlls.reg" execute "rm dlls.reg" fi # Install Future Pinball echo download "`basename $urlFP`" "$urlFP" if [ ! -r "FuturePinballSetup_v1.6b.20061029.exe" ] then echo "Error : needed FuturePinballSetup_v1.6b.20061029.exe not found. Please download it and retry" exit 1 fi echo "Installing Future Pinball ..." #execute "mkdir -p $winePrefix/drive_c/\"Program Files\"/\"Future Pinball\"" execute "WINEPREFIX=$winePrefix wine FuturePinballSetup_v1.6b.20061029.exe" # Create some FP launchers # Standard launcher echo '#!/bin/bash' > runFP echo '' >> runFP echo "WINEPREFIX=$winePrefix WINEDEBUG=-all wine $winePrefix/drive_c/\"Program Files\"/\"Future Pinball\"/\"Future Pinball.exe\"" >> runFP # Launcher in debug mode echo '#!/bin/bash' > debugFP echo '' >> debugFP echo 'logFile=`date -u "+%Y%m%d_%H%M%S"`' >> debugFP echo 'touch "fp_$logFile.out"' >> debugFP echo "WINEPREFIX=$winePrefix WINEDEBUG=+loaddll wine $winePrefix/drive_c/\"Program Files\"/\"Future Pinball\"/\"Future Pinball.exe\" &> fp_\$logFile.out & tail -f fp_\$logFile.out" >> debugFP # winecfg launcher echo '#!/bin/bash' > cfgFP echo '' >> cfgFP echo "WINEPREFIX=$winePrefix winecfg" >> cfgFP execute 'chmod +x runFP' execute 'chmod +x debugFP' execute 'chmod +x cfgFP' # Modify menu entries DESKTOP_LNK="$HOME/Desktop/Future Pinball.lnk" if [ -e "$DESKTOP_LNK" ] then echo "Deleting $DESKTOP_LNK" rm "$DESKTOP_LNK" fi DESKTOP_DES="$HOME/Desktop/Future Pinball.desktop" if [ -e "$DESKTOP_DES" ] then echo "Recreating $DESKTOP_DES" echo "[Desktop Entry]" > "$DESKTOP_DES" echo "Name=Future Pinball" >> "$DESKTOP_DES" echo "Exec=env WINEPREFIX=\"/home/lvr/.fpwine\" WINEDEBUG=-all wine \"C:\\\\Program Files\\\\Future Pinball\\\\Future Pinball.exe\"" >> "$DESKTOP_DES" echo "Type=Application" >> "$DESKTOP_DES" echo "Icon=443e_future pinball.0" >> "$DESKTOP_DES" fi LOCAL_DES="$HOME/.local/share/applications/wine/Programmes/Future Pinball/Future Pinball.desktop" if [ -e "$LOCAL_DES" ] then echo "Recreating $LOCAL_DES" echo "[Desktop Entry]" > "$LOCAL_DES" echo "Name=Future Pinball" >> "$LOCAL_DES" echo "Exec=env WINEPREFIX=\"/home/lvr/.fpwine\" WINEDEBUG=-all wine \"C:\\\\Program Files\\\\Future Pinball\\\\Future Pinball.exe\"" >> "$LOCAL_DES" echo "Type=Application" >> "$LOCAL_DES" echo "Icon=443e_future pinball.0" >> "$LOCAL_DES" fi LOCAL_URL="$HOME/.local/share/applications/wine/Programmes/Future Pinball/Future Pinball Support Forums.desktop" if [ -e "$LOCAL_URL" ] then echo "Recreating $LOCAL_URL" echo "[Desktop Entry]" > "$LOCAL_URL" echo "Name=Future Pinball Support Forums" >> "$LOCAL_URL" echo "Exec=env WINEPREFIX=\"/home/lvr/.fpwine\" winebrowser http://www.futurepinball.com/forum" >> "$LOCAL_URL" echo "Type=Application" >> "$LOCAL_URL" echo "Icon=3550_shell32.0" >> "$LOCAL_URL" fi LOCAL_MAN="$HOME/.local/share/applications/wine/Programmes/Future Pinball/Future Pinball Manual.desktop" if [ -e "$LOCAL_MAN" ] then echo "Recreating $LOCAL_MAN" echo "[Desktop Entry]" > "$LOCAL_MAN" echo "Name=Future Pinball Manual" >> "$LOCAL_MAN" echo "Exec=env WINEPREFIX=\"/home/lvr/.fpwine\" wine hh \"C:\\\\Program Files\\\\Future Pinball\\\\Help\\\\Future Pinball Manual.chm\"" >> "$LOCAL_MAN" echo "Type=Application" >> "$LOCAL_MAN" echo "Icon=443e_future pinball.8" >> "$LOCAL_MAN" fi #TODO : do something with this entry ? #LOCAL_UN="$HOME/.local/share/applications/wine/Programmes/Future Pinball/Uninstall Future Pinball.desktop # End of script echo echo "Installation done !" echo "You can now run Future Pinball with runFP command." echo