191 lines
5.1 KiB
Bash
Executable File
191 lines
5.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Run Medley
|
|
#
|
|
# Syntax: run-medley [--dimensions WIDTHxHEIGHT] # sets both -g -sc
|
|
# [-g WIDTHxHEIGHT]
|
|
# [-sc WIDTHxHEIGHT]
|
|
# [--display X_DISPLAY] # defaults to $DISPLAY or :0
|
|
# [-prog LDEFILE]
|
|
# [--vmem | --vmfile FILE]
|
|
# [--nogreet | --greet FILE |
|
|
# --loadup FILE ] # will separate from GREET
|
|
# [-n | -nl | -full | -lisp |
|
|
# [SYSOUTFILE]
|
|
|
|
# Variables accessible from Lisp via UNIX-GETENV
|
|
# LDESRCESYSOUT SYSOUT full-file name you want to run
|
|
# LDEDESTSYSOUT name for destination of SaveVM/LOGOUT
|
|
# MEDLEYDIR used by init file to set other path variables
|
|
|
|
inferred_medleydir=false
|
|
|
|
if [ -z "$MEDLEYDIR" ] ; then
|
|
export MEDLEYDIR="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
inferred_medleydir=true
|
|
fi
|
|
|
|
if [ ! -d "$MEDLEYDIR/loadups" ] ; then
|
|
echo "MEDLEYDIR has no loadups: $MEDLEYDIR"
|
|
if [ inferred_medleydir = true ] ; then
|
|
echo "I tried to infer it based on your working directory, but that didn't work."
|
|
echo "Try cd there or setting the MEDLEYDIR environment variable to its location."
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
# set defaults, overridden if suppplied explicitly
|
|
|
|
prog="lde"
|
|
passthrough_args=""
|
|
mem="-m 256"
|
|
|
|
if [ -z "$LDEDESTSYSOUT" ] ; then
|
|
if [ -z "$LOGINDIR" ] ; then
|
|
export LDEDESTSYSOUT="${HOME}/lisp.virtualmem"
|
|
else
|
|
export LDEDESTSYSOUT="${LOGINDIR}/lisp.virtualmem"
|
|
fi
|
|
fi
|
|
|
|
if [ -z "$LDEINIT" ] ; then
|
|
export LDEINIT="$MEDLEYDIR/greetfiles/SIMPLE-INIT"
|
|
fi
|
|
|
|
export LDEKBDTYPE=x
|
|
|
|
while [ "$#" -ne 0 ]; do
|
|
case "$1" in
|
|
"-loadup")
|
|
export MEDLEYLOADUP="$2"
|
|
export LDEINIT="$2"
|
|
shift
|
|
;;
|
|
"-nogreet" | "--nogreet")
|
|
# Keep (GREET) from finding an init file
|
|
mkdir -p $MEDLEYDIR/tmp/logindir
|
|
export HOME=$MEDLEYDIR/tmp/logindir
|
|
export LOGINDIR=$MEDLEYDIR/tmp/logindir
|
|
export LDEINIT="$MEDLEYDIR/greetfiles/NOGREET"
|
|
;;
|
|
"-greet" | "--greet")
|
|
export LDEINIT="$2"
|
|
shift
|
|
;;
|
|
"--dimensions" | "-dimensions")
|
|
sw=`expr "$2" : "\([0-9]*\)x[0-9]*$"`
|
|
sh=`expr "$2" : "[0-9]*x\([0-9]*\)$"`
|
|
if [ -n "$sw" -a -n "$sh" ] ; then
|
|
sw=$(( (31+$sw)/32*32 ))
|
|
gw=$(( 22+$sw ))
|
|
gh=$(( 22+$sh ))
|
|
geometry="-g ${gw}x${gh}"
|
|
screensize="-sc ${sw}x${sh}"
|
|
fi
|
|
shift
|
|
;;
|
|
"--geometry" | "-geometry" | "-g")
|
|
geometry="-g $2"
|
|
shift
|
|
;;
|
|
"--screensize" | "-screensize" | "-sc")
|
|
screensize="-sc $2"
|
|
shift
|
|
;;
|
|
"--display" | "-d")
|
|
export DISPLAY="$2"
|
|
shift
|
|
;;
|
|
"-prog" )
|
|
prog="$2"
|
|
shift
|
|
;;
|
|
"-m" | "-mem" )
|
|
mem="-m $2 "
|
|
shift
|
|
;;
|
|
"-vmem" | "--vmem" | "-vmfile" )
|
|
export LDEDESTSYSOUT="$2"
|
|
shift
|
|
;;
|
|
"-full")
|
|
export LDESRCESYSOUT="$MEDLEYDIR/loadups/full.sysout"
|
|
;;
|
|
"-lisp")
|
|
export LDESRCESYSOUT="$MEDLEYDIR/loadups/lisp.sysout"
|
|
;;
|
|
"-n" | "-new" | "-newfull" )
|
|
export LDESRCESYSOUT="$MEDLEYDIR/tmp/full.sysout"
|
|
;;
|
|
"-nl" | "-newlisp" )
|
|
export LDESRCESYSOUT="$MEDLEYDIR/tmp/lisp.sysout"
|
|
;;
|
|
"-*")
|
|
passthrough_args="$passthrough_args $1 $2"
|
|
echo passing through unrecognized option: "$1" "$2"
|
|
shift
|
|
;;
|
|
*)
|
|
export LDESRCESYSOUT="$1"
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [ -z "$LDESRCESYSOUT" ] ; then
|
|
if [ -f "$LDEDESTSYSOUT" ] ; then
|
|
export LDESRCESYSOUT="$LDEDESTSYSOUT"
|
|
else
|
|
export LDESRCESYSOUT="$MEDLEYDIR/loadups/full.sysout"
|
|
fi
|
|
fi
|
|
|
|
if [ -z "$geometry" ] ; then
|
|
# maiko guesses wrong
|
|
geometry="-g 1440x900"
|
|
screensize="-sc 1440x900"
|
|
fi
|
|
|
|
if ! command -v "$prog" > /dev/null 2>&1; then
|
|
# if lde is already on path, don't reset it
|
|
# otherwise check for MAIKODIR
|
|
|
|
if [ -z "$MAIKODIR" ] ; then
|
|
# try two options relative to MEDLEYDIR: ./maiko and ../maiko
|
|
MAIKODIR="$MEDLEYDIR/../maiko"
|
|
if ! command -v "$MAIKODIR/bin/osversion" > /dev/null 2>&1; then
|
|
MAIKODIR="$MEDLEYDIR/maiko"
|
|
fi
|
|
fi
|
|
|
|
if ! command -v "$MAIKODIR/bin/osversion" > /dev/null 2>&1; then
|
|
echo "Could not find 'lde' on PATH"
|
|
echo "nor MAIKODIR with 'bin/osversion' (to look for it)"
|
|
exit 1
|
|
fi
|
|
|
|
oldpath="$PATH"
|
|
oldpwd=`pwd`
|
|
PATH=.:"$PATH"
|
|
cd "$MAIKODIR"/bin
|
|
osv=`osversion`
|
|
mct=`machinetype`
|
|
newpath="$MAIKODIR"/"$osv.$mct"
|
|
PATH="$newpath":"$oldpath"
|
|
cd "$oldpwd"
|
|
if ! command -v $prog > /dev/null 2>&1; then
|
|
echo $prog not found in $newpath
|
|
echo osversion = $osv
|
|
echo machinetype = $mct
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
echo "running: $prog $geometry $screensize $mem $passthrough_args $LDESRCESYSOUT"
|
|
echo "greet: $LDEINIT"
|
|
|
|
export INMEDLEY=1
|
|
|
|
"$prog" $geometry $screensize $mem -t "Medley Interlisp" $passthrough_args "$LDESRCESYSOUT"
|
|
|
|
|