Archived
1
0

Minor fixes for install.sh and bundle in libstdc++

Closes #1706
This commit is contained in:
Anmol Sethi 2020-05-21 16:45:31 -04:00
parent c80b2748e1
commit e0172d0953
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
4 changed files with 50 additions and 34 deletions

View File

@ -29,6 +29,8 @@ curl -fsSL https://code-server.dev/install.sh | sh
``` ```
$ curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run --help $ curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run --help
$0 [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
Installs latest code-server on any macOS or Linux system preferring to use the OS package manager. Installs latest code-server on any macOS or Linux system preferring to use the OS package manager.
curl -fsSL https://code-server.dev/install.sh | sh -s -- 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
- For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package. - For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package.
- For Arch Linux it will install the AUR package. - For Arch Linux it will install the AUR package.
- For any unrecognized Linux operating system it will install the latest static release into ~/.local - For any unrecognized Linux operating system it will install the latest static release into ~/.local
- Add ~/.local/bin to your $PATH to run code-server. - Add ~/.local/bin to your \$PATH to run code-server.
- For macOS it will install the Homebrew package. - For macOS it will install the Homebrew package.
- If Homebrew is not installed it will install the latest static release into ~/.local - If Homebrew is not installed it will install the latest static release into ~/.local
- Add ~/.local/bin to your $PATH to run code-server. - Add ~/.local/bin to your \$PATH to run code-server.
- If ran on an architecture with no binary releases or outdated libc/libcxx, it will install the - If ran on an architecture with no binary releases or glibc < v2.17, it will install the
npm package with yarn or npm. npm package with yarn or npm.
- We only have binary releases for amd64 and arm64 presently. - We only have binary releases for amd64 and arm64 presently.
--dry-run Enables a dry run where where the steps that would have taken place --dry-run Enables a dry run where where the steps that would have taken place
are printed but do not actually execute. are printed but do not actually execute.
--version Pass to install a specific version instead of the latest release.
--static Forces the installation of a static release into ~/.local --static Forces the installation of a static release into ~/.local
This flag takes an optional argument for the installation prefix which defaults to "~/.local". This flag takes an optional argument for the installation prefix which defaults to "~/.local".
code-server will be unarchived into ~/.local/lib/code-server.X.X.X and the binary will be symlinked code-server will be unarchived into ~/.local/lib/code-server.X.X.X and the binary will be symlinked
into "~/.local/bin/code-server". You will need to add ~/.local/bin to your $PATH to use it without into "~/.local/bin/code-server". You will need to add ~/.local/bin to your \$PATH to use it without
the full path. the full path.
To install system wide set the prefix to /usr/local. To install system wide set the prefix to /usr/local.
--version Pass to install a specific version instead of the latest release.
``` ```
If you still don't trust our install script, even with the above explaination and the dry run, we have If you still don't trust our install script, even with the above explaination and the dry run, we have

View File

@ -16,7 +16,8 @@ main() {
mkdir -p "$RELEASE_PATH/bin" mkdir -p "$RELEASE_PATH/bin"
rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server" rsync ./ci/build/code-server.sh "$RELEASE_PATH/bin/code-server"
rsync "$node_path" "$RELEASE_PATH/lib/node"
g++ -Wl,--allow-multiple-definition "$node_path" -static-libstdc++ -static-libgcc -o "$RELEASE_PATH/lib/node"
ln -s "./bin/code-server" "$RELEASE_PATH/code-server" ln -s "./bin/code-server" "$RELEASE_PATH/code-server"
ln -s "./lib/node" "$RELEASE_PATH/node" ln -s "./lib/node" "$RELEASE_PATH/node"

View File

@ -64,8 +64,7 @@ systemctl --user enable --now code-server
We recommend installing with `yarn` or `npm` if: We recommend installing with `yarn` or `npm` if:
1. We don't have a precompiled release for your machine's platform or architecture. 1. We don't have a precompiled release for your machine's platform or architecture.
2. libc < v2.19 2. glibc < v2.17.
3. libcxx < 3.4.20
**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies. **note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
See [./doc/npm.md](./doc/npm.md) for installing these dependencies. See [./doc/npm.md](./doc/npm.md) for installing these dependencies.

View File

@ -2,13 +2,28 @@
set -eu set -eu
usage() { usage() {
cli="$0"
if [ "$0" = sh ]; then
cli="curl -fsSL https://code-server.dev/install.sh | sh -s --"
else
curl_usage="$(
cat << EOF cat << EOF
$0 [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
Installs latest code-server on any macOS or Linux system preferring to use the OS package manager. To use latest:
curl -fsSL https://code-server.dev/install.sh | sh -s -- curl -fsSL https://code-server.dev/install.sh | sh -s -- <args>
EOF
)"$"\n"
fi
cat << EOF
Installs latest code-server on Linux or macOS preferring to use the system package manager.
Lives at https://code-server.dev/install.sh
Usage:
$cli [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
${curl_usage-}
- For Debian, Ubuntu, Raspbian it will install the latest deb package. - For Debian, Ubuntu, Raspbian it will install the latest deb package.
- For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package. - For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package.
- For Arch Linux it will install the AUR package. - 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
- If Homebrew is not installed it will install the latest static release into ~/.local - If Homebrew is not installed it will install the latest static release into ~/.local
- Add ~/.local/bin to your \$PATH to run code-server. - Add ~/.local/bin to your \$PATH to run code-server.
- If ran on an architecture with no binary releases or outdated libc/libcxx, it will install the - If ran on an architecture with no binary releases, it will install the npm package with yarn or npm.
npm package with yarn or npm.
- We only have binary releases for amd64 and arm64 presently. - We only have binary releases for amd64 and arm64 presently.
--dry-run Enables a dry run where where the steps that would have taken place --dry-run Enables a dry run where where the steps that would have taken place
@ -40,9 +54,9 @@ EOF
} }
echo_latest_version() { echo_latest_version() {
version="$(curl -fsSL https://api.github.com/repos/cdr/code-server/releases/latest | jq -r .tag_name)" # https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860
# Strip leading v. version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"
version="${version:1}" version="${version#https://github.com/cdr/code-server/releases/tag/v}"
echo "$version" echo "$version"
} }
@ -172,7 +186,7 @@ parse_arg() {
*=*) *=*)
opt="${1#=*}" opt="${1#=*}"
optarg="${1#*=}" optarg="${1#*=}"
if [ ! "$optarg" -a ! "${OPTIONAL-}" ]; then if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; then
echoerr "$opt requires an argument" echoerr "$opt requires an argument"
echoerr "Run with --help to see usage." echoerr "Run with --help to see usage."
exit 1 exit 1
@ -183,7 +197,7 @@ parse_arg() {
esac esac
case "${2-}" in case "${2-}" in
"" | -* | --*) "" | -*)
if [ ! "${OPTIONAL-}" ]; then if [ ! "${OPTIONAL-}" ]; then
echoerr "$1 requires an argument" echoerr "$1 requires an argument"
echoerr "Run with --help to see usage." echoerr "Run with --help to see usage."
@ -282,7 +296,7 @@ install_static() {
fi fi
SKIP_ECHO=1 sh_c mkdir -p "$STATIC_INSTALL_PREFIX/lib" "$STATIC_INSTALL_PREFIX/bin" SKIP_ECHO=1 sh_c mkdir -p "$STATIC_INSTALL_PREFIX/lib" "$STATIC_INSTALL_PREFIX/bin"
if [[ -e "$STATIC_INSTALL_PREFIX/lib/code-server-$VERSION" ]]; then if [ -e "$STATIC_INSTALL_PREFIX/lib/code-server-$VERSION" ]; then
echo echo
echoerr "code-server-$VERSION is already installed at $STATIC_INSTALL_PREFIX/lib/code-server-$VERSION" echoerr "code-server-$VERSION is already installed at $STATIC_INSTALL_PREFIX/lib/code-server-$VERSION"
echoerr "Please remove it to reinstall." echoerr "Please remove it to reinstall."
@ -339,10 +353,7 @@ distro() {
return return
fi fi
if [ ! -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
return
fi
( (
. /etc/os-release . /etc/os-release
case "$ID" in opensuse-*) case "$ID" in opensuse-*)
@ -354,6 +365,8 @@ distro() {
echo "$ID" echo "$ID"
) )
return
fi
} }
# os_name prints a pretty human readable name for the OS/Distro. # os_name prints a pretty human readable name for the OS/Distro.
@ -363,11 +376,12 @@ distro_name() {
return return
fi fi
if [ ! -f /etc/os-release ]; then if [ -f /etc/os-release ]; then
( (
. /etc/os-release . /etc/os-release
echo "$PRETTY_NAME" echo "$PRETTY_NAME"
) )
return
fi fi
# Prints something like: Linux 4.19.0-9-amd64 # Prints something like: Linux 4.19.0-9-amd64