2020-05-22 09:57:35 +08:00
|
|
|
#!/bin/sh
|
2020-06-03 22:32:11 +08:00
|
|
|
set -eu
|
2020-04-30 19:52:54 +08:00
|
|
|
|
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-06-03 22:32:11 +08:00
|
|
|
_realpath() {
|
2022-02-02 00:45:19 +08:00
|
|
|
# See https://github.com/coder/code-server/issues/1537 on why no realpath or readlink -f.
|
2020-06-04 03:18:27 +08:00
|
|
|
|
|
|
|
script="$1"
|
|
|
|
cd "$(dirname "$script")"
|
|
|
|
|
|
|
|
while [ -L "$(basename "$script")" ]; do
|
|
|
|
script="$(readlink "$(basename "$script")")"
|
|
|
|
cd "$(dirname "$script")"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "$PWD/$(basename "$script")"
|
|
|
|
}
|
2020-06-03 22:32:11 +08:00
|
|
|
|
2020-06-04 03:18:27 +08:00
|
|
|
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
|
|
|
|
2020-06-04 03:18:27 +08:00
|
|
|
ROOT="$(root)"
|
2020-05-28 12:49:37 +08:00
|
|
|
exec "$ROOT/lib/node" "$ROOT" "$@"
|