DanAlucard

Install_LoL.sh

Jun 13th, 2012
2,268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.85 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Author: Danilo Riffo (aka. DanAlucard)
  4. # License: GPL v3
  5. #
  6. # made for own usage and for the WineHQ - League of Legends community
  7. #
  8. #
  9.  
  10. scriptWD=$(pwd)
  11.  
  12. #################################################################################
  13. #download and extract the wine source                                           #
  14. #################################################################################
  15. echo "downloading wine source..."
  16. wget http://downloads.sourceforge.net/project/wine/Source/wine-1.5.7.tar.bz2
  17.  
  18. echo "extracting wine source..."
  19. tar -xjf wine-1.5.7.tar.bz2 && mv wine-1.5.7 $HOME/wine-1.5.7
  20.  
  21. #################################################################################
  22. #variable that we will need to compile and configure wine                       #
  23. #################################################################################
  24. WINEPREFIX=$HOME/LoL_wine
  25.  
  26. #################################################################################
  27. #prepare wine to be compiled                                                    #
  28. #################################################################################
  29. echo "going into $HOME/wine-1.5.7"
  30. cd $HOME/wine-1.5.7
  31.  
  32. echo "downloading Wine patches, so it can properly run LoL..."
  33. wget http://uz.sns.it/~ranma42/iLoL/spectator-fix-v3/0001-ntdll-Improve-performace-of-heap-allocation-v2.patch -O patch1.patch
  34. wget http://uz.sns.it/~ranma42/iLoL/spectator-fix-v3/0002-imm32-Avoid-deadlock-when-destroying-thread-data-v2.patch -O patch2.patch
  35. wget http://bugs.winehq.org/attachment.cgi?id=39446 -O lol-store-1.patch
  36. wget http://bugs.winehq.org/attachment.cgi?id=39447 -O lol-store-2.patch
  37. wget http://bugs.winehq.org/attachment.cgi?id=39449 -O lol-store-3.patch
  38.  
  39.  
  40. echo "download complete. Patching wine..."
  41. patch -p1 < patch.patch
  42. patch -p1 < patch1.patch
  43. patch -p1 < lol-store-1.patch
  44. patch -p1 < lol-store-2.patch
  45. patch -p1 < lol-store-3.patch
  46.  
  47.  
  48. #################################################################################
  49. #configure and compile:                                                         #
  50. #################################################################################
  51. echo "configuring wine..."
  52. ./configure --prefix=$WINEPREFIX
  53.  
  54. echo "I'm going to compile wine."
  55. echo "It will take a while, so close all your applications, press enter and go to drink something..."
  56. read $foo
  57.  
  58. echo "compiling wine..."
  59. make -j2       #this makes 'make' to have 2 jobs (use 2 CPU cores). For muti-core CPUs this is just awesome.
  60.  
  61. echo "installing wine into $WINEPREFIX"
  62. make install   #this installs wine into WINEPREFIX directory.
  63.  
  64. #################################################################################
  65. #prepare the wineprefix environment                                             #
  66. #################################################################################
  67. echo "preparing the Wine Prefix environment..."
  68. export WINEPREFIX=$HOME/LoL_wine/LoL_Prefix  #directory where we want to create the wineprefix
  69. WINEXE=$HOME/LoL_wine/bin/wine               #location of wine executable
  70. $HOME/LoL_wine/bin/winecfg                   #run winecfg to create the wineprefix
  71. winetricks d3dx9 vcrun2005 vcrun2008 wininet corefonts ie6 win7
  72.  
  73. # if you have the web-based installer, use this
  74. echo "running LoL Installer..."
  75. GC_DONT_GC=1 $WINEXE $scriptWD/LeagueofLegends.exe
  76. # if you are not using the web-based installer comment all the previous block until here.
  77.  
  78.  
  79. # if you have the full installer, uncomment and use this two lines:
  80. #echo "running LoL Installer..."
  81. #$WINEXE $scriptWD/LoL_installer/setup.exe         #LoL full installer is suposed to be on the same directory as this script, into
  82.                                                 #the LoL_installer folder. Change this command to point into the real location
  83.                                                 #of the installer if you don't want to move or rename the folder ;)
  84.  
  85. #################################################################################
  86. #create the loltask script to optimize LoL threading                            #
  87. #################################################################################
  88. echo "creating loltask thread optimizer for LoL..."
  89.  
  90. echo "#!/bin/bash
  91.  
  92. OLDPID='a'
  93.  
  94. INFINITEBUCLE='yes'
  95. until [ $INFINITEBUCLE = 'no' ]; do
  96.  
  97.        LOLPID=\`ps -A | grep -m 1 'League of Legen' | awk '{print $1}'\`
  98.        WINESVRPID=\`ps -A | grep -m 1 'wineserver' | awk '{print $1}'\`
  99.        WINEDEVPID=\`ps -A | grep -m 1 'winedevice.exe' | awk '{print $1}'\`
  100.  
  101.        if [ ! $LOLPID ]; then
  102.                echo 'League of Legends is not running'
  103.        elif [ $OLDPID != $LOLPID ]; then
  104.                OLDPID=$LOLPID
  105.                taskset -p 1 $LOLPID
  106.                renice -n -10 $LOLPID
  107.                renice -n -10 $WINESVRPID
  108.                renice -n -10 $WINEDEVPID
  109.        else
  110.                echo 'League of Legends is already tuned.'
  111.        fi
  112.  
  113.        sleep 15
  114. done
  115. " > ./loltask
  116.  
  117. # change kdesu to gksu if u don't use KDE
  118. kdesu mv ./loltask /usr/bin/loltask
  119. kdesu chmod +x /usr/bin/loltask
  120.  
  121. #################################################################################
  122. #now, we're ready to create the launcher                                        #
  123. #################################################################################
  124. echo "creating the launcher..."
  125.  
  126. echo "#!/bin/bash
  127.  
  128. export WINEPREFIX=\$HOME/LoL_wine/LoL_Prefix  #directory where we want to create the wineprefix
  129. WINEXE=\$HOME/LoL_wine/bin/wine               #location of wine executable
  130.  
  131. cd \$WINEPREFIX/drive_c/Riot\ Games/League\ of\ Legends/RADS/system/
  132. \$WINEXE \"rads_user_kernel.exe\" run lol_launcher \$(ls ../projects/lol_launcher/releases/) LoLLauncher.exe &
  133.  
  134. loltask_instance=\$(ps -A | grep loltask)
  135. if [ ! "\$loltask_instance" ]; then
  136.        # change kdesu to gksu if u don't use KDE
  137.        kdesu loltask &
  138. else
  139.        echo "loltask is already started. You don\'t want it to be started again \;\)"
  140. fi
  141.  
  142. " > $HOME/Desktop/Play_LeagueOfLegends.sh
  143.  
  144. chmod +x $HOME/Desktop/Play_LeagueOfLegends.sh
  145.  
  146. #################################################################################
  147. #clean the mess I've done                                                       #
  148. #################################################################################
  149. echo "removing temporary files..."
  150. rm -R $HOME/wine-1.5.5
  151. rm $scriptWD/wine-1.5.7.tar.bz2
  152.  
  153. #################################################################################
  154. #finalize                                                                       #
  155. #################################################################################
  156. echo "LoL build completed!"
  157. echo ""
  158. echo ""
  159. echo "to play League of Legends just double click the icon in your desktop ;)"
  160. echo ""
  161. echo ""
Add Comment
Please, Sign In to add comment