1
0
mirror of https://git.tuxpa.in/a/code-server.git synced 2024-12-27 20:55:25 +00:00

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
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.

View File

@ -80,7 +80,7 @@ to avoid the slow dashboard.
## 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.

View File

@ -20,7 +20,7 @@ various distros and operating systems.
## 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.
@ -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`.
- 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`.
- We only have releases for amd64 and arm64 presently.
- The [npm package](#yarn-npm) builds the native modules on postinstall.

View File

@ -14,7 +14,7 @@ usage() {
fi
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.
After successful installation it explains how to start using code-server.
${not_curl_usage-}
@ -48,6 +48,8 @@ Usage:
- If Homebrew is not installed it will install the latest standalone release
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
npm package with yarn or npm.
- We only have releases for amd64 and arm64 presently.
@ -160,7 +162,7 @@ main() {
ARCH="$(arch)"
if [ ! "$ARCH" ]; 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.'
exit 1
fi
@ -169,6 +171,17 @@ main() {
return
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)"
if [ "$METHOD" = standalone ]; then
@ -360,6 +373,9 @@ os() {
Darwin)
echo macos
;;
FreeBSD)
echo freebsd
;;
esac
}
@ -371,11 +387,12 @@ os() {
# - centos, fedora, rhel, opensuse
# - alpine
# - arch
# - freebsd
#
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
distro() {
if [ "$(uname)" = "Darwin" ]; then
echo "macos"
if [ "$OS" = "macos" ] || [ "$OS" = "freebsd" ]; then
echo "$OS"
return
fi
@ -422,6 +439,9 @@ arch() {
x86_64)
echo amd64
;;
amd64) # FreeBSD.
echo amd64
;;
esac
}