Guest User

evemake wine prefixe

a guest
Apr 12th, 2017
363
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.58 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. prefixroot="$HOME/wineprefixes"
  4.  
  5. name="eve"
  6. arch="win32"
  7. shared=""
  8. del=false
  9. print=false
  10.  
  11. EVEBINARYURL="http://binaries.eveonline.com/EveLauncher-1104888.exe"
  12. EVEINSTALER="$(source ~/.config/user-dirs.dirs; echo $XDG_DOWNLOAD_DIR)/evelauncher.exe"
  13. while test $# -gt 0
  14. do
  15.     case "$1" in
  16.         --32)
  17.             arch="win32"
  18.             ;;
  19.         --64)
  20.             arch="win64"
  21.             ;;
  22.         --shared=*)
  23.             shared=$(echo "$1" | sed s/--shared=//g)
  24.             ;;
  25.         --print)
  26.             print=true
  27.             ;;
  28.         --proot=*)
  29.             prefixroot=$(echo "$1" | sed s/--proot=//g)
  30.             ;;
  31.         --delete)
  32.             del=true
  33.             ;;
  34.         --help)
  35.             echo "create a wine prefixe. options are :
  36. --32 to create a 32-bit wine prefix [default]
  37. --64 to create a 64-bit wine prefix
  38. --delete an existing eve prefix instead of creating it
  39. --help show this and exit
  40. --print print variables then exit, do not modify existing prefixes
  41. --proot=X specify the wineprefix root. default is $prefixroot
  42. --shared=X to specify your shared Eve folder (for settings). default is none, meaning settings are not shared"
  43.             exit 0
  44.             ;;
  45.         *)
  46.             name="$1"
  47.             ;;
  48.         esac
  49.         shift
  50. done
  51.  
  52. prefix="$prefixroot/$name"
  53. launcher=$(source ~/.config/user-dirs.dirs; echo $XDG_DESKTOP_DIR)/"$name"
  54.  
  55. if [ "$print" = true ]
  56. then
  57.     echo shared = "$shared"
  58.     echo prefix = "$prefix"
  59.     echo prefixroot= "$prefixroot"
  60.     echo name = "$name"
  61.     echo arch = "$arch"
  62.     echo eveinstaller = "$EVEINSTALER"
  63.     exit 0
  64. fi
  65.  
  66. if [ ! -z "$shared" ]
  67. then mkdir -p "$shared" ; fi
  68.  
  69. if [ -d "$prefix" ]
  70. then
  71.     if [ "$del" = true ]
  72.     then
  73.         rm -rf "$prefix"
  74.         rm "$launcher"
  75.     else
  76.         echo "prefix $prefix already present and not requested to delete with --delete. Exiting."
  77.         exit 0
  78.     fi
  79. else
  80.     mkdir -p prefix
  81.     WINEPREFIX="$prefix" WINEARCH="$arch" wine wineboot
  82.     WINEPREFIX="$prefix" WINEARCH="$arch" winetricks corefonts
  83.     #create symlinks to shared and configs
  84.     if [ ! -z "$shared" ]
  85.     then
  86.         mkdir -p "$prefix/drive_c/users/$USER/Local Settings"
  87.         mkdir -p "$shared/Application Data"
  88.         rm "$prefix/drive_c/users/$USER/Local Settings/Application Data" -r
  89.         ln -s "$shared/Application Data" "$prefix/drive_c/users/$USER/Local Settings/"
  90.         mkdir -p "$shared/SharedCache"
  91.         mkdir -p "$prefix/drive_c/EVE/"
  92.         ln -s "$shared/SharedCache" "$prefix/drive_c/EVE/"
  93.     fi
  94.     # make launcher exec on desktop
  95.     echo '#!/bin/bash'$'\n'"cd $prefix"$'\n'"WINEDEBUG=-all WINEPREFIX=$prefix wine "'C:\\\\Eve\\eve.exe' >"$launcher"
  96.     chmod +x "$launcher"
  97.     # dl and start the Eve launcher
  98.     if [ ! -f "$EVEINSTALER" ] ; then wget "$EVEBINARYURL" -O "$EVEINSTALER"; fi
  99.     WINEPREFIX="$prefix" WINEARCH="$arch" wine "$EVEINSTALER"
  100. fi
Advertisement
Add Comment
Please, Sign In to add comment