r15585 - gnucash/trunk/packaging/win32 - Install.sh: Add set_env_or_die, use it for $INTLTOOL_PERL.
Andreas Köhler
andi5 at cvs.gnucash.org
Fri Feb 16 17:57:16 EST 2007
Author: andi5
Date: 2007-02-16 17:57:15 -0500 (Fri, 16 Feb 2007)
New Revision: 15585
Trac: http://svn.gnucash.org/trac/changeset/15585
Modified:
gnucash/trunk/packaging/win32/functions
gnucash/trunk/packaging/win32/install.sh
Log:
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.
Modified: gnucash/trunk/packaging/win32/functions
===================================================================
--- gnucash/trunk/packaging/win32/functions 2007-02-16 17:02:57 UTC (rev 15584)
+++ gnucash/trunk/packaging/win32/functions 2007-02-16 22:57:15 UTC (rev 15585)
@@ -43,7 +43,7 @@
function die() {
echo
- echo "!!! $* !!!"
+ [ "$*" ] && echo "!!! $* !!!"
echo "!!! ABORTING !!!"
exit -1
}
@@ -79,6 +79,22 @@
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: $@"
}
Modified: gnucash/trunk/packaging/win32/install.sh
===================================================================
--- gnucash/trunk/packaging/win32/install.sh 2007-02-16 17:02:57 UTC (rev 15584)
+++ gnucash/trunk/packaging/win32/install.sh 2007-02-16 22:57:15 UTC (rev 15585)
@@ -172,7 +172,7 @@
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."
More information about the gnucash-changes
mailing list