Archived
1
0

Add warning when using outdated code-server script

This commit is contained in:
Anmol Sethi 2020-06-03 15:18:27 -04:00
parent e2789608b2
commit ab081cd522
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
3 changed files with 28 additions and 25 deletions

View File

@ -5,31 +5,32 @@ set -eu
# Runs code-server with the bundled node binary. # Runs code-server with the bundled node binary.
_realpath() { _realpath() {
if [ "$(uname)" = "Linux" ]; then # See https://github.com/cdr/code-server/issues/1537 on why no realpath or readlink -f.
readlink -f "$1"
return 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 fi
# See https://github.com/cdr/code-server/issues/1537 script="$(readlink "$(basename "$script")")"
if [ "$(uname)" = "Darwin" ]; then
script="$1"
if [ -L "$script" ]; then
while [ -L "$script" ]; do
# We recursively read the symlink, which may be relative from $script.
script="$(readlink "$script")"
cd "$(dirname "$script")" cd "$(dirname "$script")"
done done
else
cd "$(dirname "$script")"
fi
echo "$PWD/$(basename "$script")" echo "$PWD/$(basename "$script")"
return
fi
echo "Unsupported OS $(uname)" >&2
exit 1
} }
ROOT="$(dirname "$(dirname "$(_realpath "$0")")")" root() {
script="$(_realpath "$0")"
bin_dir="$(dirname "$script")"
echo "$(dirname "$bin_dir")"
}
ROOT="$(root)"
exec "$ROOT/lib/node" "$ROOT" "$@" exec "$ROOT/lib/node" "$ROOT" "$@"

View File

@ -9,7 +9,7 @@ main() {
tsc --noEmit tsc --noEmit
# See comment in ./ci/image/debian8 # See comment in ./ci/image/debian8
if [[ ! ${CI-} ]]; then if [[ ! ${CI-} ]]; then
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090 $(git ls-files "*.sh") shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh")
fi fi
} }

View File

@ -1,8 +1,10 @@
FROM centos:7 FROM centos:7
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \ RUN ARCH="$(uname -m | sed 's/86_64/64/; s/aarch64/arm64/')" && \
yum install -y nodejs && \ curl -fsSL "https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-$ARCH.tar.xz" | tar -C /usr/local -xJ && \
npm install -g yarn mv /usr/local/node-v14.4.0-linux-$ARCH /usr/local/node-v14.4.0
ENV PATH=/usr/local/node-v14.4.0/bin:$PATH
RUN npm install -g yarn
RUN yum groupinstall -y 'Development Tools' RUN yum groupinstall -y 'Development Tools'
RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel