Install.sh: Add set_env_or_die, use it for $INTLTOOL_PERL.

This function is similar to add_to_env, but makes the script fail if it
would effectively overwrite a non-empty variable.  This is not the case
if the new value was already a part of the variables contents, no matter
whether from the beginning or after an add_to_env call.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15585 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Andreas Köhler
2007-02-16 22:57:15 +00:00
parent effc8e040b
commit 5d8c124c3c
2 changed files with 18 additions and 2 deletions
+17 -1
View File
@@ -43,7 +43,7 @@ function setup() {
function die() {
echo
echo "!!! $* !!!"
[ "$*" ] && echo "!!! $* !!!"
echo "!!! ABORTING !!!"
exit -1
}
@@ -79,6 +79,22 @@ function add_to_env() {
fi
}
# usage: set_env_or_die VALUE NAME
function set_env_or_die() {
_OLDADDS=`eval echo '"$'"$2_ADDS"'"'`
add_to_env "$1" "$2"
_NEWADDS=`eval echo '"$'"$2_ADDS"'"'`
if [ "$_OLDADDS" != "$_NEWADDS" ]; then
_BASE=`eval echo '"$'"$2_BASE"'"'`
if [ "$_BASE" ]; then
_ENV=`eval echo '"$'"$2"'"'`
echo "Must not overwrite environment variable '$2' (${_OLDADDS}${_BASE}) by '$1'."
echo "Try to remove the offending installed software or unset the variable."
die
fi
fi
}
function assert_one_dir() {
quiet [ -d "$@" ] || die "Detected multiple directories where only one was expected; please delete all but the latest one: $@"
}
+1 -1
View File
@@ -172,7 +172,7 @@ function inst_readline() {
function inst_active_perl() {
setup ActivePerl \(intltool\)
_ACTIVE_PERL_WFSDIR=`win_fs_path $ACTIVE_PERL_DIR`
add_to_env $_ACTIVE_PERL_WFSDIR/ActivePerl/Perl/bin/perl INTLTOOL_PERL
set_env_or_die $_ACTIVE_PERL_WFSDIR/ActivePerl/Perl/bin/perl INTLTOOL_PERL
if quiet $INTLTOOL_PERL --help
then
echo "ActivePerl already installed. skipping."