Skip to content

Commit 976d26a

Browse files
committed
Add FreeBSD support to install script
1 parent 264abed commit 976d26a

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

doc/install.md

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ commands presented in the rest of this document.
7070
- If Homebrew is not installed it will install the latest standalone release into `~/.local`.
7171
- Add `~/.local/bin` to your `$PATH` to run code-server.
7272

73+
- For FreeBSD, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
74+
7375
- If ran on an architecture with no releases, it will install the [npm package](#yarn-npm) with `yarn` or `npm`.
7476
- We only have releases for amd64 and arm64 presently.
7577
- The [npm package](#yarn-npm) builds the native modules on postinstall.

install.sh

+23-3
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Usage:
4848
- If Homebrew is not installed it will install the latest standalone release
4949
into ~/.local
5050
51+
- For FreeBSD, it will install the npm package with yarn or npm.
52+
5153
- If ran on an architecture with no releases, it will install the
5254
npm package with yarn or npm.
5355
- We only have releases for amd64 and arm64 presently.
@@ -160,7 +162,7 @@ main() {
160162
ARCH="$(arch)"
161163
if [ ! "$ARCH" ]; then
162164
if [ "$METHOD" = standalone ]; then
163-
echoerr "No releases available for the architecture $(uname -m)."
165+
echoerr "No precompiled releases for $(uname -m)."
164166
echoerr 'Please rerun without the "--method standalone" flag to install from npm.'
165167
exit 1
166168
fi
@@ -169,6 +171,17 @@ main() {
169171
return
170172
fi
171173

174+
if [ "$OS" = "freebsd" ]; then
175+
if [ "$METHOD" = standalone ]; then
176+
echoerr "No precompiled releases available for $OS."
177+
echoerr 'Please rerun without the "--method standalone" flag to install from npm.'
178+
exit 1
179+
fi
180+
echoh "No precompiled releases available for $OS."
181+
install_npm
182+
return
183+
fi
184+
172185
CACHE_DIR="$(echo_cache_dir)"
173186

174187
if [ "$METHOD" = standalone ]; then
@@ -360,6 +373,9 @@ os() {
360373
Darwin)
361374
echo macos
362375
;;
376+
FreeBSD)
377+
echo freebsd
378+
;;
363379
esac
364380
}
365381

@@ -371,11 +387,12 @@ os() {
371387
# - centos, fedora, rhel, opensuse
372388
# - alpine
373389
# - arch
390+
# - freebsd
374391
#
375392
# Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.
376393
distro() {
377-
if [ "$(uname)" = "Darwin" ]; then
378-
echo "macos"
394+
if [ "$OS" = "macos" ] || [ "$OS" = "freebsd" ]; then
395+
echo "$OS"
379396
return
380397
fi
381398

@@ -422,6 +439,9 @@ arch() {
422439
x86_64)
423440
echo amd64
424441
;;
442+
amd64) # FreeBSD.
443+
echo amd64
444+
;;
425445
esac
426446
}
427447

0 commit comments

Comments
 (0)