#!/bin/sh # Hey EMACS, this should be in -*- ksh -*- mode # # FILE: dome # AUTHOR: Eric Engstrom (engstrom@htc.honeywell.com) # OVERVIEW: Simple script for starting DOME on any UN*X platform # USE: dome [-v ] # # COPYRIGHT # Copyright (C) 1993-1996 Honeywell Technology Center # All Rights Reserved. # No unauthorized duplication or distribution allowed. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See your DOME License for more details. # # HISTORY # [engstrom:19930804] added tracking facility to see who uses dome. # [engstrom:19950811] Added support for $DOMEHOME and for Solaris # [engstrom:19950814] added DOME.Versions file support # [engstrom:19960220] reworked for new release directory structure # [engstrom:19960228] added DOMEROOT variable to indicate top of dome versions dir # [tap:19970326] eliminated unused code # # Bugs/ToDo: # - allow files to be specified and loaded once dome is started # - check for running dome and just bring that forward? ## ########## # DOMEROOT directory is the directory that contains ALL versions of dome # This is the ONLY VARIABLE YOU SHOULD HAVE TO CHANGE, or you can set it # as an environment variable before executing this script DOMEROOT=${DOMEROOT:-"/usr/local/dome"} # Remember, this is all you should have to change. # THE REST OF THIS SCRIPT SHOULD REMAIN UNMODIFIED. ########## # ensure path for cetain commands PATH=/bin:/usr/bin:$PATH # what am I called? PROGNAME=`basename $0` # noisiness VERBOSE=true # handy functions tell() { $VERBOSE && echo "$PROGNAME: $*" ; } warn() { echo "$PROGNAME: $*" 1>&2; } die() { warn $*; exit 1; } usage() { echo "Usage: $PROGNAME [-v ]" 1>&2; exit 1;} # return a canonical name for a directory passed canonicalize() { (cd $1; pwd); } # If DOMEROOT does not exist, where are we executing? if [ ! -d $DOMEROOT ]; then DOMEROOT=`canonicalize \`dirname $0\`/..` fi # If version map exists, determine default version to run vmap=$DOMEROOT/etc/DOME.Versions if [ -r $vmap ]; then version=`awk -F: '$1=="'"$PROGNAME"'" {print $2}' < $vmap` fi # Parse arguments while true; do case $1 in -v ) version=$2; opts="$opts -v"; shift 2 ;; "" ) break ;; * ) usage ;; esac done # Find the image to run. if [ -n "$version" ]; then # First look in the versioned directory image="$DOMEROOT/$version/image/dome.im" if [ ! -r "$image" ]; then die "no $version version of DOME image at $image" fi elif [ $PROGNAME = "dome" ]; then # just pick most recent one from "common" image dir image_dir="$DOMEROOT/image" if [ -d $image_dir ]; then image=`ls -t $image_dir/*.im | head -1` if [ -z "$image" ]; then die "no DOME images in '$image_dir'???" fi else die "image directory '$image_dir' does not exist." fi elif [ $PROGNAME != "dome" ]; then die "no '$PROGNAME' version of DOME exists; perhaps use 'dome'." else die "Huh? I'm very confused and cannot start DOME." fi # Determine appropriate value for DOMEHOME environment variable if [ -n "$DOMEHOME" ]; then warn "\$DOMEHOME already set to '$DOMEHOME'; ignoring..." fi DOMEHOME=${DOMEROOT}${version:+"/$version"}; export DOMEHOME tell "using '$DOMEHOME' as DOMEHOME directory..." # determine OS arch for vm OS=`uname -sr` case $OS in SunOS\ 4* ) vm_arch="SunOS4" ;; SunOS\ 5.5 ) vm_arch="SunOS5" ;; SunOS\ 5.* ) vm_arch="Solaris" ;; IRIX\ 5* ) vm_arch="IRIX5" ;; HP-UX* ) vm_arch="HPUX" ;; Linux* ) vm_arch="Linux";; * ) die "unknown OS version: $OS";; esac # where to look for virtual machine vm_dir="$DOMEHOME/vm/$vm_arch" if [ ! -d $vm_dir ]; then vm_dir="$DOMEHOME/vm"; fi echo $vm_dir # look for virtual machine... st80, oe20, visualworks... if [ -x "$vm_dir/visualworks" ]; then vm="$vm_dir/visualworks" elif [ -x "$vm_dir/oe20" ]; then vm="$vm_dir/oe20" case $OS in SunOS\ 4*) vm_opts="-o8";; esac elif [ -x "$vm_dir/st80" ]; then vm="$vm_dir/st80" elif [ -x "$vm_dir/visual" ]; then vm="$vm_dir/visual" else die "DOME virtual machine not available for $OS." fi # Check library path: [engstrom:19941011.1001CST] if [ -z "$LD_LIBRARY_PATH" ]; then warn "your library path is not set; guessing path..." # need to make this be more arch dependent LD_LIBRARY_PATH='/usr/local/X11/lib:/usr/openwin/lib' export LD_LIBRARY_PATH fi # FINALLY Start DOME! $DEBUG exec $vm $vm_opts $image