Archived
1
0

Add FreeBSD support to install script

This commit is contained in:
Anmol Sethi 2020-06-13 10:56:50 -04:00
parent 264abed82c
commit 3d9e3b8717
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
4 changed files with 29 additions and 7 deletions

View File

@ -20,7 +20,7 @@ For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
### Quick Install ### Quick Install
We have a [script](./install.sh) to install code-server for Linux and macOS. We have a [script](./install.sh) to install code-server for Linux, macOS and FreeBSD.
It tries to use the system package manager if possible. It tries to use the system package manager if possible.

View File

@ -80,7 +80,7 @@ to avoid the slow dashboard.
## 2. Install code-server ## 2. Install code-server
We have a [script](../install.sh) to install `code-server` for Linux and macOS. We have a [script](../install.sh) to install `code-server` for Linux, macOS and FreeBSD.
It tries to use the system package manager if possible. It tries to use the system package manager if possible.

View File

@ -20,7 +20,7 @@ various distros and operating systems.
## install.sh ## install.sh
We have a [script](../install.sh) to install code-server for Linux and macOS. We have a [script](../install.sh) to install code-server for Linux, macOS and FreeBSD.
It tries to use the system package manager if possible. It tries to use the system package manager if possible.
@ -70,6 +70,8 @@ commands presented in the rest of this document.
- If Homebrew is not installed it will install the latest standalone release into `~/.local`. - If Homebrew is not installed it will install the latest standalone release into `~/.local`.
- Add `~/.local/bin` to your `$PATH` to run code-server. - Add `~/.local/bin` to your `$PATH` to run code-server.
- For FreeBSD, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
- If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`. - If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
- We only have releases for amd64 and arm64 presently. - We only have releases for amd64 and arm64 presently.
- The [npm package](#yarn-npm) builds the native modules on postinstall. - The [npm package](#yarn-npm) builds the native modules on postinstall.

View File

@ -14,7 +14,7 @@ usage() {
fi fi
cath << EOF cath << EOF
Installs code-server for Linux and macOS. Installs code-server for Linux, macOS and FreeBSD.
It tries to use the system package manager if possible. It tries to use the system package manager if possible.
After successful installation it explains how to start using code-server. After successful installation it explains how to start using code-server.
${not_curl_usage-} ${not_curl_usage-}
@ -48,6 +48,8 @@ Usage:
- If Homebrew is not installed it will install the latest standalone release - If Homebrew is not installed it will install the latest standalone release
into ~/.local into ~/.local
- For FreeBSD, it will install the npm package with yarn or npm.
- If ran on an architecture with no releases, it will install the - If ran on an architecture with no releases, it will install the
npm package with yarn or npm. npm package with yarn or npm.
- We only have releases for amd64 and arm64 presently. - We only have releases for amd64 and arm64 presently.
@ -160,7 +162,7 @@ main() {
ARCH="$(arch)" ARCH="$(arch)"
if [ ! "$ARCH" ]; then if [ ! "$ARCH" ]; then
if [ "$METHOD" = standalone ]; then if [ "$METHOD" = standalone ]; then
echoerr "No releases available for the architecture $(uname -m)." echoerr "No precompiled releases for $(uname -m)."
echoerr 'Please rerun without the "--method standalone" flag to install from npm.' echoerr 'Please rerun without the "--method standalone" flag to install from npm.'
exit 1 exit 1
fi fi
@ -169,6 +171,17 @@ main() {
return return
fi fi
if [ "$OS" = "freebsd" ]; then
if [ "$METHOD" = standalone ]; then
echoerr "No precompiled releases available for $OS."
echoerr 'Please rerun without the "--method standalone" flag to install from npm.'
exit 1
fi
echoh "No precompiled releases available for $OS."
install_npm
return
fi
CACHE_DIR="$(echo_cache_dir)" CACHE_DIR="$(echo_cache_dir)"
if [ "$METHOD" = standalone ]; then if [ "$METHOD" = standalone ]; then
@ -360,6 +373,9 @@ os() {
Darwin) Darwin)
echo macos echo macos
;; ;;
FreeBSD)
echo freebsd
;;
esac esac
} }
@ -371,11 +387,12 @@ os() {
# - centos, fedora, rhel, opensuse # - centos, fedora, rhel, opensuse
# - alpine # - alpine
# - arch # - arch
# - freebsd
# #
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120. # Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
distro() { distro() {
if [ "$(uname)" = "Darwin" ]; then if [ "$OS" = "macos" ] || [ "$OS" = "freebsd" ]; then
echo "macos" echo "$OS"
return return
fi fi
@ -422,6 +439,9 @@ arch() {
x86_64) x86_64)
echo amd64 echo amd64
;; ;;
amd64) # FreeBSD.
echo amd64
;;
esac esac
} }