Skip to content

Commit 2d96744

Browse files
committed
Minor fixes for install.sh and bundle in libstdc++
Closes #1706
1 parent e1c7d49 commit 2d96744

File tree

4 files changed

+50
-34
lines changed

4 files changed

+50
-34
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ curl -fsSL https://code-server.dev/install.sh | sh
2929
```
3030
$ curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run --help
3131
32+
$0 [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
33+
3234
Installs latest code-server on any macOS or Linux system preferring to use the OS package manager.
3335
3436
curl -fsSL https://code-server.dev/install.sh | sh -s --
@@ -37,29 +39,29 @@ Installs latest code-server on any macOS or Linux system preferring to use the O
3739
- For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package.
3840
- For Arch Linux it will install the AUR package.
3941
- For any unrecognized Linux operating system it will install the latest static release into ~/.local
40-
- Add ~/.local/bin to your $PATH to run code-server.
42+
- Add ~/.local/bin to your \$PATH to run code-server.
4143
4244
- For macOS it will install the Homebrew package.
4345
- If Homebrew is not installed it will install the latest static release into ~/.local
44-
- Add ~/.local/bin to your $PATH to run code-server.
46+
- Add ~/.local/bin to your \$PATH to run code-server.
4547
46-
- If ran on an architecture with no binary releases or outdated libc/libcxx, it will install the
48+
- If ran on an architecture with no binary releases or glibc < v2.17, it will install the
4749
npm package with yarn or npm.
4850
- We only have binary releases for amd64 and arm64 presently.
4951
5052
--dry-run Enables a dry run where where the steps that would have taken place
5153
are printed but do not actually execute.
5254
55+
--version Pass to install a specific version instead of the latest release.
56+
5357
--static Forces the installation of a static release into ~/.local
5458
5559
This flag takes an optional argument for the installation prefix which defaults to "~/.local".
5660
code-server will be unarchived into ~/.local/lib/code-server.X.X.X and the binary will be symlinked
57-
into "~/.local/bin/code-server". You will need to add ~/.local/bin to your $PATH to use it without
61+
into "~/.local/bin/code-server". You will need to add ~/.local/bin to your \$PATH to use it without
5862
the full path.
5963
6064
To install system wide set the prefix to /usr/local.
61-
62-
--version Pass to install a specific version instead of the latest release.
6365
```
6466

6567
If you still don't trust our install script, even with the above explaination and the dry run, we have

