lib/scripts/getsettings
author kleing
Sun, 18 May 2003 15:28:41 +0200
changeset 14035 c46ce87960fb
parent 12598 fa556d3fe5f2
child 14981 e73f8140af78
permissions -rw-r--r--
attach log files

# -*- shell-script -*-
# $Id$
# Author: Markus Wenzel, TU Muenchen
# License: GPL (GNU GENERAL PUBLIC LICENSE)
#
# getsettings - bash source script to augment current env.
#

if [ -z "$ISABELLE_SETTINGS_PRESENT" ]
then

set -o allexport

ISABELLE_SETTINGS_PRESENT=true

#normalize ISABELLE_HOME as passed by caller
ISABELLE_HOME=$(cd "$ISABELLE_HOME"; echo "$PWD")
if { echo -n "$ISABELLE_HOME" | fgrep " " >/dev/null; }
then
  echo 1>&2 "### White space in ISABELLE_HOME may cause strange problems later on!"
  echo 1>&2 "### ISABELLE_HOME=\"$ISABELLE_HOME\""
fi

#key executables
ISABELLE="$ISABELLE_HOME/bin/isabelle-process"
ISATOOL="$ISABELLE_HOME/bin/isatool"

#users tend to put strange things in here ...
unset ENV
unset BASH_ENV

#support easy settings
function choosefrom ()
{
  local RESULT=""
  local FILE=""

  for FILE in "$@"
  do
    [ -z "$RESULT" -a -e "$FILE" ] && RESULT="$FILE"
  done

  [ -z "$RESULT" ] && RESULT="$FILE"
  echo "$RESULT"
}

#get actual settings
. "$ISABELLE_HOME/etc/settings" || exit 2
ISABELLE_SITE_SETTINGS_PRESENT=true

[ "$ISABELLE_HOME" -ef "$ISABELLE_HOME_USER" ] && \
  { echo >&2 "### ISABELLE_HOME and ISABELLE_HOME_USER should not be the same directory!"; }
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && . "$ISABELLE_HOME_USER/etc/settings"

#append ML system identifier to paths
if [ -z "$ML_PLATFORM" ]; then
  ML_IDENTIFIER="$ML_SYSTEM"
else
  ML_IDENTIFIER="${ML_SYSTEM}_${ML_PLATFORM}"
fi
ISABELLE_OUTPUT="$ISABELLE_OUTPUT/$ML_IDENTIFIER"

set +o allexport

fi