diff options
Diffstat (limited to 'includes/generic-includes.sh')
| -rw-r--r-- | includes/generic-includes.sh | 40 | 
1 files changed, 35 insertions, 5 deletions
| diff --git a/includes/generic-includes.sh b/includes/generic-includes.sh index 07de078..51cffcb 100644 --- a/includes/generic-includes.sh +++ b/includes/generic-includes.sh @@ -1,3 +1,18 @@ +# 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. +  ### default variables ###  [ -z "$TMPDIR" ] && export TMPDIR="/tmp/iepatch" @@ -10,17 +25,30 @@  function die  { -	#echo "Install can not continue, cleaning up partial install" -	#rm -rf "$TARGETDIR" +	echo "Install can not continue" + +	if [ "$alwaysdiesafely" != "1" ]; then +		echo "Cleaning up partial install" +		rm -rf "$TARGETDIR" +	fi  	echo ""  	echo "The install failed; sorry." -	echo "Please make sure you have the correct CDs for $FULLGAMENAME" +	echo "Please make sure you have the correct CDs for the game"  	echo "and enough free disk space, and try again."  	exit 1  } +function diesoftly +{ +	# a non-destructive die + +	echo " ! The install failed; sorry." 1>&2 + +	exit 1 +} +  function diequietly  {  	exit 1 @@ -59,7 +87,7 @@ function checkforbin  function setperms  { -	# usage setperms targetdir +	# usage: setperms targetdir  	if ! [ -d "$1" ]; then  		return 1 @@ -94,6 +122,8 @@ function usage  function parseargs  { +	# usage: parseargs args... +  	while getopts ":i:p:c:l:" options; do  		case $options in  			i ) export TARGETDIR="$OPTARG";; @@ -110,7 +140,7 @@ function parseargs  function copylower  { -	#usage: copylower source destination +	# usage: copylower source destination  	if [ -d "$1" ]; then  		for filename in $(find "$1" -type f); do  			lowerpath="$(echo $filename|gawk -F "$1" '{print $2}'|tr A-Z a-z)" | 