ci/build/build-static-release.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ main() {
1616

1717
mkdir -p "$RELEASE_PATH/bin"
1818
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
19-
rsync "$node_path" "$RELEASE_PATH/lib/node"
19+
20+
g++ -Wl,--allow-multiple-definition "$node_path" -static-libstdc++ -static-libgcc -o "$RELEASE_PATH/lib/node"
2021

2122
ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
2223
ln -s "./lib/node" "$RELEASE_PATH/node"

doc/install.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ systemctl --user enable --now code-server
6464
We recommend installing with `yarn` or `npm` if:
6565

6666
1. We don't have a precompiled release for your machine's platform or architecture.
67-
2. libc < v2.19
68-
3. libcxx < 3.4.20
67+
2. glibc < v2.17.
6968

7069
**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
7170
See [./doc/npm.md](./doc/npm.md) for installing these dependencies.

install.sh

+39-25
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,28 @@
22
set -eu
33

44
usage() {
5+
cli="$0"
6+
if [ "$0" = sh ]; then
7+
cli="curl -fsSL https://code-server.dev/install.sh | sh -s --"
8+
else
9+
curl_usage="$(
10+
cat << EOF
11+
12+
To use latest:
13+
14+
curl -fsSL https://code-server.dev/install.sh | sh -s -- <args>
15+
EOF
16+
)"$"\n"
17+
fi
518
cat << EOF
6-
$0 [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
19+
Installs latest code-server on Linux or macOS preferring to use the system package manager.
720
8-
Installs latest code-server on any macOS or Linux system preferring to use the OS package manager.
21+
Lives at https://code-server.dev/install.sh
922
10-
curl -fsSL https://code-server.dev/install.sh | sh -s --
23+
Usage:
1124
25+
$cli [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
26+
${curl_usage-}
1227
- For Debian, Ubuntu, Raspbian it will install the latest deb package.
1328
- For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package.
1429
- For Arch Linux it will install the AUR package.
@@ -19,8 +34,7 @@ Installs latest code-server on any macOS or Linux system preferring to use the O
1934
- If Homebrew is not installed it will install the latest static release into ~/.local
2035
- Add ~/.local/bin to your \$PATH to run code-server.
2136
22-
- If ran on an architecture with no binary releases or outdated libc/libcxx, it will install the
23-
npm package with yarn or npm.
37+
- If ran on an architecture with no binary releases, it will install the npm package with yarn or npm.
2438
- We only have binary releases for amd64 and arm64 presently.
2539
2640
--dry-run Enables a dry run where where the steps that would have taken place
@@ -40,9 +54,9 @@ EOF
4054
}
4155

4256
echo_latest_version() {
43-
version="$(curl -fsSL https://api.github.com/repos/cdr/code-server/releases/latest | jq -r .tag_name)"
44-
# Strip leading v.
45-
version="${version:1}"
57+
# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
58+
version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
59+
version="${version#https://github.com/cdr/code-server/releases/tag/v}"
4660
echo "$version"
4761
}
4862

@@ -172,7 +186,7 @@ parse_arg() {
172186
*=*)
173187
opt="${1#=*}"
174188
optarg="${1#*=}"
175-
if [ ! "$optarg" -a ! "${OPTIONAL-}" ]; then
189+
if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; then
176190
echoerr "$opt requires an argument"
177191
echoerr "Run with --help to see usage."
178192
exit 1
@@ -183,7 +197,7 @@ parse_arg() {
183197
esac
184198

185199
case "${2-}" in
186-
"" | -* | --*)
200+
"" | -*)
187201
if [ ! "${OPTIONAL-}" ]; then
188202
echoerr "$1 requires an argument"
189203
echoerr "Run with --help to see usage."
@@ -282,7 +296,7 @@ install_static() {
282296
fi
283297
SKIP_ECHO=1 sh_c mkdir -p "$STATIC_INSTALL_PREFIX/lib" "$STATIC_INSTALL_PREFIX/bin"
284298

285-
if [[ -e "$STATIC_INSTALL_PREFIX/lib/code-server-$VERSION" ]]; then
299+
if [ -e "$STATIC_INSTALL_PREFIX/lib/code-server-$VERSION" ]; then
286300
echo
287301
echoerr "code-server-$VERSION is already installed at $STATIC_INSTALL_PREFIX/lib/code-server-$VERSION"
288302
echoerr "Please remove it to reinstall."
@@ -339,21 +353,20 @@ distro() {
339353
return
340354
fi
341355

342-
if [ ! -f /etc/os-release ]; then
356+
if [ -f /etc/os-release ]; then
357+
(
358+
. /etc/os-release
359+
case "$ID" in opensuse-*)
360+
# opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
361+
echo "opensuse"
362+
return
363+
;;
364+
esac
365+
366+
echo "$ID"
367+
)
343368
return
344369
fi
345-
346-
(
347-
. /etc/os-release
348-
case "$ID" in opensuse-*)
349-
# opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.
350-
echo "opensuse"
351-
return
352-
;;
353-
esac
354-
355-
echo "$ID"
356-
)
357370
}
358371

359372
# os_name prints a pretty human readable name for the OS/Distro.
@@ -363,11 +376,12 @@ distro_name() {
363376
return
364377
fi
365378

366-
if [ ! -f /etc/os-release ]; then
379+
if [ -f /etc/os-release ]; then
367380
(
368381
. /etc/os-release
369382
echo "$PRETTY_NAME"
370383
)
384+
return
371385
fi
372386

373387
# Prints something like: Linux 4.19.0-9-amd64

0 commit comments

Comments
 (0)