2020-05-22 08:57:35 +07:00
|
|
|
#!/bin/sh
|
2020-06-03 21:32:11 +07:00
|
|
|
set -eu
|
2020-04-30 18:52:54 +07:00
|
|
|
|
2020-05-28 03:39:17 +07:00
|
|
|
# This script is intended to be bundled into the standalone releases.
|
|
|
|
# Runs code-server with the bundled node binary.
|
2020-02-26 05:20:47 +07:00
|
|
|
|
2020-06-03 21:32:11 +07:00
|
|
|
_realpath() {
|
2020-06-04 02:18:27 +07:00
|
|
|
# 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
|
2021-03-16 05:36:31 +07:00
|
|
|
if [ -L "./node" ] && [ -L "./code-server" ] \
|
|
|
|
&& [ -f "package.json" ] \
|
|
|
|
&& cat package.json | grep -q '^ "name": "code-server",$'; then
|
2020-06-04 02:18:27 +07:00
|
|
|
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
|
2020-06-03 21:32:11 +07:00
|
|
|
fi
|
|
|
|
|
2020-06-04 02:18:27 +07:00
|
|
|
script="$(readlink "$(basename "$script")")"
|
|
|
|
cd "$(dirname "$script")"
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "$PWD/$(basename "$script")"
|
|
|
|
}
|
2020-06-03 21:32:11 +07:00
|
|
|
|
2020-06-04 02:18:27 +07:00
|
|
|
root() {
|
|
|
|
script="$(_realpath "$0")"
|
|
|
|
bin_dir="$(dirname "$script")"
|
2020-06-04 05:23:42 +07:00
|
|
|
dirname "$bin_dir"
|
2020-04-23 04:45:53 +07:00
|
|
|
}
|
2020-02-26 05:20:47 +07:00
|
|
|
|
2020-06-04 02:18:27 +07:00
|
|
|
ROOT="$(root)"
|
2020-05-28 11:49:37 +07:00
|
|
|
exec "$ROOT/lib/node" "$ROOT" "$@"
|