Skip to content

Commit bacdae8

Browse files
committed
install.sh: Add our own flag parser
Fully supports long opts!
1 parent 8b6894c commit bacdae8

File tree

7 files changed

+219
-84
lines changed

7 files changed

+219
-84
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Bug report
33
about: Report a bug and help us improve
4-
title: ''
5-
labels: ''
6-
assignees: ''
7-
4+
title: ""
5+
labels: ""
6+
assignees: ""
87
---
98

109
<!--

.github/ISSUE_TEMPLATE/extension-request.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Extension request
33
about: Request an extension missing from the code-server marketplace
4-
title: ''
4+
title: ""
55
labels: extension-request
66
assignees: cmoog
7-
87
---
98

109
<!--

.github/ISSUE_TEMPLATE/feature-request.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
name: Feature request
33
about: Suggest an idea
4-
title: ''
4+
title: ""
55
labels: feature
6-
assignees: ''
7-
6+
assignees: ""
87
---
98

109
<!--

README.md

+37-9
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,54 @@ For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
1717

1818
## Install
1919

20-
You can easily and securely install code-server with our install script.
20+
You can easily and securely install code-server with our install script on any Linux or macOS machine.
2121

2222
```bash
2323
# First run to print out the install process.
24-
curl -sSL https://get.docker.com/ | sh -s -- --dry-run
24+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
2525
# Now it will actually install.
26-
curl -sSL https://get.docker.com/ | sh -s --
26+
curl -fsSL https://code-server.dev/install.sh | sh
2727
```
2828

29+
```
30+
$ curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run --help
31+
32+
Installs latest code-server on any macOS or Linux system preferring to use the OS package manager.
33+
34+
curl -fsSL https://code-server.dev/install.sh | sh -s --
35+
2936
- For Debian, Ubuntu, Raspbian it will install the latest deb package.
3037
- For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm package.
3138
- For Arch Linux it will install the AUR package.
32-
- For any unrecognized Linux operating system it will install the latest static release into `/usr/local/lib/code-server-X.X.X`.
39+
- 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.
41+
3342
- For macOS it will install the Homebrew package.
34-
- If Homebrew is not installed it will install the latest static release into `/usr/local/lib/code-server-X.X.X`.
43+
- 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.
45+
46+
- If ran on an architecture with no binary releases or outdated libc/libcxx, it will install the
47+
npm package with yarn or npm.
48+
- We only have binary releases for amd64 and arm64 presently.
3549
36-
If ran on an architecture with no binary releases, it will install the npm package with `yarn` or `npm`.
37-
We only have binary releases for `amd64` and `arm64` presently.
50+
--dry-run Enables a dry run where where the steps that would have taken place
51+
are printed but do not actually execute.
52+
53+
--static Forces the installation of a static release into ~/.local
54+
55+
This flag takes an optional argument for the installation prefix which defaults to "~/.local".
56+
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
58+
the full path.
59+
60+
To install system wide set the prefix to /usr/local.
61+
62+
--version Pass to install a specific version instead of the latest release.
63+
```
3864

3965
If you still don't trust our install script, even with the above explaination and the dry run, we have
40-
docs in [./doc/install.md](./doc/install.md) that explain how to install `code-server` each of the above
41-
operating systems. The script runs the exact same commands.
66+
docs in [./doc/install.md](./doc/install.md) that explain how to install `code-server` on a variety of
67+
platforms. The script runs the exact same commands.
4268

4369
### Docker
4470

@@ -53,6 +79,8 @@ docker run -it -p 127.0.0.1:8080:8080 \
5379
codercom/code-server:latest
5480
```
5581

82+
You should also check out
83+
5684
## FAQ
5785

5886
See [./doc/FAQ.md](./doc/FAQ.md).

ci/dev/fmt.sh

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ main() {
2323

2424
doctoc --title '# FAQ' doc/FAQ.md > /dev/null
2525
doctoc --title '# Setup Guide' doc/guide.md > /dev/null
26+
doctoc --title '# Install' doc/install.md > /dev/null
2627

2728
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
2829
echo "Files need generation or are formatted incorrectly:"

doc/install.md

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
1+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
2+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
13
# Install
24

5+
- [Debian, Ubuntu](#debian-ubuntu)
6+
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
7+
- [Arch Linux](#arch-linux)
8+
- [yarn, npm](#yarn-npm)
9+
- [macOS](#macos)
10+
- [Static Releases](#static-releases)
11+
- [Docker](#docker)
12+
13+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
14+
315
This document demonstrates how to install `code-server` on
416
various distros and operating systems.
517

@@ -20,7 +32,7 @@ systemctl --user enable --now code-server
2032
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
2133
```
2234

23-
## Fedora, CentOS, Red Hat, SUSE
35+
## Fedora, CentOS, RHEL, SUSE
2436

2537
```bash
2638
curl -fOL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-amd64.rpm
@@ -49,8 +61,11 @@ systemctl --user enable --now code-server
4961

5062
## yarn, npm
5163

52-
We recommend installing with `yarn` or `npm` if we don't have a precompiled release for your machine's
53-
platform or architecture or your glibc < v2.19.
64+
We recommend installing with `yarn` or `npm` if:
65+
66+
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
5469

5570
**note:** Installing via `yarn` or `npm` builds native modules on install and so requires C dependencies.
5671
See [./doc/npm.md](./doc/npm.md) for installing these dependencies.
@@ -81,15 +96,22 @@ They bundle the node binary and node_modules.
8196
2. Unpack the release.
8297
3. You can run code-server by executing `./bin/code-server`.
8398

84-
Add the code-server `bin` directory to your `$PATH` to easily execute `code-server` without the full path every time.
99+
You can add the code-server `bin` directory to your `$PATH` or link to it from a
100+
directory in your `$PATH` to easily execute `code-server` without the full path every time.
85101

86102
Here is an example script for installing and using a static `code-server` release on Linux:
87103

88104
```bash
105+
mkdir -p ~/.local/lib ~/.local/bin
89106
curl -fL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-linux-amd64.tar.gz \
90-
| sudo tar -C /usr/local/lib -xz
91-
sudo mv /usr/local/lib/code-server-3.3.1-linux-amd64 /usr/local/lib/code-server-3.3.1
92-
PATH="/usr/local/lib/code-server-3.3.1/bin:$PATH"
107+
| tar -C ~/.local/lib -xz
108+
mv ~/.local/lib/code-server-3.3.1-linux-amd64 ~/.local/lib/code-server-3.3.1
109+
ln -s ~/.local/lib/code-server-3.3.1/bin/code-server ~/.local/bin/code-server
110+
PATH="~/.local/bin:$PATH"
93111
code-server
94112
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
95113
```
114+
115+
## Docker
116+
117+
Documented in [README.md](../README.md#docker).

0 commit comments

Comments
 (0)