mirror of
https://github.com/lichess-org/lila.git
synced 2026-05-26 13:51:00 +00:00
lila.sh minor improvement
fix script sourced logic: return, not exit. Calling exit terminates the "parent" shell.
This commit is contained in:
@@ -7,11 +7,14 @@
|
|||||||
# Then in the sbt console:
|
# Then in the sbt console:
|
||||||
# run
|
# run
|
||||||
|
|
||||||
|
if [[ "${BASH_SOURCE[0]}" != "$0" ]]; then
|
||||||
|
>&2 echo "Fatal: lila.sh should be run, not sourced!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
WARN() { >&2 printf '%s\n' "[warning] $*"; }
|
WARN() { >&2 printf '%s\n' "[warning] $*"; }
|
||||||
ABORT() { >&2 printf '%s\n' "[FATAL] $*"; exit 1; }
|
ABORT() { >&2 printf '%s\n' "[FATAL] $*"; exit 1; }
|
||||||
|
|
||||||
[[ "${BASH_SOURCE[0]}" == "$0" ]] || ABORT "should not be sourced!"
|
|
||||||
|
|
||||||
cd "$(dirname -- "$0")" # set cwd
|
cd "$(dirname -- "$0")" # set cwd
|
||||||
|
|
||||||
cat << 'BANNER'
|
cat << 'BANNER'
|
||||||
@@ -54,7 +57,7 @@ fi
|
|||||||
java_bin="${java_home_bin:-$java_path_bin}"
|
java_bin="${java_home_bin:-$java_path_bin}"
|
||||||
|
|
||||||
if ! "$java_bin" --list-modules 2>/dev/null | grep -Fq jdk.compiler; then
|
if ! "$java_bin" --list-modules 2>/dev/null | grep -Fq jdk.compiler; then
|
||||||
WARN "$java_bin incomplete. Is it a JRE (and not a JDK)?"
|
WARN "$java_bin incomplete. Is it a JRE (and not a JDK)?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
java_version=$("$java_bin" -version 2>&1 | head -n1 | cut -d'"' -f2)
|
java_version=$("$java_bin" -version 2>&1 | head -n1 | cut -d'"' -f2)
|
||||||
|
|||||||
Reference in New Issue
Block a user