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

37 lines
997 B
Bash
Raw Normal View History

#!/bin/sh
set -eu
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
_realpath() {
# See https://github.com/cdr/code-server/issues/1537 on why no realpath or readlink -f.
script="$1"
cd "$(dirname "$script")"
while [ -L "$(basename "$script")" ]; do
if [ -L "./node" ] && [ -L "./code-server" ] \
&& [ -f "package.json" ] \
&& cat package.json | grep -q '^ "name": "code-server",$'; then
echo "***** Please use the script in bin/code-server instead!" >&2
echo "***** This script will soon be removed!" >&2
echo "***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0" >&2
fi
script="$(readlink "$(basename "$script")")"
cd "$(dirname "$script")"
done
echo "$PWD/$(basename "$script")"
}
root() {
script="$(_realpath "$0")"
bin_dir="$(dirname "$script")"
2020-06-04 06:23:42 +08:00
dirname "$bin_dir"
2020-04-23 05:45:53 +08:00
}
2020-02-26 06:20:47 +08:00
ROOT="$(root)"
2020-05-28 12:49:37 +08:00
exec "$ROOT/lib/node" "$ROOT" "$@"