Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/ci/build/code-server.sh

26 lines
850 B
Bash
Raw Normal View History

#!/bin/sh
# This script is intended to be bundled into the static releases.
2020-04-22 23:45:53 +02:00
# Runs code-server with the bundled Node binary.
2020-02-25 23:20:47 +01:00
2020-04-22 23:45:53 +02:00
# More complicated than readlink -f or realpath to support macOS.
# See https://github.com/cdr/code-server/issues/1537
bin_dir() {
2020-04-22 23:45:53 +02: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-22 23:45:53 +02:00
# Now we can cd into the dst directory.
cd "$(dirname "$dst")" || exit 1
2020-04-22 23:45:53 +02:00
# Finally we use pwd -P to print the absolute path of the directory of $dst.
pwd -P || exit 1
2020-04-22 23:45:53 +02:00
}
2020-02-25 23:20:47 +01:00
BIN_DIR=$(bin_dir)
if [ "$(uname)" = "Linux"]; then
export LD_LIBRARY_PATH="$BIN_DIR/../lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
else
export DYLD_LIBRARY_PATH="$BIN_DIR/../lib${LD_LIBRARY_PATH+:$LD_LIBRARY_PATH}"
fi
exec "$BIN_DIR/../lib/node" "$BIN_DIR/.." "$@"