From 8ec1ca966d933243acf41e8f35c5275352c2a68f Mon Sep 17 00:00:00 2001 From: Larry Masinter Date: Mon, 13 Sep 2021 21:34:03 -0700 Subject: [PATCH] If lde is on path, don't bother with MAIKODIR (#478) --- run-medley | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/run-medley b/run-medley index 9b9821ba..46d5ddad 100755 --- a/run-medley +++ b/run-medley @@ -60,13 +60,11 @@ while [ "$#" -ne 0 ]; do 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") @@ -133,8 +131,6 @@ while [ "$#" -ne 0 ]; do shift done -# not set on command line - if [ -z "$LDESRCESYSOUT" ] ; then if [ -f "$LDEDESTSYSOUT" ] ; then export LDESRCESYSOUT="$LDEDESTSYSOUT" @@ -149,30 +145,24 @@ if [ -z "$geometry" ] ; then screensize="-sc 1440x900" 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 - -# if lde is already on path, don't reset it - 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"