This allows for a more consistent command-line interface that doesn't have to duplicate lde's argument parsing. We handle four arguments that are inconvenient when calling lde directly or that require setting environment variables, and then the rest is passed through. At this point, `run-medley-mac` shouldn't be necessary, but I haven't tested this revised script on a Mac yet, so I'm leaving it be for now.
130 lines
3.0 KiB
Bash
Executable File
130 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Run Medley
|
|
#
|
|
# Syntax: run-medley [--geometry WIDTHxHEIGHT] \
|
|
# [--display X_DISPLAY] \
|
|
# [--save FILE] \
|
|
# [--load URL_OR_FILE]
|
|
|
|
# Directory variables are accessible from Lisp via UNIX-GETENV
|
|
|
|
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 setting the MEDLEYDIR environment variable to the right location."
|
|
fi
|
|
exit 1
|
|
fi
|
|
|
|
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
|
|
|
|
export LDEINIT="$MEDLEYDIR/greetfiles/LOCAL-INIT"
|
|
|
|
passthrough_args=""
|
|
mem="-m 256" # Default, has to be set
|
|
# MBA screensize
|
|
geometry="-g 1280x720"
|
|
|
|
|
|
# keyboard types: x, type2, type3, type4, jle, as3000j
|
|
|
|
export LDEKBDTYPE=x
|
|
|
|
export LDEFILETIMEOUT=60
|
|
export TAKEXNSDOWN=0
|
|
export LDELISPXNS=0
|
|
|
|
#default is no lispxns
|
|
|
|
|
|
while [ "$#" -ne 0 ]; do
|
|
case "$1" in
|
|
"--geometry")
|
|
geometry="-g $2 -sc $2"
|
|
shift
|
|
;;
|
|
"--display")
|
|
export DISPLAY=$2
|
|
shift
|
|
;;
|
|
"--save")
|
|
export LDEDESTSYSOUT=$2
|
|
shift
|
|
;;
|
|
"--load")
|
|
export LDESRCESYSOUT=$2
|
|
shift
|
|
;;
|
|
*)
|
|
passthrough_args="$passthrough_args $1" # don't know what it means?
|
|
# just pass it through to lde
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [ -z "$LDESRCESYSOUT" ] ; then
|
|
export LDESRCESYSOUT="$MEDLEYDIR/loadups/xfull35.sysout"
|
|
fi
|
|
|
|
|
|
# if [ ! -z "$LDEKBDTYPE" ] ; then
|
|
# # switch (`/usr/bin/hostinfo keyboardtype`)
|
|
# # endsw
|
|
# fi
|
|
echo "keyboard type is" $LDEKBDTYPE
|
|
|
|
export INMEDLEY=1
|
|
echo "sysout is" $LDESRCESYSOUT
|
|
#version = `medley-lisp-version $LDESRCESYSOUT`
|
|
version="35010"
|
|
|
|
prog="lde"
|
|
case "$version" in
|
|
"35000")
|
|
version="3.5"
|
|
;;
|
|
"35010")
|
|
version="3.501"
|
|
;;
|
|
esac
|
|
echo "using emulator version $version"
|
|
|
|
|
|
export PATH=.:"$PATH"
|
|
old_wd=`pwd`
|
|
cd "$MAIKODIR"/bin
|
|
export PATH=$MAIKODIR/`osversion`.`machinetype`:"$PATH"
|
|
cd $old_wd
|
|
|
|
$prog $mem $geometry $passthrough_args
|