1
0
mirror of synced 2026-01-13 15:37:38 +00:00
Interlisp.medley/run-medley
Abe Jellinek 3aaa8c9837 Update run-medley
- Pass through args correctly
- Help text that matches (more or less) the available params
- Add --dimensions to make setting screen size and geometry straightforward
2020-12-02 13:32:01 -08:00

148 lines
3.9 KiB
Bash
Executable File

#!/bin/sh
# Run Medley
#
# Syntax: run-medley [--dimensions WIDTHxHEIGHT] \ # equivalent to -g WxH -sc WxH
# [-g WIDTHxHEIGHT] \
# [-sc WIDTHxHEIGHT] \
# [--display X_DISPLAY] \
# [--vmem | --vmfile FILE] \
# [--nogreet | --greet FILE] \
# [URL_OR_FILE]
# Directory variables are 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
# the user is usually running this script from medley, so let's try that
export MEDLEYDIR=${PWD}
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"
geometry="-g 1440x900"
screensize="-sc 1440x900"
passthrough_args=""
export LDEDESTSYSOUT=${HOME}/lisp.virtualmem
export LDEINIT="$MEDLEYDIR/greetfiles/SIMPLE-INIT"
export LDEKBDTYPE=x
while [ "$#" -ne 0 ]; do
case "$1" in
"-nogreet" | "--nogreet")
export LDEINIT=""
;;
"-greet" | "--greet")
export LDEINIT="$2"
shift
;;
"--dimensions" | "-dimensions")
geometry="-g $2"
screensize="-sc $2"
shift
;;
"--geometry" | "-geometry" | "-g")
geometry="-g $2"
shift
;;
"--screensize" | "-screensize" | "-sc")
screensize = "-sc $2"
shift
;;
"--display" | "-d")
export DISPLAY="$2"
shift
;;
"-vmem" | "--vmem" | "-vmfile" )
export LDEDESTSYSOUT="$2"
shift
;;
"-full")
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
;;
"-lisp")
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xlisp.sysout"
;;
"-*")
passthrough_args="$passthrough_args $1 $2"
echo passing through unrecognized option: "$1" "$2"
shift
;;
*)
export LDESRCESYSOUT="$1"
;;
esac
shift
done
# not set on command line
if [ -z "$LDESRCESYSOUT" ] ; then
if [ -f "$LDEDESTSYSOUT" ] ; then
export LDESRCESYSOUT="$LDEDESTSYSOUT"
else
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
fi
fi
case "$LDESRCSYSOUT" in
"http:*" | "https:*")
echo URL not supported yet
exit 1
esac
inferred_maikodir=false
if [ -z "$MAIKODIR" ] ; then
# here we try two options relative to MEDLEYDIR: ./maiko and ../maiko
# this is highly imperfect, but the user can always set the env variables
export MAIKODIR="$MEDLEYDIR/../maiko"
if [ ! -d "$MAIKODIR" ] ; then
export MAIKODIR="$MEDLEYDIR/maiko"
fi
inferred_maikodir=true
fi
if [ ! -d "$MAIKODIR/bin" ] ; then
echo "MAIKODIR has no bin: $MAIKODIR"
if [ inferred_maikodir = true ] ; then
echo "I tried to infer it based on your working directory, but that didn't work."
echo "Try setting the MAIKODIR environment variable to the right location."
fi
exit 1
fi
oldpath="$PATH"
export PATH=.:"$PATH"
cd "$MAIKODIR"/bin
export PATH=$MAIKODIR/`osversion`.`machinetype`:"$oldpath"
cd "$OLDPWD"
echo "sysout is $LDESRCESYSOUT"
echo "running `which $prog` $geometry $screensize"
echo "start $LDEINIT"
export INMEDLEY=1
$prog $geometry $screensize -t "Medley Interlisp" $passthrough_args "$LDESRCESYSOUT"