From 0d14bb784aa524de00c88e9a25bb812c5339cc43 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 25 May 2009 18:26:27 -0500 Subject: Safely escaped all potentially unsafe variables. And probably a couple already safe ones too. --- bg1/install-1cd-totsc-uk.sh | 25 ++++++++++------------ bg1/install-3cd-extra.sh | 20 +++++++++--------- bg1/install-3cd-minimal.sh | 33 +++++++++++++----------------- bg1/install-5cd-extra.sh | 10 ++++----- bg1/install-5cd-minimal.sh | 27 +++++++++--------------- bg1/install-patch-baldurdash-fix.sh | 10 ++++----- bg1/install-patch-baldurdash-text.sh | 8 ++++---- bg1/install-patch-intl.sh | 10 ++++----- bg1/install-patch-totsc-balderdash-text.sh | 8 ++++---- bg1/install-patch-totsc-intl.sh | 10 ++++----- bg1/install-patch-totsc-uk.sh | 10 ++++----- bg1/install-patch-totsc-us.sh | 10 ++++----- bg1/install-patch-us.sh | 10 ++++----- 13 files changed, 88 insertions(+), 103 deletions(-) (limited to 'bg1') diff --git a/bg1/install-1cd-totsc-uk.sh b/bg1/install-1cd-totsc-uk.sh index 9f2f582..3584c07 100755 --- a/bg1/install-1cd-totsc-uk.sh +++ b/bg1/install-1cd-totsc-uk.sh @@ -17,8 +17,8 @@ # Tales of the Sword Coast (1CD UK version) scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/cd-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/cd-includes.sh" parseargs "$@" @@ -28,24 +28,21 @@ getcd 1 $BG1_TOTSC_1CD_UK_MD5 data1.cab mkdir -p "$TARGETDIR" || die -unshield -L x $CDMOUNT/data1.cab -d "$TARGETDIR" || die +unshield -L x "${CDMOUNT}/data1.cab" -d "$TARGETDIR" || die -cp $CDMOUNT/dialog.tlk "$TARGETDIR" || die +cp "${CDMOUNT}/dialog.tlk" "$TARGETDIR" || die -mkdir -p "$TARGETDIR"/save || die +mkdir -p "${TARGETDIR/save}" || die -cp -R "$TARGETDIR"/minimumdata/* "$TARGETDIR" || die -rm -r "$TARGETDIR"/minimumdata +move_and_remove "${TARGETDIR}/minimumdata" "$TARGETDIR" +move_and_remove "${TARGETDIR}/english" "$TARGETDIR" -cp -R "$TARGETDIR"/english/* "$TARGETDIR" || die -rm -r "$TARGETDIR"/english +cp -R "${CDMOUNT}/override/"* "${TARGETDIR}/override/" || die -cp -R "$CDMOUNT"/override/* "$TARGETDIR"/override/ || die - -mkdir -p "$TARGETDIR"/movies +mkdir -p "${TARGETDIR}/movies" copylower "$CDMOUNT/cd6/" "$TARGETDIR" -mkdir -p "$TARGETDIR"/mpsave -cp -R $CDMOUNT/[Ss]ave/* "$TARGETDIR"/mpsave || die +mkdir -p "${TARGETDIR}/mpsave" +cp -R "${CDMOUNT}/"[Ss]ave/* "${TARGETDIR}/mpsave" || die setperms "$TARGETDIR" diff --git a/bg1/install-3cd-extra.sh b/bg1/install-3cd-extra.sh index fe31c32..7af0cbb 100755 --- a/bg1/install-3cd-extra.sh +++ b/bg1/install-3cd-extra.sh @@ -17,23 +17,23 @@ # Extra Baldur's Gate (3CD version) content (so CDs aren't needed) scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/cd-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/cd-includes.sh" parseargs "$@" -copylower "$CDMOUNT/cd1/" "$TARGETDIR" +copylower "${CDMOUNT}/cd1/" "$TARGETDIR" CD2_MD5="c04758a6af171bf9a35d8e3d4dcd807c" CD3_MD5="ba4224f50f890e10561d22f602d6a991" getcd 2 $CD2_MD5 CD2/Movies/MovieCD2.bif -copylower "$CDMOUNT/cd2/" "$TARGETDIR" -copylower "$CDMOUNT/cd5/" "$TARGETDIR" -cp $CDMOUNT/Manual/Baldur.pdf "$TARGETDIR"/manual || die +copylower "${CDMOUNT}/cd2/" "$TARGETDIR" +copylower "${CDMOUNT}/cd5/" "$TARGETDIR" +cp "${CDMOUNT}/Manual/Baldur.pdf" "${TARGETDIR}/manual" || die -getcd 3 $CD3_MD5 CD3/Movies/MovieCD3.bif -copylower "$CDMOUNT/cd3/" "$TARGETDIR" -copylower "$CDMOUNT/cd4/" "$TARGETDIR" -copylower "$CDMOUNT/cd6/" "$TARGETDIR" +getcd 3 "$CD3_MD5" "CD3/Movies/MovieCD3.bif" +copylower "${CDMOUNT}/cd3/" "$TARGETDIR" +copylower "${CDMOUNT}/cd4/" "$TARGETDIR" +copylower "${CDMOUNT}/cd6/" "$TARGETDIR" setperms "$TARGETDIR" diff --git a/bg1/install-3cd-minimal.sh b/bg1/install-3cd-minimal.sh index 57d9173..f6446cf 100755 --- a/bg1/install-3cd-minimal.sh +++ b/bg1/install-3cd-minimal.sh @@ -17,8 +17,8 @@ # Baldur's Gate & Tales of the Sword Coast (3CD version) minimal scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/cd-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/cd-includes.sh" parseargs "$@" @@ -28,28 +28,23 @@ getcd 1 $BG1_TOTSC_3CD_US_MD5 data1.cab mkdir -p "$TARGETDIR" || die -cp $CDMOUNT/dialog.tlk "$TARGETDIR" || die +cp "${CDMOUNT}/dialog.tlk" "$TARGETDIR" || die -unshield -L x $CDMOUNT/data1.cab -d "$TARGETDIR" || die +unshield -L x "${CDMOUNT}/data1.cab" -d "$TARGETDIR" || die -cp -R "$TARGETDIR"/minimumdata/* "$TARGETDIR" || die -rm -r "$TARGETDIR"/minimumdata +move_and_remove "${TARGETDIR}/minimumdata" "${TARGETDIR}" +move_and_remove "${TARGETDIR}/english_sounds/sounds" "${TARGETDIR}/sounds" +move_and_remove "${TARGETDIR}/english" "${TARGETDIR}" -cp -R "$TARGETDIR"/english_sounds/sounds/* "$TARGETDIR"/sounds/ || die -rm -r "$TARGETDIR"/english_sounds +mkdir -p "${TARGETDIR}/movies" +mkdir -p "${TARGETDIR}/manual" -cp -R "$TARGETDIR"/english/* "$TARGETDIR" || die -rm -r "$TARGETDIR"/english +mkdir -p "${TARGETDIR}/save" +cp -R "${CDMOUNT}/"[Ss]ave/* "${TARGETDIR}/save" || die -mkdir -p "$TARGETDIR"/movies -mkdir -p "$TARGETDIR"/manual +cp "${CDMOUNT}/Manual/BGManual.pdf" "${TARGETDIR}/manual/" || die +cp "${CDMOUNT}/Manual/TotscManual.pdf" "${TARGETDIR}/manual/" || die -mkdir -p "$TARGETDIR"/save -cp -R $CDMOUNT/[Ss]ave/* "$TARGETDIR"/save || die - -cp $CDMOUNT/Manual/BGManual.pdf "$TARGETDIR"/manual/ || die -cp $CDMOUNT/Manual/TotscManual.pdf "$TARGETDIR"/manual/ || die - -cp $CDMOUNT/baldur.ico "$TARGETDIR" || die +cp "${CDMOUNT}/baldur.ico" "$TARGETDIR" || die setperms "$TARGETDIR" diff --git a/bg1/install-5cd-extra.sh b/bg1/install-5cd-extra.sh index 9e6847d..df5dbef 100755 --- a/bg1/install-5cd-extra.sh +++ b/bg1/install-5cd-extra.sh @@ -17,8 +17,8 @@ # Extra Baldur's Gate (5CD International version) content (so CDs aren't needed) scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/cd-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/cd-includes.sh" parseargs "$@" @@ -31,10 +31,10 @@ for CDNUMBER in 1 2 3 4 5; do 5 ) moviesum="f19415703d3ccad01325b9338380ac7c" ;; esac - if [ $CDNUMBER -gt 1 ]; then - getcd $CDNUMBER $moviesum CD$CDNUMBER/Movies/MovieCD$CDNUMBER.bif + if [ "$CDNUMBER" -gt 1 ]; then + getcd "$CDNUMBER" "$moviesum" "CD${CDNUMBER}/Movies/MovieCD${CDNUMBER}.bif" fi - copylower "$CDMOUNT/cd$CDNUMBER/" "$TARGETDIR" + copylower "${CDMOUNT}/cd${CDNUMBER}/" "$TARGETDIR" setperms "$TARGETDIR" done diff --git a/bg1/install-5cd-minimal.sh b/bg1/install-5cd-minimal.sh index 2e6ff59..cd5cfa7 100755 --- a/bg1/install-5cd-minimal.sh +++ b/bg1/install-5cd-minimal.sh @@ -17,8 +17,8 @@ # Baldur's Gate (5CD International version) minimal scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/cd-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/cd-includes.sh" parseargs "$@" @@ -28,24 +28,17 @@ getcd 1 $BG1_5CD_INTL_MD5 data1.cab mkdir -p "$TARGETDIR" || die -cp $CDMOUNT/dialog.tlk "$TARGETDIR" || die +cp "${CDMOUNT}/dialog.tlk" "$TARGETDIR" || die -unshield -L x $CDMOUNT/data1.cab -d "$TARGETDIR" || die +unshield -L x "${CDMOUNT}/data1.cab" -d "$TARGETDIR" || die -cp -R "$TARGETDIR"/minimumdata/* "$TARGETDIR" || die -rm -r "$TARGETDIR"/minimumdata +move_and_remove "${TARGETDIR}/minimumdata" "$TARGETDIR" +move_and_remove "${TARGETDIR}/recommended_music/music" "${TARGETDIR}/music/" +move_and_remove "${TARGETDIR}/english_sounds/sounds" "${TARGETDIR}/sounds/" +move_and_remove "${TARGETDIR}/english" "$TARGETDIR" -cp -R "$TARGETDIR"/recommended_music/music/* "$TARGETDIR"/music/ || die -rm -r "$TARGETDIR"/recommended_music +mkdir -p "${TARGETDIR}/movies" -cp -R "$TARGETDIR"/english_sounds/sounds/* "$TARGETDIR"/sounds/ || die -rm -r "$TARGETDIR"/english_sounds - -cp -R "$TARGETDIR"/english/* "$TARGETDIR" || die -rm -r "$TARGETDIR"/english - -mkdir -p "$TARGETDIR"/movies - -cp $CDMOUNT/baldur.ico "$TARGETDIR" || die +cp "${CDMOUNT}/baldur.ico" "$TARGETDIR" || die setperms "$TARGETDIR" diff --git a/bg1/install-patch-baldurdash-fix.sh b/bg1/install-patch-baldurdash-fix.sh index be9b3be..a4c2122 100755 --- a/bg1/install-patch-baldurdash-fix.sh +++ b/bg1/install-patch-baldurdash-fix.sh @@ -17,8 +17,8 @@ # BG1/TOTSC Baldurdash fix pack scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -30,9 +30,9 @@ getpatch http://www.baldurdash.org/LargeDownloads/BG1FixPack11.exe # unzip complains unnecessarily about skipping non-zip # part so don't print errors or die on failure -unzip -L $TMPDIR/BG1FixPack11.exe -d $TMPDIR 2>/dev/null -rm $TMPDIR/BG1FixPack11.exe $TMPDIR/bg1fixpack11readme.txt -cp $TMPDIR/* "$TARGETDIR/override/" || diesoftly +unzip -L "${TMPDIR}/BG1FixPack11.exe" -d "$TMPDIR" 2>/dev/null +rm "${TMPDIR}/BG1FixPack11.exe" "${TMPDIR}/bg1fixpack11readme.txt" +cp "${TMPDIR}/"* "${TARGETDIR}/override/" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-baldurdash-text.sh b/bg1/install-patch-baldurdash-text.sh index 9dbf9a9..7eeee3b 100755 --- a/bg1/install-patch-baldurdash-text.sh +++ b/bg1/install-patch-baldurdash-text.sh @@ -17,8 +17,8 @@ # BG1 Baldurdash text pack scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -35,8 +35,8 @@ getpatch http://www.baldurdash.org/LargeDownloads/BG1NoTOSCGameTextUpdate10.exe # unzip complains unnecessarily about skipping non-zip # part so don't print errors or die on failure -unzip -L $TMPDIR/BG1NoTOSCGameTextUpdate10.exe -d $TMPDIR 2>/dev/null -cp $TMPDIR/dialog.tlk "$TARGETDIR/" || diesoftly +unzip -L "${TMPDIR}/BG1NoTOSCGameTextUpdate10.exe" -d "$TMPDIR" 2>/dev/null +cp "${TMPDIR}/dialog.tlk" "${TARGETDIR}/" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-intl.sh b/bg1/install-patch-intl.sh index 2acb59e..0e12853 100755 --- a/bg1/install-patch-intl.sh +++ b/bg1/install-patch-intl.sh @@ -17,8 +17,8 @@ # BG1 official international patch scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -28,11 +28,11 @@ setuptmp getpatch http://downloads.bioware.com/baldursgate1/bgintl114315.exe -unzip $TMPDIR/bgintl114315.exe -d $TMPDIR || diesoftly -unshield -g "$LANGUAGE" -L x $TMPDIR/data1.cab -d $TMPDIR || diesoftly +unzip "${TMPDIR}/bgintl114315.exe" -d "${TMPDIR}" || diesoftly +unshield -g "$LANGUAGE" -L x "${TMPDIR}/data1.cab" -d "$TMPDIR" || diesoftly LANGUAGE="$(echo $LANGUAGE|tr A-Z a-z|tr ' ' _)" # alter formatting -cp -R $TMPDIR/"$LANGUAGE"/* "$TARGETDIR" || diesoftly +cp -R "${TMPDIR}/${LANGUAGE}/"* "$TARGETDIR" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-totsc-balderdash-text.sh b/bg1/install-patch-totsc-balderdash-text.sh index 36e4304..0d16147 100755 --- a/bg1/install-patch-totsc-balderdash-text.sh +++ b/bg1/install-patch-totsc-balderdash-text.sh @@ -17,8 +17,8 @@ # BG1 TOTSC Baldurdash text pack scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -35,8 +35,8 @@ getpatch http://www.baldurdash.org/LargeDownloads/BG1TOSCGameTextUpdate11.exe # unzip complains unnecessarily about skipping non-zip # part so don't print errors or die on failure -unzip -L $TMPDIR/BG1TOSCGameTextUpdate11.exe -d $TMPDIR 2>/dev/null -cp $TMPDIR/dialog.tlk "$TARGETDIR/" || diesoftly +unzip -L "${TMPDIR}/BG1TOSCGameTextUpdate11.exe" -d "$TMPDIR" 2>/dev/null +cp "${TMPDIR}/dialog.tlk" "${TARGETDIR}/" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-totsc-intl.sh b/bg1/install-patch-totsc-intl.sh index 19c2b15..b50c0ac 100755 --- a/bg1/install-patch-totsc-intl.sh +++ b/bg1/install-patch-totsc-intl.sh @@ -17,8 +17,8 @@ # BG1 TOTSC official International patch scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -28,10 +28,10 @@ setuptmp getpatch http://downloads.bioware.com/baldursgate1/BGTalesIntl5512.exe -cabextract -L $TMPDIR/BGTalesIntl5512.exe -d $TMPDIR || diesoftly -unshield -L x $TMPDIR/data1.cab -d $TMPDIR || diesoftly +cabextract -L "${TMPDIR}/BGTalesIntl5512.exe" -d "$TMPDIR" || diesoftly +unshield -L x "${TMPDIR}/data1.cab" -d "$TMPDIR" || diesoftly -cp -R $TMPDIR/minimumdata/* "$TARGETDIR" || diesoftly +cp -R "${TMPDIR}/minimumdata/"* "$TARGETDIR" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-totsc-uk.sh b/bg1/install-patch-totsc-uk.sh index 09ea70c..87c93d7 100755 --- a/bg1/install-patch-totsc-uk.sh +++ b/bg1/install-patch-totsc-uk.sh @@ -17,8 +17,8 @@ # BG1 TOTSC official UK patch scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -28,10 +28,10 @@ setuptmp getpatch http://downloads.bioware.com/baldursgate1/BGTalesUK5512.exe -cabextract -L $TMPDIR/BGTalesUK5512.exe -d $TMPDIR || diesoftly -unshield -L x $TMPDIR/data1.cab -d $TMPDIR || diesoftly +cabextract -L "${TMPDIR}/BGTalesUK5512.exe" -d "$TMPDIR" || diesoftly +unshield -L x "${TMPDIR}/data1.cab" -d "$TMPDIR" || diesoftly -cp -R $TMPDIR/minimumdata/* "$TARGETDIR" || diesoftly +cp -R "${TMPDIR}/minimumdata/"* "$TARGETDIR" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-totsc-us.sh b/bg1/install-patch-totsc-us.sh index 5939ac4..90b4d9e 100755 --- a/bg1/install-patch-totsc-us.sh +++ b/bg1/install-patch-totsc-us.sh @@ -17,8 +17,8 @@ # BG1 TOTSC official US/Canada patch scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -28,10 +28,10 @@ setuptmp getpatch http://downloads.bioware.com/baldursgate1/BGTalesUS5512.exe -cabextract -L $TMPDIR/BGTalesUS5512.exe -d $TMPDIR || diesoftly -unshield -L x $TMPDIR/data1.cab -d $TMPDIR || diesoftly +cabextract -L "${TMPDIR}/BGTalesUS5512.exe" -d "$TMPDIR" || diesoftly +unshield -L x "${TMPDIR}/data1.cab" -d "$TMPDIR" || diesoftly -cp -R $TMPDIR/minimumdata/* "$TARGETDIR" || diesoftly +cp -R "${TMPDIR}/minimumdata/"* "$TARGETDIR" || diesoftly cleanuptmp setperms "$TARGETDIR" diff --git a/bg1/install-patch-us.sh b/bg1/install-patch-us.sh index c3fe4b0..30387c2 100755 --- a/bg1/install-patch-us.sh +++ b/bg1/install-patch-us.sh @@ -17,8 +17,8 @@ # BG1 official US/Canada patch scriptdir="$(dirname $0)"/.. -source "$scriptdir/includes/generic-includes.sh" -source "$scriptdir/includes/patch-includes.sh" +source "${scriptdir}/includes/generic-includes.sh" +source "${scriptdir}/includes/patch-includes.sh" parseargs "$@" @@ -28,10 +28,10 @@ setuptmp getpatch http://downloads.bioware.com/baldursgate1/bg114315.exe -cabextract -L $TMPDIR/bg114315.exe -d $TMPDIR || diesoftly -unshield -L x $TMPDIR/data1.cab -d $TMPDIR || diesoftly +cabextract -L "${TMPDIR}/bg114315.exe" -d "$TMPDIR" || diesoftly +unshield -L x "${TMPDIR}/data1.cab" -d "$TMPDIR" || diesoftly -cp -R $TMPDIR/english/* "$TARGETDIR" || diesoftly +cp -R "${TMPDIR}/english/"* "$TARGETDIR" || diesoftly cleanuptmp setperms "$TARGETDIR" -- cgit v1.2.3