Fix code that looks for default STAGE0 to check /usr/local.
authorChris Hanson <org/chris-hanson/cph>
Wed, 11 Jan 2017 08:14:34 +0000 (00:14 -0800)
committerChris Hanson <org/chris-hanson/cph>
Wed, 11 Jan 2017 08:14:34 +0000 (00:14 -0800)
etc/run-three-stages

index b100324d35af7f5a85b5ae1ce18f99b0dc060cb5..ff7a0274f968fe4aac9a77f467972f5991fab03d 100755 (executable)
@@ -83,7 +83,8 @@ find_stage ()
 {
     find_build_stage "${1}" && return 0
     if [[ ${1} == stage0 ]]; then
-       find_dist_stage "${1}" && return 0
+       find_dist_stage $(pwd)/"${1}" && return 0
+       find_dist_stage /usr/local && return 0
        find_build_stage "${STAGE0}" && return 0
     fi
     echo "Unable to find ${1} executable" >&2
@@ -104,8 +105,12 @@ find_build_stage ()
 
 find_dist_stage ()
 {
-    local STAGE=$(pwd)/${1}
-    local LIBDIR=${STAGE}/lib/mit-scheme*
+    local STAGE=${1}
+    local LIBDIRS=(${STAGE}/lib/mit-scheme*)
+    if (( ${#LIBDIRS[@]} < 1 )); then
+        return 1
+    fi
+    local LIBDIR=${LIBDIRS[0]}
     if [[ -x ${STAGE}/bin/mit-scheme && -f ${LIBDIR}/all.com ]]; then
        export MIT_SCHEME_EXE=${STAGE}/bin/mit-scheme
        export MITSCHEME_LIBRARY_PATH=${LIBDIR}