Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
myhjmzy
code-server
提交
510d8489
C
code-server
项目概览
myhjmzy
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
510d8489
编写于
5月 21, 2020
作者:
A
Anmol Sethi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
install.sh: Add our own flag parser
Fully supports long opts!
上级
0129e002
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
219 addition
and
84 deletion
+219
-84
.github/ISSUE_TEMPLATE/bug-report.md
.github/ISSUE_TEMPLATE/bug-report.md
+3
-4
.github/ISSUE_TEMPLATE/extension-request.md
.github/ISSUE_TEMPLATE/extension-request.md
+1
-2
.github/ISSUE_TEMPLATE/feature-request.md
.github/ISSUE_TEMPLATE/feature-request.md
+2
-3
README.md
README.md
+37
-9
ci/dev/fmt.sh
ci/dev/fmt.sh
+1
-0
doc/install.md
doc/install.md
+29
-7
install.sh
install.sh
+146
-59
未找到文件。
.github/ISSUE_TEMPLATE/bug-report.md
浏览文件 @
510d8489
---
name
:
Bug report
about
:
Report a bug and help us improve
title
:
'
'
labels
:
'
'
assignees
:
'
'
title
:
"
"
labels
:
"
"
assignees
:
"
"
---
<!--
...
...
.github/ISSUE_TEMPLATE/extension-request.md
浏览文件 @
510d8489
---
name
:
Extension request
about
:
Request an extension missing from the code-server marketplace
title
:
'
'
title
:
"
"
labels
:
extension-request
assignees
:
cmoog
---
<!--
...
...
.github/ISSUE_TEMPLATE/feature-request.md
浏览文件 @
510d8489
---
name
:
Feature request
about
:
Suggest an idea
title
:
'
'
title
:
"
"
labels
:
feature
assignees
:
'
'
assignees
:
"
"
---
<!--
...
...
README.md
浏览文件 @
510d8489
...
...
@@ -17,28 +17,54 @@ For a full setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
## 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
# 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.
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 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
`/usr/local/lib/code-server-X.X.X`
.
- 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.
- For macOS it will install the Homebrew package.
-
If Homebrew is not installed it will install the latest static release into
`/usr/local/lib/code-server-X.X.X`
.
- 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.
If ran on an architecture with no binary releases, 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
docs in
[
./doc/install.md
](
./doc/install.md
)
that explain how to install
`code-server`
each of the above
operating syste
ms. The script runs the exact same commands.
docs in
[
./doc/install.md
](
./doc/install.md
)
that explain how to install
`code-server`
on a variety of
platfor
ms. The script runs the exact same commands.
### Docker
...
...
@@ -53,6 +79,8 @@ docker run -it -p 127.0.0.1:8080:8080 \
codercom/code-server:latest
```
You should also check out
## FAQ
See
[
./doc/FAQ.md
](
./doc/FAQ.md
)
.
...
...
ci/dev/fmt.sh
浏览文件 @
510d8489
...
...
@@ -23,6 +23,7 @@ main() {
doctoc
--title
'# FAQ'
doc/FAQ.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
echo
"Files need generation or are formatted incorrectly:"
...
...
doc/install.md
浏览文件 @
510d8489
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
# 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
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
```
## Fedora, CentOS, R
ed Hat
, SUSE
## Fedora, CentOS, R
HEL
, SUSE
```
bash
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
We recommend installing with
`yarn`
or
`npm`
if we don't have a precompiled release for your machine's
platform or architecture or your glibc < v2.19.
We recommend installing with
`yarn`
or
`npm`
if:
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.
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.
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:
```
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
\
|
sudo tar
-C
/usr/local/lib
-xz
sudo mv
/usr/local/lib/code-server-3.3.1-linux-amd64 /usr/local/lib/code-server-3.3.1
PATH
=
"/usr/local/lib/code-server-3.3.1/bin:
$PATH
"
|
tar
-C
~/.local/lib
-xz
mv
~/.local/lib/code-server-3.3.1-linux-amd64 ~/.local/lib/code-server-3.3.1
ln
-s
~/.local/lib/code-server-3.3.1/bin/code-server ~/.local/bin/code-server
PATH
=
"~/.local/bin:
$PATH
"
code-server
# 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
)
.
install.sh
浏览文件 @
510d8489
#!/bin/sh
set
-eu
VERSION
=
3.3.1
usage
()
{
cat
<<
EOF
$0
[-
d] [-s] [-p <static-install-prefix>
]
cat
<<
EOF
$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
deb package will be fetched and installed.
curl -fsSL https://code-server.dev/install.sh | sh -s --
If ran on Fedora, CentOS, RHEL or openSUSE then the GitHub releases v
$VERSION
rpm package will be fetched and installed.
- For Debian, Ubuntu, Raspbian it will install the latest deb package.
- 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
package will be installed. However, if Homebrew is not installed then
v
$VERSION
of the macOS static release will be installed
into /usr/local/lib/code-server-
$VERSION
.
- For macOS it will install the Homebrew package.
- 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 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
with yarn or npm. Only amd64 and arm64 are currently supported
.
--dry-run Enables a dry run where where the steps that would have taken place
are printed but do not actually execute
.
If ran on any other Linux distro, v
$VERSION
of the linux static release
will be installed into /usr/local/lib/code-server-
$VERSION
.
--version Pass to install a specific version instead of the latest release.
-d 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
-s Forces the installation of a static release into /usr/local/lib/code-server-
$VERSION
Set the -p flag to change the installation prefix from /usr/local/lib
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.
-p Sets the installation prefix for a static release instal
l.
To install system wide set the prefix to /usr/loca
l.
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
cat
<<
EOF
cat
<<
EOF
Static release has been installed into
$STATIC_INSTALL_PREFIX
/code-server-
$VERSION
Please extend your path to use code-server:
PATH="
$STATIC_INSTALL_PREFIX
/code-server-
$VERSION
/bin:
\$
PATH"
...
...
@@ -52,7 +59,7 @@ EOF
echo_systemd_postinstall
()
{
echo
cat
<<
EOF
cat
<<
EOF
To have systemd start code-server now and restart on boot:
systemctl --user enable --now code-server
Or, if you don't want/need a background service you can run:
...
...
@@ -61,20 +68,66 @@ EOF
}
main
()
{
unset
DRY_RUN STATIC STATIC_INSTALL_PREFIX SKIP_LOG
while
getopts
":dsp:h"
opt
;
do
case
"
$opt
"
in
d
)
DRY_RUN
=
1
;;
s
)
STATIC
=
1
;;
p
)
STATIC_INSTALL_PREFIX
=
"
$OPTARG
"
;;
h
|
?
)
usage
;;
if
[
"
${
TRACE
-
}
"
]
;
then
set
-x
fi
unset
\
DRY_RUN
\
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
shift
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
)
"
if
[
!
"
$OS
"
]
;
then
echo
"Unsupported OS
$(
uname
)
."
echo
err
"Unsupported OS
$(
uname
)
."
exit
1
fi
...
...
@@ -83,8 +136,8 @@ main() {
ARCH
=
"
$(
arch
)
"
if
[
!
"
$ARCH
"
]
;
then
if
[
"
${
STATIC
-
}
"
]
;
then
echo
"No static releases available for the architecture
$(
uname
-m
)
."
echo
"Please rerun without the -s flag to install from npm."
echo
err
"No static releases available for the architecture
$(
uname
-m
)
."
echo
err
"Please rerun without the -s flag to install from npm."
exit
1
fi
install_npm
...
...
@@ -119,18 +172,34 @@ main() {
esac
}
install_macos
()
{
if
command_exists brew
;
then
echo
"Installing from Homebrew."
sh_c brew
install
code-server
parse_arg
()
{
case
"
$1
"
in
*
=
*
)
opt
=
"
${
1
#=*
}
"
optarg
=
"
${
1
#*=
}
"
if
[
!
"
$optarg
"
-a
!
"
${
OPTIONAL
-
}
"
]
;
then
echoerr
"
$opt
requires an argument"
echoerr
"Run with --help to see usage."
exit
1
fi
echo
"
$optarg
"
return
fi
echo
"Homebrew is not installed so installing static release."
;;
esac
install_static
case
"
${
2
-
}
"
in
""
|
-
*
|
--
*
)
if
[
!
"
${
OPTIONAL
-
}
"
]
;
then
echoerr
"
$1
requires an argument"
echoerr
"Run with --help to see usage."
exit
1
fi
;;
*
)
echo
"
$2
"
return
;;
esac
}
fetch
()
{
...
...
@@ -151,6 +220,20 @@ fetch() {
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
()
{
echo
"Installing v
$VERSION
deb package from GitHub releases."
...
...
@@ -169,7 +252,7 @@ install_rpm() {
echo_systemd_postinstall
}
install_a
rch
()
{
install_a
ur
()
{
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"
...
...
@@ -194,7 +277,7 @@ install_static() {
if
[
!
-d
"
$STATIC_INSTALL_PREFIX
"
]
;
then
echo
echo
"Static release install prefix
$STATIC_INSTALL_PREFIX
does not exist"
echo
err
"Static release install prefix
$STATIC_INSTALL_PREFIX
does not exist"
exit
1
fi
...
...
@@ -212,7 +295,7 @@ install_static() {
}
install_npm
()
{
echo
"No precompiled releases for
$(
uname
-m
)
."
echo
err
"No precompiled releases for
$(
uname
-m
)
."
if
command_exists yarn
;
then
echo
"Installing with yarn."
sh_c yarn global add code-server
--unsafe-perm
...
...
@@ -222,10 +305,10 @@ install_npm() {
sh_c npm
install
-g
code-server
--unsafe-perm
return
fi
echo
echo
"Please install npm or yarn to install code-server!"
echo
"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"
echo
err
echo
err
"Please install npm or yarn to install code-server!"
echo
err
"You will need at least node v12 and a few C build dependencies."
echo
err
"See the docs https://github.com/cdr/code-server#yarn-npm"
exit
1
}
...
...
@@ -303,7 +386,7 @@ arch() {
}
command_exists
()
{
command
-v
"
$@
"
>
/dev/null 2>&1
command
-v
"
$@
"
>
/dev/null 2>&1
}
sh_c
()
{
...
...
@@ -325,14 +408,14 @@ sudo_sh_c() {
sh_c
"su -c '
$*
'"
else
echo
echo
"This script needs to run the following command as root."
echo
"
$*
"
echo
"Please run this script as root or install sudo or su."
echo
err
"This script needs to run the following command as root."
echo
err
"
$*
"
echo
err
"Please run this script as root or install sudo or su."
exit
1
fi
}
cache_dir
()
{
echo_
cache_dir
()
{
if
[
"
${
XDG_CACHE_HOME
-
}
"
]
;
then
echo
"
$XDG_CACHE_HOME
/code-server"
elif
[
"
${
HOME
-
}
"
]
;
then
...
...
@@ -342,4 +425,8 @@ cache_dir() {
fi
}
echoerr
()
{
echo
"
$@
"
>
&2
}
main
"
$@
"
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录