Changes in / [1:3]


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • /angrybirds.sh

    r1 r3  
    11#!/bin/bash 
    22 
    3 /*************************************************************************** 
    4  *   Copyright (C) 2012 by Tobias Vogel                                    * 
    5  *   t.vogel@linux-multimedia.ch                                           * 
    6  *                                                                         * 
    7  *   This program is free software; you can redistribute it and/or modify  * 
    8  *   it under the terms of the GNU General Public License version 2        * 
    9  *   as published by the Free Software Foundation.                         * 
    10  *                                                                         * 
    11  *   This program is distributed in the hope that it will be useful,       * 
    12  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        * 
    13  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         * 
    14  *   GNU General Public License for more details.                          * 
    15  *                                                                         * 
    16  *   You should have received a copy of the GNU General Public License     * 
    17  *   along with this program; if not, write to the                         * 
    18  *   Free Software Foundation, Inc.,                                       * 
    19  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
    20  ***************************************************************************/ 
     3#/*************************************************************************** 
     4# *   Copyright (C) 2012 by Tobias Vogel                                    * 
     5# *   t.vogel@linux-multimedia.ch                                           * 
     6# *                                                                         * 
     7# *   This program is free software; you can redistribute it and/or modify  * 
     8# *   it under the terms of the GNU General Public License version 2        * 
     9# *   as published by the Free Software Foundation.                         * 
     10# *                                                                         * 
     11# *   This program is distributed in the hope that it will be useful,       * 
     12# *   but WITHOUT ANY WARRANTY; without even the implied warranty of        * 
     13# *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         * 
     14# *   GNU General Public License for more details.                          * 
     15# *                                                                         * 
     16# *   You should have received a copy of the GNU General Public License     * 
     17# *   along with this program; if not, write to the                         * 
     18# *   Free Software Foundation, Inc.,                                       * 
     19# *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
     20# ***************************************************************************/ 
    2121 
    2222ABIRDS_URL="http://drm-pc.angrybirdsgame.com/?dl=abc" 
    2323DLL_URL="http://www.dll-files.com" 
    2424DLL1_URL="http://www.dll-files.com/dllindex/dll-files.shtml?appupwrapper" 
    25 DLL2_URL="http://www.dll-files.com/dllindex/dll-files.shtml?msvcp90" 
     25DLL2_URL="http://www.dll-files.com/dllindex/dll-files.shtml?msvcp100" 
    2626DLL3_URL="http://www.dll-files.com/dllindex/dll-files.shtml?msvcr100" 
    2727 
     
    3030export ABIRDS_URL ABIRDS_WPRFIX DLL_URL DLL1_URL DLL2_URL DLL3_URL 
    3131 
    32 WINEPREFIX=$ABIRDS_WPRFIX wineboot -u 
     32if [ "x$#" == "x0" ]; then 
     33  echo "Doing a standard install." 
     34else 
     35  ARGC=0 
     36  for ARGV in $@; do 
     37  let ARGC=($ARGC+1) 
     38    if [ "x$ARGV" == "x-h" -o "x$ARGV" == "x--help" ]; then 
     39      echo "" 
     40      echo " Usage: angrybirds.sh [OPTIONS]" 
     41      echo "" 
     42      echo "  NOTE: no options are needed for a standard install!" 
     43      echo "" 
     44      echo "   -h               display this help and exit" 
     45      echo "   -i <SETUPFILE>   specify custom Angry Birds Setup.exe"  
     46      echo "   -u <URL>         specify custom download URL for" 
     47      echo "                    Angry Birds Setup.exe" 
     48      echo "   -w \"<ARGS>\"      parse extra arguments to wine" 
     49      echo "   -d <DIR>         specify custom directory where" 
     50      echo "                    the required dll files reside in:" 
     51      echo "                       -> appupwrapper.dll" 
     52      echo "                       -> msvcp100.dll" 
     53      echo "                       -> msvcr100.dll" 
     54      echo "" 
     55      exit 0 
     56    fi 
     57    if [ "x$ARGV" == "x-i" ]; then 
     58      ISSET_CUSTOM_SETUP_FILE="1" 
     59      let CUSTOM_SETUP_FILE_ARGC=($ARGC+1) 
     60      unset CUSTOM_SETUP_FILE 
     61      CUSTOM_SETUP_FILE="${@:$CUSTOM_SETUP_FILE_ARGC:1}" 
     62      export CUSTOM_SETUP_FILE ISSET_CUSTOM_SETUP_FILE 
     63      if [ -z "$CUSTOM_SETUP_FILE" ]; then 
     64        echo "Invalid file specified." 
     65        exit 1 
     66      elif [ ! -f "$CUSTOM_SETUP_FILE" ]; then 
     67        echo "File $CUSTOM_SETUP_FILE does not exist." 
     68        exit 127 
     69      fi 
     70    fi 
     71    if [ "x$ARGV" == "x-u" ]; then 
     72      ISSET_CUSTOM_SETUP_URL="1" 
     73      let CUSTOM_SETUP_URL_ARGC=($ARGC+1) 
     74      unset CUSTOM_SETUP_URL 
     75      CUSTOM_SETUP_URL="${@:$CUSTOM_SETUP_URL_ARGC:1}" 
     76      export CUSTOM_SETUP_URL ISSET_CUSTOM_SETUP_URL 
     77      if [ -z "$CUSTOM_SETUP_URL" ]; then 
     78        echo "Invalid URL specified." 
     79        exit 1 
     80      fi 
     81    fi 
     82    if [ "x$ARGV" == "x-w" ]; then 
     83      ISSET_CUSTOM_WINE_ARGS="1" 
     84      let CUSTOM_WINE_ARGS_ARGC=($ARGC+1) 
     85      unset CUSTOM_WINE_ARGS 
     86      CUSTOM_WINE_ARGS="${@:$CUSTOM_WINE_ARGS_ARGC:1}" 
     87      export CUSTOM_WINE_ARGS ISSET_CUSTOM_WINE_ARGS 
     88      if [ -z "$CUSTOM_WINE_ARGS" ]; then 
     89        echo "Invalid Wine arguments specified." 
     90        exit 1 
     91      fi 
     92    fi 
     93    if [ "x$ARGV" == "x-d" ]; then 
     94      ISSET_CUSTOM_DLL_DIR="1" 
     95      let CUSTOM_DLL_DIR_ARGC=($ARGC+1) 
     96      unset CUSTOM_DLL_DIR 
     97      CUSTOM_DLL_DIR="${@:$CUSTOM_DLL_DIR_ARGC:1}" 
     98      export ISSET_CUSTOM_DLL_DIR CUSTOM_DLL_DIR 
     99      if [ ! -d "$CUSTOM_DLL_DIR" ]; then 
     100        echo "Invalid dll directory specified." 
     101        exit 1 
     102      elif [ ! -f "$CUSTOM_DLL_DIR/appupwrapper.dll" -a ! -f "$CUSTOM_DLL_DIR/AppUpWrapper.dll" ]; then 
     103        echo "File \"appupwrapper.dll\" not found." 
     104        exit 127 
     105      elif [ ! -f "$CUSTOM_DLL_DIR/msvcp100.dll" ]; then 
     106        echo "File \"msvcp100.dll\" not found." 
     107        exit 127 
     108      elif [ ! -f "$CUSTOM_DLL_DIR/msvcr100.dll" ]; then 
     109        echo "File \"msvcr100.dll\" not found." 
     110        exit 127 
     111     
     112      fi 
     113    fi 
     114  done 
     115fi 
     116 
     117if [ -d "$ABIRDS_WPRFIX" ]; then 
     118  echo "" 
     119  echo "WARNING: Existing Angry Birds installation directory detected." 
     120  echo -n "         Overwrite (y/N) ? " 
     121  read REMOVE_EXISTING_WPRFIX 
     122  if [ "x$REMOVE_EXISTING_WPRFIX" == "xy" -o "x$REMOVE_EXISTING_WPRFIX" == "xY" ]; then 
     123    rm -rf "$ABIRDS_WPRFIX"  
     124  else 
     125   echo "Aborting." 
     126   exit 0 
     127  fi 
     128fi 
     129 
     130if [ "$ISSET_CUSTOM_WINE_ARGS" == "1" ]; then 
     131  WINEPREFIX="$ABIRDS_WPRFIX" wineboot $CUSTOM_WINE_ARGS -u 
     132else 
     133  WINEPREFIX="$ABIRDS_WPRFIX" wineboot -u 
     134fi 
    33135 
    34136mkdir -pv "$ABIRDS_WPRFIX/drive_c/Download" 
     
    36138rm "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" 
    37139 
    38 wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" "$ABIRDS_URL" 
     140if [ "$ISSET_CUSTOM_SETUP_URL" == "1" ]; then 
     141  wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" "$CUSTOM_SETUP_URL" 
     142elif [ "$ISSET_CUSTOM_SETUP_FILE" == "1" ]; then 
     143  cp -v "$CUSTOM_SETUP_FILE" "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" 
     144else 
     145  wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" "$ABIRDS_URL" 
     146fi 
    39147 
    40 DLL1_VAR=`curl "$DLL1_URL" 2>/dev/null | perl -ne 'print $1 if /<a href=\"\/appupwrapper\.zip\?(\w{10})\"/'` 
     148if [ "$ISSET_CUSTOM_DLL_DIR" == "1" ]; then 
     149  if [ -f "$CUSTOM_DLL_DIR/appupwrapper.dll" ]; then 
     150    cp -v "$CUSTOM_DLL_DIR/appupwrapper.dll" "$ABIRDS_WPRFIX/drive_c/Download/" 
     151  else 
     152    cp -v "$CUSTOM_DLL_DIR/AppUpWrapper.dll" "$ABIRDS_WPRFIX/drive_c/Download/" 
     153  fi 
     154  cp -v "$CUSTOM_DLL_DIR/msvcp100.dll" "$ABIRDS_WPRFIX/drive_c/Download/" 
     155  cp -v "$CUSTOM_DLL_DIR/msvcr100.dll" "$ABIRDS_WPRFIX/drive_c/Download/" 
     156else 
     157  DLL1_VAR=`curl "$DLL1_URL" 2>/dev/null | perl -ne 'print $1 if /<a href=\"\/appupwrapper\.zip\?(\w{10})\"/'` 
    41158 
    42 DLL2_VAR=`curl "$DLL2_URL" 2>/dev/null | perl -ne 'print $1 if /<a href=\"\/msvcp90\.zip\?(\w{10})\"/'` 
     159  DLL2_VAR=`curl "$DLL2_URL" 2>/dev/null | perl -ne 'print $1 if /<a href=\"\/msvcp100\.zip\?(\w{10})\"/'` 
    43160 
    44 DLL3_VAR=`curl "$DLL3_URL" 2>/dev/null | perl -ne 'print $1 if /<a href=\"\/msvcr100\.zip\?(\w{10})\"/'` 
     161  DLL3_VAR=`curl "$DLL3_URL" 2>/dev/null | perl -ne 'print $1 if /<a href=\"\/msvcr100\.zip\?(\w{10})\"/'` 
    45162 
    46 wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/appupwrapper.zip" "$DLL_URL/appupwrapper.zip?${DLL1_VAR:0:10}" 
     163  wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/appupwrapper.zip" "$DLL_URL/appupwrapper.zip?${DLL1_VAR:0:10}" 
    47164 
    48 wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/msvcp90.zip" "$DLL_URL/msvcp90.zip?${DLL2_VAR:0:10}" 
     165  wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/msvcp100.zip" "$DLL_URL/msvcp100.zip?${DLL2_VAR:0:10}" 
    49166 
    50 wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/msvcr100.zip" "$DLL_URL/msvcr100.zip?${DLL3_VAR:0:10}" 
     167  wget -v -c -t 5 -O "$ABIRDS_WPRFIX/drive_c/Download/msvcr100.zip" "$DLL_URL/msvcr100.zip?${DLL3_VAR:0:10}" 
    51168 
    52 unzip -o "$ABIRDS_WPRFIX/drive_c/Download/appupwrapper.zip" -d "$ABIRDS_WPRFIX/drive_c/Download/" 
     169  unzip -o "$ABIRDS_WPRFIX/drive_c/Download/appupwrapper.zip" -d "$ABIRDS_WPRFIX/drive_c/Download/" 
    53170 
    54 unzip -o "$ABIRDS_WPRFIX/drive_c/Download/msvcp90.zip" -d "$ABIRDS_WPRFIX/drive_c/Download/" 
     171  unzip -o "$ABIRDS_WPRFIX/drive_c/Download/msvcp100.zip" -d "$ABIRDS_WPRFIX/drive_c/Download/" 
    55172 
    56 unzip -o "$ABIRDS_WPRFIX/drive_c/Download/msvcr100.zip" -d "$ABIRDS_WPRFIX/drive_c/Download/" 
     173  unzip -o "$ABIRDS_WPRFIX/drive_c/Download/msvcr100.zip" -d "$ABIRDS_WPRFIX/drive_c/Download/" 
     174fi 
    57175 
    58176cp -v $ABIRDS_WPRFIX/drive_c/Download/*.dll "$ABIRDS_WPRFIX/drive_c/windows/" 
    59177 
    60 WINEPREFIX=$ABIRDS_WPRFIX wine "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" 
     178if [ "$ISSET_CUSTOM_WINE_ARGS" == "1" ]; then 
     179  WINEPREFIX="$ABIRDS_WPRFIX" WINEDLLOVERRIDES="msvcr100.dll,mscvp100.dll,appupwrapper.dll=n,b" wine $CUSTOM_WINE_ARGS "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" 
     180else 
     181  WINEPREFIX="$ABIRDS_WPRFIX" WINEDLLOVERRIDES="msvcr100.dll,mscvp100.dll,appupwrapper.dll=n,b" wine "$ABIRDS_WPRFIX/drive_c/Download/abirds-setup.exe" 
     182fi 
     183 
     184CONFIG_LUA=`find ~/.angrybirds/ -print0 | grep -FzZ '/Angry Birds/config.lua'` 
     185if [ `echo $?` == "0" ]; then 
     186    sed -i "s/fullscreen = true/fullscreen = false/g" "$CONFIG_LUA" 
     187fi 
     188 
     189 
     190exit 0 
Note: See TracChangeset for help on using the changeset viewer.