lib/scripts/getsettings
author wenzelm
Fri Sep 01 17:54:58 2000 +0200 (2000-09-01)
changeset 9789 7e5e6c47c0b5
parent 9680 6581bfc8421e
child 11553 87b585079d01
permissions -rw-r--r--
GPLed;
more robust handling of spaces in args / file names;
wenzelm@2307
     1
#
wenzelm@2307
     2
# $Id$
wenzelm@9789
     3
# Author: Markus Wenzel, TU Muenchen
wenzelm@9789
     4
# License: GPL (GNU GENERAL PUBLIC LICENSE)
wenzelm@2299
     5
#
wenzelm@2348
     6
# getsettings - bash source script to augment current env.
wenzelm@2299
     7
#
wenzelm@2299
     8
wenzelm@7770
     9
if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
wenzelm@7770
    10
then
wenzelm@7770
    11
wenzelm@3185
    12
set -o allexport
wenzelm@3185
    13
wenzelm@7770
    14
ISABELLE_SETTINGS_PRESENT=true
wenzelm@7770
    15
wenzelm@2736
    16
#normalize ISABELLE_HOME as passed by caller
wenzelm@9789
    17
ISABELLE_HOME=$(cd "$ISABELLE_HOME"; echo "$PWD")
wenzelm@2736
    18
wenzelm@3185
    19
#main executables
wenzelm@9789
    20
ISABELLE="$ISABELLE_HOME/bin/isabelle"
wenzelm@9789
    21
ISATOOL="$ISABELLE_HOME/bin/isatool"
wenzelm@2299
    22
wenzelm@2643
    23
#users tend to put strange things in here ...
wenzelm@2621
    24
unset ENV
wenzelm@2621
    25
unset BASH_ENV
wenzelm@2621
    26
wenzelm@9680
    27
#support easy settings
wenzelm@9680
    28
function choosefrom ()
wenzelm@9680
    29
{
wenzelm@9680
    30
  local RESULT=""
wenzelm@9680
    31
  local FILE=""
wenzelm@9680
    32
wenzelm@9680
    33
  for FILE in "$@"
wenzelm@9680
    34
  do
wenzelm@9680
    35
    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
wenzelm@9680
    36
  done
wenzelm@9680
    37
wenzelm@9680
    38
  [ -z "$RESULT" ] && RESULT="$FILE"
wenzelm@9680
    39
  echo "$RESULT"
wenzelm@9680
    40
}
wenzelm@9680
    41
wenzelm@2643
    42
#get actual settings
wenzelm@9789
    43
. "$ISABELLE_HOME/etc/settings" || exit 2
wenzelm@9227
    44
ISABELLE_SITE_SETTINGS_PRESENT=true
wenzelm@9789
    45
wenzelm@9789
    46
[ "$ISABELLE_HOME" -ef "$ISABELLE_HOME_USER" ] && \
wenzelm@9789
    47
  { echo >&2 "### ISABELLE_HOME and ISABELLE_HOME_USER should not be the same directory!"; }
wenzelm@9789
    48
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && . "$ISABELLE_HOME_USER/etc/settings"
wenzelm@2299
    49
wenzelm@6413
    50
#append ML system identifier to paths
wenzelm@6413
    51
if [ -z "$ML_PLATFORM" ]; then
wenzelm@6413
    52
  ML_IDENTIFIER="$ML_SYSTEM"
wenzelm@6413
    53
else
wenzelm@6413
    54
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
wenzelm@6413
    55
fi
wenzelm@6413
    56
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"
wenzelm@3118
    57
wenzelm@2299
    58
set +o allexport
wenzelm@7770
    59
wenzelm@7770
    60
fi