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() {
|
|
|
|
if [ "$(uname)" = "Linux" ]; then
|
|
|
|
readlink -f "$1"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
# See https://github.com/cdr/code-server/issues/1537
|
|
|
|
if [ "$(uname)" = "Darwin" ]; then
|
|
|
|
script="$1"
|
|
|
|
if [ -L "$script" ]; then
|
|
|
|
while [ -L "$script" ]; do
|
2020-06-03 22:41:13 +07:00
|
|
|
# We recursively read the symlink, which may be relative from $script.
|
2020-06-03 21:32:11 +07:00
|
|
|
script="$(readlink "$script")"
|
|
|
|
cd "$(dirname "$script")"
|
|
|
|
done
|
|
|
|
else
|
|
|
|
cd "$(dirname "$script")"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "$PWD/$(basename "$script")"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Unsupported OS $(uname)" >&2
|
|
|
|
exit 1
|
2020-04-23 04:45:53 +07:00
|
|
|
}
|
2020-02-26 05:20:47 +07:00
|
|
|
|
2020-06-03 21:32:11 +07:00
|
|
|
ROOT="$(dirname "$(dirname "$(_realpath "$0")")")"
|
2020-05-28 11:49:37 +07:00
|
|
|
exec "$ROOT/lib/node" "$ROOT" "$@"
|