diff options
author | nick <myownlittlworld@hotmail.com> | 2009-05-02 23:38:54 -0500 |
---|---|---|
committer | nick <myownlittlworld@hotmail.com> | 2009-05-02 23:38:54 -0500 |
commit | e2f6690cc2cf57df3788a20f5be2dfbdf5d660b8 (patch) | |
tree | 023c1f657bd8e76080a1aa232c5e3238fecd1a2c /auto-installer.sh | |
parent | d400ae382e09b091fb372ffc9163273ff40ddb1d (diff) | |
parent | 28083ccefa13e4137afb300544072e7e176c7de8 (diff) | |
download | gemrb-gameinstallers-e2f6690cc2cf57df3788a20f5be2dfbdf5d660b8.tar.bz2 gemrb-gameinstallers-e2f6690cc2cf57df3788a20f5be2dfbdf5d660b8.zip |
Merged with latest from upstream.
Diffstat (limited to 'auto-installer.sh')
-rwxr-xr-x | auto-installer.sh | 134 |
1 files changed, 78 insertions, 56 deletions
diff --git a/auto-installer.sh b/auto-installer.sh index f66e510..b6d7bd1 100755 --- a/auto-installer.sh +++ b/auto-installer.sh @@ -1,4 +1,21 @@ -#!/bin/sh +#!/bin/bash +# Copyright 2009 Nick White +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See <http://www.gnu.org/licenses/> for a copy of the GNU General +# Public License. +# +# Runs the appropriate installer(s) for an Infinity Engine game, +# based on the CD inserted FULLGAMENAME='' MINSCRIPT='' @@ -17,68 +34,72 @@ parseargs "$@" echo "Checking CD version" CDMD5=$(md5sum $CDMOUNT/data1.cab|awk '{print $1}') -case "$CDMD5" in - $BG1_5CD_INTL_MD5 ) - FULLGAMENAME="Baldurs Gate 1: 5CD International version" - SHORTGAMENAME="bg1" - MINSCRIPT=bg1/install-5cd-minimal.sh - EXTRASCRIPT=bg1/install-5cd-extra.sh - PATCHES="bg1/install-patch-intl.sh bg1/install-patch-baldurdash-fix.sh bg1/install-patch-baldurdash-text.sh" - WINDOWSFILES="baldur.exe bgmain.exe config.exe keymap.ini luaauto.cfg update.url" - CDNO=5 - ;; - $BG1_TOTSC_3CD_US_MD5 ) - FULLGAMENAME="Baldurs Gate Tales of the Sword Coast: 3CD US version" - SHORTGAMENAME="bg1" - MINSCRIPT=bg1/install-3cd-minimal.sh - EXTRASCRIPT=bg1/install-3cd-extra.sh - PATCHES="bg1/install-patch-baldurdash-fix.sh bg1/install-patch-baldurdash-text.sh" - WINDOWSFILES="baldur.exe bgmain.exe config.exe keymap.ini luaauto.cfg update.url" - CDNO=3 - ;; - $BG1_TOTSC_1CD_UK_MD5 ) - FULLGAMENAME="Baldurs Gate Tales of the Sword Coast: 1CD UK version" - SHORTGAMENAME="totsc" - MINSCRIPT=totsc/install-1cd-uk.sh - PATCHES="totsc/install-patch-uk.sh totsc/install-patch-baldurdash-fix.sh totsc/install-patch-baldurdash-text.sh" - WINDOWSFILES="bgmain2.exe baldur.exe config.exe mconvert.exe" - ;; - $PST_2CD_MD5 ) - FULLGAMENAME="Planescape Torment: 2CD version" - SHORTGAMENAME="pst" - MINSCRIPT=pst/install-2cd-minimal.sh - EXTRASCRIPT=pst/install-2cd-extra.sh - PATCHES="pst/install-patch-fixpack.sh pst/install-patch-ub.sh pst/install-patch-tweaks.sh" - WINDOWSFILES="torment.exe ereg" - CDNO=2 - ;; - $PST_4CD_MD5 ) - FULLGAMENAME="Planescape Torment: 4CD version" - SHORTGAMENAME="pst" - MINSCRIPT=pst/install-4cd-minimal.sh - EXTRASCRIPT=pst/install-4cd-extra.sh - PATCHES="pst/install-patch-official.sh pst/install-patch-fixpack.sh pst/install-patch-ub.sh pst/install-patch-tweaks.sh" - WINDOWSFILES="torment.exe ereg" - CDNO=4 - ;; - * ) - echo "Unrecognised CD - please select game from menu" - # TODO: Add menu to show and select all known BG1 versions - exit 1 - ;; -esac +while [ -z "$MINSCRIPT" ]; do + case "$CDMD5" in + $BG1_5CD_INTL_MD5 ) + FULLGAMENAME="Baldurs Gate 1: 5CD International version" + SHORTGAMENAME="baldursgate1" + MINSCRIPT=bg1/install-5cd-minimal.sh + EXTRASCRIPT=bg1/install-5cd-extra.sh + PATCHES="bg1/install-patch-intl.sh bg1/install-patch-baldurdash-fix.sh bg1/install-patch-baldurdash-text.sh" + WINDOWSFILES="baldur.exe bgmain.exe config.exe keymap.ini luaauto.cfg update.url" + CDNO=5 + ;; + $BG1_TOTSC_3CD_US_MD5 ) + FULLGAMENAME="Baldurs Gate & Tales of the Sword Coast: 3CD US version" + SHORTGAMENAME="baldursgate1totsc" + MINSCRIPT=bg1/install-3cd-minimal.sh + EXTRASCRIPT=bg1/install-3cd-extra.sh + PATCHES="bg1/install-patch-baldurdash-fix.sh bg1/install-patch-baldurdash-text.sh" + WINDOWSFILES="baldur.exe bgmain.exe config.exe keymap.ini luaauto.cfg update.url" + CDNO=3 + ;; + $BG1_TOTSC_1CD_UK_MD5 ) + FULLGAMENAME="Baldurs Gate Tales of the Sword Coast: 1CD UK version" + SHORTGAMENAME="baldursgate1totsc" + MINSCRIPT=totsc/install-1cd-uk.sh + PATCHES="totsc/install-patch-uk.sh totsc/install-patch-baldurdash-fix.sh totsc/install-patch-baldurdash-text.sh" + WINDOWSFILES="bgmain2.exe baldur.exe config.exe mconvert.exe" + ;; + $PST_2CD_MD5 ) + FULLGAMENAME="Planescape Torment: 2CD version" + SHORTGAMENAME="planescapetorment" + MINSCRIPT=pst/install-2cd-minimal.sh + EXTRASCRIPT=pst/install-2cd-extra.sh + PATCHES="pst/install-patch-fixpack.sh pst/install-patch-ub.sh pst/install-patch-tweaks.sh" + WINDOWSFILES="torment.exe ereg" + CDNO=2 + ;; + $PST_4CD_MD5 ) + FULLGAMENAME="Planescape Torment: 4CD version" + SHORTGAMENAME="planescapetorment" + MINSCRIPT=pst/install-4cd-minimal.sh + EXTRASCRIPT=pst/install-4cd-extra.sh + PATCHES="pst/install-patch-official.sh pst/install-patch-fixpack.sh pst/install-patch-ub.sh pst/install-patch-tweaks.sh" + WINDOWSFILES="torment.exe ereg" + CDNO=4 + ;; + * ) + echo "Unrecognised CD - please select game from menu" + choosegame + ;; + esac +done [ -z "$TARGETDIR" ] && [ -n "$SHORTGAMENAME" ] && export TARGETDIR="$PWD/$SHORTGAMENAME" [ -z "$TARGETDIR" ] && diequietly +# if targetdir already exists, make sure we never clobber it +[ -d "$TARGETDIR" ] && export alwaysdiesafely=1 + echo "$FULLGAMENAME detected, installing" -$MINSCRIPT -i "$TARGETDIR" -c "$CDMOUNT" 1>/dev/null || diequietly +"$scriptdir/$MINSCRIPT" -i "$TARGETDIR" -c "$CDMOUNT" 1>/dev/null || diequietly if [ -n "$EXTRASCRIPT" ]; then if query "Do you want to do a full install, so the CDs will not be needed again?" y; then FULLINSTALL=1 - $EXTRASCRIPT -i "$TARGETDIR" -c "$CDMOUNT" 1>/dev/null || diequietly + "$scriptdir/$EXTRASCRIPT" -i "$TARGETDIR" -c "$CDMOUNT" 1>/dev/null || diequietly else FULLINSTALL=0 fi @@ -86,15 +107,16 @@ fi if [ -n "$PATCHES" ]; then for patch in $PATCHES; do - # grab 2nd line from scripts - patchtitle=$(sed -n 2p $patch|cut -d ' ' -f 2-) + patch="$scriptdir/$patch" + # grab 17th line from scripts (description line; after license) + patchtitle=$(sed -n 17p $patch|cut -d ' ' -f 2-) if query "Do you want to install $patchtitle" y; then $patch \ -i "$TARGETDIR" \ -p "$PATCHDIR" \ -l "$LANGUAGE" \ -c "$CDMOUNT" \ - 1>/dev/null || diequietly + 1>/dev/null fi done fi |