[Openmcl-devel] Openmcl script: Request for adding external sourcing of other shell scripts

Frank G=?ISO-8859-1?B?9g==?=nninger, PRION Consulting Services AG fgoenninger at prion.de
Fri Nov 19 09:28:41 PST 2004


Hi all:

I encountered a small thing when starting OpenMCL by using the openmcl
script:

I have to make sure that another shell script gets sourced from within the
openmcl script. This is due to the fact that the other script (it being part
of a library I have to load within OpenMCL: ImageMagick - but the same thing
is true for others as well) sets some environment variables that have to be
set when loading the external shared library (.dylib) (done via UFFI).

When I start from a terminal I obviously could do that by first sourcing
that other script and then loading openmcl. Unfortunately I am not able to
do that. The openmcl script gets launched via an app that start from the
Dock on Mac OS X. So, no terminal / shell env available.

So, I hacked up a version of openmcl that reads and sources all entries of a
certain directory:

-x-x-x-x-x-

!/bin/sh
#
# Change the definition of CCL_DEFAULT_DIRECTORY below to refer to
# your OpenMCL installation directory.
# Any definition of CCL_DEFAULT_DIRECTORY already present in the environment
# takes precedence over definitions made below.
#
# $Header: /opt/ccl/scripts/RCS/openmcl,v 1.2 2004/11/15 00:02:16 root Exp
root $

# SECTION 1 : CONFIGURATION !
# CUSTOMIZE THESE VARIABLES TO REFLECT YOUR ENVIRONMENT

CCL_DEFAULT_DIRECTORY=${CCL_DEFAULT_DIRECTORY:-"/opt/ccl"}
CCL_RC_DIRECTORY=${CCL_RC_DIRECTORY:-"/etc/opt/ccl/rc.openmcl.d"}

# If you don't want to guess the name of the OpenMCL kernel on
# every invocation (or if you want to use a kernel with a
# non-default name), you might want to uncomment and change
# the following line:
#OPENMCL_KERNEL=some_name

# SECTION 2 : DO NOT CHANGE !

if [ -z "$CCL_DEFAULT_DIRECTORY" ]; then
  CCL_DEFAULT_DIRECTORY=/usr/local/src/ccl
fi
if [ -z "$CCL_RC_DIRECTORY" ]; then
  CCL_DEFAULT_DIRECTORY=/usr/local/src/ccl/rc.openmcl.d
fi

# This is shorter (& easier to type), making the invocation below
# a little easier to read.

DD=${CCL_DEFAULT_DIRECTORY}

# Set the CCL_DEFAULT_DIRECTORY  environment variable;
# the lisp will use this to setup translations for the CCL: logical host.

if [ -z "$OPENMCL_KERNEL" ]; then
  case `uname -s` in
    Darwin)
    OPENMCL_KERNEL=dppccl
    ;;
    Linux)
    OPENMCL_KERNEL=ppccl
    ;;
    *)
    echo "Can't determine host OS.  Fix this."
    exit 1
    ;;
  esac
fi

# READ SHELL SCRIPTS FROM RC DIRECTORY

for RCFILE in `\ls $CCL_RC_DIRECTORY 2>/dev/null`
do
  if [ -r $RCFILE ]
  then
    . $RCFILE
  fi
done

# EXEC CCL

CCL_DEFAULT_DIRECTORY=${DD} exec ${DD}/${OPENMCL_KERNEL} "$@"

-x-x-x-x-x-

Does that make sense to you all? Would you see a possibility to include that
in the distribution?

Thx for comments and feedback!!

Cheers,
   Frank






More information about the Openmcl-devel mailing list