2020-05-22 01:57:35 +00:00
|
|
|
#!/bin/sh
|
2020-04-30 11:52:54 +00:00
|
|
|
|
2020-05-27 20:39:17 +00:00
|
|
|
# This script is intended to be bundled into the standalone releases.
|
|
|
|
# Runs code-server with the bundled node binary.
|
2020-02-25 22:20:47 +00:00
|
|
|
|
2020-04-22 21:45:53 +00:00
|
|
|
# More complicated than readlink -f or realpath to support macOS.
|
|
|
|
# See https://github.com/cdr/code-server/issues/1537
|
2020-05-28 04:49:37 +00:00
|
|
|
root_dir() {
|
2020-04-22 21:45:53 +00:00
|
|
|
# We read the symlink, which may be relative from $0.
|
|
|
|
dst="$(readlink "$0")"
|
|
|
|
# We cd into the $0 directory.
|
2020-04-30 11:52:54 +00:00
|
|
|
cd "$(dirname "$0")" || exit 1
|
2020-05-28 04:49:37 +00:00
|
|
|
# Now we can cd into the directory above the dst directory which is the root
|
|
|
|
# of the release.
|
|
|
|
cd "$(dirname "$dst")/.." || exit 1
|
|
|
|
# Finally we use pwd -P to print the absolute path the root.
|
2020-04-30 11:52:54 +00:00
|
|
|
pwd -P || exit 1
|
2020-04-22 21:45:53 +00:00
|
|
|
}
|
2020-02-25 22:20:47 +00:00
|
|
|
|
2020-05-28 04:49:37 +00:00
|
|
|
ROOT="$(root_dir)"
|
2020-05-22 02:16:16 +00:00
|
|
|
if [ "$(uname)" = "Linux" ]; then
|
2020-05-28 04:49:37 +00:00
|
|
|
export LD_LIBRARY_PATH="$ROOT/lib:$LD_LIBRARY_PATH"
|
2020-05-22 19:38:03 +00:00
|
|
|
elif [ "$(uname)" = "Darwin" ]; then
|
2020-05-28 04:49:37 +00:00
|
|
|
export DYLD_LIBRARY_PATH="$ROOT/lib:$DYLD_LIBRARY_PATH"
|
2020-05-22 01:57:35 +00:00
|
|
|
fi
|
2020-05-28 04:49:37 +00:00
|
|
|
exec "$ROOT/lib/node" "$ROOT" "$@"
|