mirror of https://github.com/coder/code-server.git
install.sh: Add our own flag parser
Fully supports long opts!
This commit is contained in:
parent
0129e002e8
commit
510d84898c
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Report a bug and help us improve
|
about: Report a bug and help us improve
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Extension request
|
name: Extension request
|
||||||
about: Request an extension missing from the code-server marketplace
|
about: Request an extension missing from the code-server marketplace
|
||||||
title: ''
|
title: ""
|
||||||
labels: extension-request
|
labels: extension-request
|
||||||
assignees: cmoog
|
assignees: cmoog
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Feature request
|
name: Feature request
|
||||||
about: Suggest an idea
|
about: Suggest an idea
|
||||||
title: ''
|
title: ""
|
||||||
labels: feature
|
labels: feature
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
48
README.md
48
README.md
|
@ -17,28 +17,54 @@ For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
You can easily and securely install code-server with our install script.
|
You can easily and securely install code-server with our install script on any Linux or macOS machine.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# First run to print out the install process.
|
# First run to print out the install process.
|
||||||
curl -sSL https://get.docker.com/ | sh -s -- --dry-run
|
curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run
|
||||||
# Now it will actually install.
|
# Now it will actually install.
|
||||||
curl -sSL https://get.docker.com/ | sh -s --
|
curl -fsSL https://code-server.dev/install.sh | sh
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```
|
||||||
|
$ curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run --help
|
||||||
|
|
||||||
|
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 --
|
||||||
|
|
||||||
- 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.
|
||||||
- For any unrecognized Linux operating system it will install the latest static release into `/usr/local/lib/code-server-X.X.X`.
|
- For any unrecognized Linux operating system it will install the latest static release into ~/.local
|
||||||
- For macOS it will install the Homebrew package.
|
- Add ~/.local/bin to your $PATH to run code-server.
|
||||||
- If Homebrew is not installed it will install the latest static release into `/usr/local/lib/code-server-X.X.X`.
|
|
||||||
|
|
||||||
If ran on an architecture with no binary releases, it will install the npm package with `yarn` or `npm`.
|
- For macOS it will install the Homebrew package.
|
||||||
We only have binary releases for `amd64` and `arm64` presently.
|
- If Homebrew is not installed it will install the latest static release into ~/.local
|
||||||
|
- 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
|
||||||
|
npm package with yarn or npm.
|
||||||
|
- 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
|
||||||
|
are printed but do not actually execute.
|
||||||
|
|
||||||
|
--static Forces the installation of a static release into ~/.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
|
||||||
|
into "~/.local/bin/code-server". You will need to add ~/.local/bin to your $PATH to use it without
|
||||||
|
the full path.
|
||||||
|
|
||||||
|
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
|
||||||
docs in [./doc/install.md](./doc/install.md) that explain how to install `code-server` each of the above
|
docs in [./doc/install.md](./doc/install.md) that explain how to install `code-server` on a variety of
|
||||||
operating systems. The script runs the exact same commands.
|
platforms. The script runs the exact same commands.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
|
@ -53,6 +79,8 @@ docker run -it -p 127.0.0.1:8080:8080 \
|
||||||
codercom/code-server:latest
|
codercom/code-server:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You should also check out
|
||||||
|
|
||||||
## FAQ
|
## FAQ
|
||||||
|
|
||||||
See [./doc/FAQ.md](./doc/FAQ.md).
|
See [./doc/FAQ.md](./doc/FAQ.md).
|
||||||
|
|
|
@ -23,6 +23,7 @@ main() {
|
||||||
|
|
||||||
doctoc --title '# FAQ' doc/FAQ.md > /dev/null
|
doctoc --title '# FAQ' doc/FAQ.md > /dev/null
|
||||||
doctoc --title '# Setup Guide' doc/guide.md > /dev/null
|
doctoc --title '# Setup Guide' doc/guide.md > /dev/null
|
||||||
|
doctoc --title '# Install' doc/install.md > /dev/null
|
||||||
|
|
||||||
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
|
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
|
||||||
echo "Files need generation or are formatted incorrectly:"
|
echo "Files need generation or are formatted incorrectly:"
|
||||||
|
|
|
@ -1,5 +1,17 @@
|
||||||
|
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||||
# Install
|
# Install
|
||||||
|
|
||||||
|
- [Debian, Ubuntu](#debian-ubuntu)
|
||||||
|
- [Fedora, CentOS, RHEL, SUSE](#fedora-centos-rhel-suse)
|
||||||
|
- [Arch Linux](#arch-linux)
|
||||||
|
- [yarn, npm](#yarn-npm)
|
||||||
|
- [macOS](#macos)
|
||||||
|
- [Static Releases](#static-releases)
|
||||||
|
- [Docker](#docker)
|
||||||
|
|
||||||
|
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||||
|
|
||||||
This document demonstrates how to install `code-server` on
|
This document demonstrates how to install `code-server` on
|
||||||
various distros and operating systems.
|
various distros and operating systems.
|
||||||
|
|
||||||
|
@ -20,7 +32,7 @@ systemctl --user enable --now code-server
|
||||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Fedora, CentOS, Red Hat, SUSE
|
## Fedora, CentOS, RHEL, SUSE
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -fOL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-amd64.rpm
|
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
|
||||||
|
|
||||||
## yarn, npm
|
## yarn, npm
|
||||||
|
|
||||||
We recommend installing with `yarn` or `npm` if we don't have a precompiled release for your machine's
|
We recommend installing with `yarn` or `npm` if:
|
||||||
platform or architecture or your glibc < v2.19.
|
|
||||||
|
1. We don't have a precompiled release for your machine's platform or architecture.
|
||||||
|
2. libc < v2.19
|
||||||
|
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.
|
||||||
|
@ -81,15 +96,22 @@ They bundle the node binary and node_modules.
|
||||||
2. Unpack the release.
|
2. Unpack the release.
|
||||||
3. You can run code-server by executing `./bin/code-server`.
|
3. You can run code-server by executing `./bin/code-server`.
|
||||||
|
|
||||||
Add the code-server `bin` directory to your `$PATH` to easily execute `code-server` without the full path every time.
|
You can add the code-server `bin` directory to your `$PATH` or link to it from a
|
||||||
|
directory in your `$PATH` to easily execute `code-server` without the full path every time.
|
||||||
|
|
||||||
Here is an example script for installing and using a static `code-server` release on Linux:
|
Here is an example script for installing and using a static `code-server` release on Linux:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
mkdir -p ~/.local/lib ~/.local/bin
|
||||||
curl -fL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-linux-amd64.tar.gz \
|
curl -fL https://github.com/cdr/code-server/releases/download/v3.3.1/code-server-3.3.1-linux-amd64.tar.gz \
|
||||||
| sudo tar -C /usr/local/lib -xz
|
| tar -C ~/.local/lib -xz
|
||||||
sudo mv /usr/local/lib/code-server-3.3.1-linux-amd64 /usr/local/lib/code-server-3.3.1
|
mv ~/.local/lib/code-server-3.3.1-linux-amd64 ~/.local/lib/code-server-3.3.1
|
||||||
PATH="/usr/local/lib/code-server-3.3.1/bin:$PATH"
|
ln -s ~/.local/lib/code-server-3.3.1/bin/code-server ~/.local/bin/code-server
|
||||||
|
PATH="~/.local/bin:$PATH"
|
||||||
code-server
|
code-server
|
||||||
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
Documented in [README.md](../README.md#docker).
|
||||||
|
|
199
install.sh
199
install.sh
|
@ -1,42 +1,49 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
VERSION=3.3.1
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
$0 [-d] [-s] [-p <static-install-prefix>]
|
$0 [--dry-run] [--version X.X.X] [--static <install-prefix>=~/.local]
|
||||||
|
|
||||||
Installs code-server on any macOS or Linux system.
|
Installs latest code-server on any macOS or Linux system preferring to use the OS package manager.
|
||||||
|
|
||||||
If ran on Ubuntu, Debian or Raspbian then the GitHub releases v$VERSION
|
curl -fsSL https://code-server.dev/install.sh | sh -s --
|
||||||
deb package will be fetched and installed.
|
|
||||||
|
|
||||||
If ran on Fedora, CentOS, RHEL or openSUSE then the GitHub releases v$VERSION
|
- For Debian, Ubuntu, Raspbian it will install the latest deb package.
|
||||||
rpm package will be fetched and installed.
|
- For Fedora, CentOS, RHEL, openSUSE it will install the latest rpm 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
|
||||||
|
- Add ~/.local/bin to your \$PATH to run code-server.
|
||||||
|
|
||||||
If ran on macOS and Homebrew is installed then the Homebrew code-server
|
- For macOS it will install the Homebrew package.
|
||||||
package will be installed. However, if Homebrew is not installed then
|
- If Homebrew is not installed it will install the latest static release into ~/.local
|
||||||
v$VERSION of the macOS static release will be installed
|
- Add ~/.local/bin to your \$PATH to run code-server.
|
||||||
into /usr/local/lib/code-server-$VERSION.
|
|
||||||
|
|
||||||
If ran on Arch Linux, then the code-server AUR package will be installed.
|
- If ran on an architecture with no binary releases or outdated libc/libcxx, it will install the
|
||||||
|
npm package with yarn or npm.
|
||||||
|
- We only have binary releases for amd64 and arm64 presently.
|
||||||
|
|
||||||
If ran on an unsupported architecture the npm package will be installed
|
--dry-run Enables a dry run where where the steps that would have taken place
|
||||||
with yarn or npm. Only amd64 and arm64 are currently supported.
|
|
||||||
|
|
||||||
If ran on any other Linux distro, v$VERSION of the linux static release
|
|
||||||
will be installed into /usr/local/lib/code-server-$VERSION.
|
|
||||||
|
|
||||||
-d 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.
|
||||||
|
|
||||||
-s Forces the installation of a static release into /usr/local/lib/code-server-$VERSION
|
--version Pass to install a specific version instead of the latest release.
|
||||||
Set the -p flag to change the installation prefix from /usr/local/lib
|
|
||||||
|
|
||||||
-p Sets the installation prefix for a static release install.
|
--static Forces the installation of a static release into ~/.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
|
||||||
|
into "~/.local/bin/code-server". You will need to add ~/.local/bin to your \$PATH to use it without
|
||||||
|
the full path.
|
||||||
|
|
||||||
|
To install system wide set the prefix to /usr/local.
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
}
|
||||||
|
|
||||||
|
echo_latest_version() {
|
||||||
|
version="$(curl -fsSL https://api.github.com/repos/cdr/code-server/releases/latest | jq -r .tag_name)"
|
||||||
|
# Strip leading v.
|
||||||
|
version="${version:1}"
|
||||||
|
echo "$version"
|
||||||
}
|
}
|
||||||
|
|
||||||
echo_static_postinstall() {
|
echo_static_postinstall() {
|
||||||
|
@ -61,20 +68,66 @@ EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
unset DRY_RUN STATIC STATIC_INSTALL_PREFIX SKIP_LOG
|
if [ "${TRACE-}" ]; then
|
||||||
while getopts ":dsp:h" opt; do
|
set -x
|
||||||
case "$opt" in
|
fi
|
||||||
d) DRY_RUN=1 ;;
|
|
||||||
s) STATIC=1 ;;
|
unset \
|
||||||
p) STATIC_INSTALL_PREFIX="$OPTARG" ;;
|
DRY_RUN \
|
||||||
h | ?) usage ;;
|
STATIC \
|
||||||
|
STATIC_INSTALL_PREFIX \
|
||||||
|
SKIP_LOG \
|
||||||
|
VERSION \
|
||||||
|
OPTIONAL
|
||||||
|
|
||||||
|
while [ "$#" -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
--dry-run)
|
||||||
|
DRY_RUN=1
|
||||||
|
;;
|
||||||
|
--static)
|
||||||
|
STATIC=1
|
||||||
|
if [ "${2-}" ]; then
|
||||||
|
STATIC_INSTALL_PREFIX="$(OPTIONAL=1 parse_arg "$@")"
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
--static=*)
|
||||||
|
STATIC=1
|
||||||
|
STATIC_INSTALL_PREFIX="$(OPTIONAL=1 parse_arg "$@")"
|
||||||
|
;;
|
||||||
|
--version)
|
||||||
|
VERSION="$(parse_arg "$@")"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--version=*)
|
||||||
|
VERSION="$(parse_arg "$@")"
|
||||||
|
;;
|
||||||
|
-h | --h | --help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echoerr "Unknown flag $1"
|
||||||
|
echoerr "Run with --help to see usage."
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
shift
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
|
||||||
|
VERSION="${VERSION-$(echo_latest_version)}"
|
||||||
|
STATIC_INSTALL_PREFIX="${STATIC_INSATLL_PREFIX-$HOME/.local}"
|
||||||
|
|
||||||
|
echo "${DRY_RUN-}"
|
||||||
|
echo "${STATIC_INSTALL_PREFIX-}"
|
||||||
|
echo "${VERSION-}"
|
||||||
|
exit 1
|
||||||
|
|
||||||
OS="$(os)"
|
OS="$(os)"
|
||||||
if [ ! "$OS" ]; then
|
if [ ! "$OS" ]; then
|
||||||
echo "Unsupported OS $(uname)."
|
echoerr "Unsupported OS $(uname)."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -83,8 +136,8 @@ main() {
|
||||||
ARCH="$(arch)"
|
ARCH="$(arch)"
|
||||||
if [ ! "$ARCH" ]; then
|
if [ ! "$ARCH" ]; then
|
||||||
if [ "${STATIC-}" ]; then
|
if [ "${STATIC-}" ]; then
|
||||||
echo "No static releases available for the architecture $(uname -m)."
|
echoerr "No static releases available for the architecture $(uname -m)."
|
||||||
echo "Please rerun without the -s flag to install from npm."
|
echoerr "Please rerun without the -s flag to install from npm."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
install_npm
|
install_npm
|
||||||
|
@ -119,18 +172,34 @@ main() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
install_macos() {
|
parse_arg() {
|
||||||
if command_exists brew; then
|
case "$1" in
|
||||||
echo "Installing from Homebrew."
|
*=*)
|
||||||
|
opt="${1#=*}"
|
||||||
sh_c brew install code-server
|
optarg="${1#*=}"
|
||||||
|
if [ ! "$optarg" -a ! "${OPTIONAL-}" ]; then
|
||||||
return
|
echoerr "$opt requires an argument"
|
||||||
|
echoerr "Run with --help to see usage."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
echo "$optarg"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "Homebrew is not installed so installing static release."
|
case "${2-}" in
|
||||||
|
"" | -* | --*)
|
||||||
install_static
|
if [ ! "${OPTIONAL-}" ]; then
|
||||||
|
echoerr "$1 requires an argument"
|
||||||
|
echoerr "Run with --help to see usage."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$2"
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch() {
|
fetch() {
|
||||||
|
@ -151,6 +220,20 @@ fetch() {
|
||||||
mv "$FILE.incomplete" "$FILE"
|
mv "$FILE.incomplete" "$FILE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
install_macos() {
|
||||||
|
if command_exists brew; then
|
||||||
|
echo "Installing from Homebrew."
|
||||||
|
|
||||||
|
sh_c brew install code-server
|
||||||
|
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Homebrew is not installed so installing static release."
|
||||||
|
|
||||||
|
install_static
|
||||||
|
}
|
||||||
|
|
||||||
install_deb() {
|
install_deb() {
|
||||||
echo "Installing v$VERSION deb package from GitHub releases."
|
echo "Installing v$VERSION deb package from GitHub releases."
|
||||||
|
|
||||||
|
@ -169,7 +252,7 @@ install_rpm() {
|
||||||
echo_systemd_postinstall
|
echo_systemd_postinstall
|
||||||
}
|
}
|
||||||
|
|
||||||
install_arch() {
|
install_aur() {
|
||||||
echo "Installing from the AUR."
|
echo "Installing from the AUR."
|
||||||
|
|
||||||
fetch "https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz" "$CACHE_DIR/code-server-aur.tar.gz"
|
fetch "https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz" "$CACHE_DIR/code-server-aur.tar.gz"
|
||||||
|
@ -194,7 +277,7 @@ install_static() {
|
||||||
|
|
||||||
if [ ! -d "$STATIC_INSTALL_PREFIX" ]; then
|
if [ ! -d "$STATIC_INSTALL_PREFIX" ]; then
|
||||||
echo
|
echo
|
||||||
echo "Static release install prefix $STATIC_INSTALL_PREFIX does not exist"
|
echoerr "Static release install prefix $STATIC_INSTALL_PREFIX does not exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -212,7 +295,7 @@ install_static() {
|
||||||
}
|
}
|
||||||
|
|
||||||
install_npm() {
|
install_npm() {
|
||||||
echo "No precompiled releases for $(uname -m)."
|
echoerr "No precompiled releases for $(uname -m)."
|
||||||
if command_exists yarn; then
|
if command_exists yarn; then
|
||||||
echo "Installing with yarn."
|
echo "Installing with yarn."
|
||||||
sh_c yarn global add code-server --unsafe-perm
|
sh_c yarn global add code-server --unsafe-perm
|
||||||
|
@ -222,10 +305,10 @@ install_npm() {
|
||||||
sh_c npm install -g code-server --unsafe-perm
|
sh_c npm install -g code-server --unsafe-perm
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo
|
echoerr
|
||||||
echo "Please install npm or yarn to install code-server!"
|
echoerr "Please install npm or yarn to install code-server!"
|
||||||
echo "You will need at least node v12 and a few C build dependencies."
|
echoerr "You will need at least node v12 and a few C build dependencies."
|
||||||
echo "See the docs https://github.com/cdr/code-server#yarn-npm"
|
echoerr "See the docs https://github.com/cdr/code-server#yarn-npm"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,14 +408,14 @@ sudo_sh_c() {
|
||||||
sh_c "su -c '$*'"
|
sh_c "su -c '$*'"
|
||||||
else
|
else
|
||||||
echo
|
echo
|
||||||
echo "This script needs to run the following command as root."
|
echoerr "This script needs to run the following command as root."
|
||||||
echo " $*"
|
echoerr " $*"
|
||||||
echo "Please run this script as root or install sudo or su."
|
echoerr "Please run this script as root or install sudo or su."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
cache_dir() {
|
echo_cache_dir() {
|
||||||
if [ "${XDG_CACHE_HOME-}" ]; then
|
if [ "${XDG_CACHE_HOME-}" ]; then
|
||||||
echo "$XDG_CACHE_HOME/code-server"
|
echo "$XDG_CACHE_HOME/code-server"
|
||||||
elif [ "${HOME-}" ]; then
|
elif [ "${HOME-}" ]; then
|
||||||
|
@ -342,4 +425,8 @@ cache_dir() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echoerr() {
|
||||||
|
echo "$@" >&2
|
||||||
|
}
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
|
Loading…
Reference in New Issue