Skip to content

Commit ab081cd

Browse files
committed
Add warning when using outdated code-server script
1 parent e278960 commit ab081cd

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

ci/build/code-server.sh

+23-22
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,32 @@ set -eu
55
# Runs code-server with the bundled node binary.
66

77
_realpath() {
8-
if [ "$(uname)" = "Linux" ]; then
9-
readlink -f "$1"
10-
return
11-
fi
12-
13-
# See https://github.com/cdr/code-server/issues/1537
14-
if [ "$(uname)" = "Darwin" ]; then
15-
script="$1"
16-
if [ -L "$script" ]; then
17-
while [ -L "$script" ]; do
18-
# We recursively read the symlink, which may be relative from $script.
19-
script="$(readlink "$script")"
20-
cd "$(dirname "$script")"
21-
done
22-
else
23-
cd "$(dirname "$script")"
8+
# See https://github.com/cdr/code-server/issues/1537 on why no realpath or readlink -f.
9+
10+
script="$1"
11+
cd "$(dirname "$script")"
12+
13+
while [ -L "$(basename "$script")" ]; do
14+
if [ -L "./node" ] && [ -L "./code-server" ] &&
15+
[ -f "package.json" ] &&
16+
cat package.json | grep -q '^ "name": "code-server",$'; then
17+
echo "***** Please use the script in bin/code-server instead!" >&2
18+
echo "***** This script will soon be removed!" >&2
19+
echo "***** See the release notes at https://github.com/cdr/code-server/releases/tag/v3.4.0" >&2
2420
fi
2521

26-
echo "$PWD/$(basename "$script")"
27-
return
28-
fi
22+
script="$(readlink "$(basename "$script")")"
23+
cd "$(dirname "$script")"
24+
done
25+
26+
echo "$PWD/$(basename "$script")"
27+
}
2928

30-
echo "Unsupported OS $(uname)" >&2
31-
exit 1
29+
root() {
30+
script="$(_realpath "$0")"
31+
bin_dir="$(dirname "$script")"
32+
echo "$(dirname "$bin_dir")"
3233
}
3334

34-
ROOT="$(dirname "$(dirname "$(_realpath "$0")")")"
35+
ROOT="$(root)"
3536
exec "$ROOT/lib/node" "$ROOT" "$@"

ci/dev/lint.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ main() {
99
tsc --noEmit
1010
# See comment in ./ci/image/debian8
1111
if [[ ! ${CI-} ]]; then
12-
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090 $(git ls-files "*.sh")
12+
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files "*.sh")
1313
fi
1414
}
1515

ci/images/centos7/Dockerfile

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
FROM centos:7
22

3-
RUN curl -sL https://rpm.nodesource.com/setup_14.x | bash - && \
4-
yum install -y nodejs && \
5-
npm install -g yarn
3+
RUN ARCH="$(uname -m | sed 's/86_64/64/; s/aarch64/arm64/')" && \
4+
curl -fsSL "https://nodejs.org/dist/v14.4.0/node-v14.4.0-linux-$ARCH.tar.xz" | tar -C /usr/local -xJ && \
5+
mv /usr/local/node-v14.4.0-linux-$ARCH /usr/local/node-v14.4.0
6+
ENV PATH=/usr/local/node-v14.4.0/bin:$PATH
7+
RUN npm install -g yarn
68

79
RUN yum groupinstall -y 'Development Tools'
810
RUN yum install -y python2 libsecret-devel libX11-devel libxkbfile-devel

0 commit comments

Comments
 (0)