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