mirror of
https://github.com/Gnucash/gnucash.git
synced 2026-08-08 20:18:28 -05:00
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:
@@ -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: $@"
|
||||
}
|
||||
|
||||
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user