1
0
mirror of https://github.com/coder/code-server.git synced 2024-12-05 07:13:06 +08:00
code-server/ci/build/code-server.sh

26 lines
891 B
Bash
Raw Normal View History

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