xisberto

mtga.sh

May 7th, 2018
682
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.85 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. export WINEARCH=win32
  4. export WINEPREFIX="$HOME/.local/share/wineprefixes/mtga"
  5.  
  6. command -v curl > /dev/null 2>&1 || {
  7.     echo -e "Você precisa instalar o curl para checar a versão do MTGA.\nInstale com o comando abaixo:\n\tsudo apt install curl"
  8.     exit 1
  9. }
  10.  
  11. cd "$WINEPREFIX/drive_c/Program Files/Wizards of the Coast/MTGA/"
  12. CUR_VERSION=$(awk -F "=" '/ApplicationVersion/ {print $2}' MTGAUpdater.ini)
  13. URL=$(awk -F "=" '/URL/ {print $2}' MTGAUpdater.ini)
  14. NEW_VERSION=$(curl $URL 2>/dev/null| awk -F "=" '/ProductVersion/ {print $2}' | tr -d ' ')
  15.  
  16. echo "Versão atual: $CUR_VERSION"
  17. echo "Nova versão:  $NEW_VERSION"
  18.  
  19. if [ $CUR_VERSION = $NEW_VERSION ]
  20. then
  21.     echo "Iniciando jogo"
  22.     wine "$WINEPREFIX/drive_c/Program Files/Wizards of the Coast/MTGA/MTGA.exe"
  23. else
  24.     zenity --warning --text="Nova versão disponível: $NEW_VERSION"
  25. fi
  26.  
  27. exit 0
Advertisement
Add Comment
Please, Sign In to add comment