同步操作将从 Gitee 极速下载/code-server 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/shset -eu# code-server's automatic install script.# See https://github.com/cdr/code-server/blob/master/doc/install.mdusage() {arg0="0ドル"if [ "0ドル" = sh ]; thenarg0="curl -fsSL https://code-server.dev/install.sh | sh -s --"elsenot_curl_usage="The latest script is available at https://code-server.dev/install.sh"ficath << EOFInstalls 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.Pass in user@host to install code-server on user@host over ssh.The remote host must have internet access.${not_curl_usage-}Usage:$arg0 [--dry-run] [--version X.X.X] [--method detect] \[--prefix ~/.local] [--rsh ssh] [user@host]--dry-runEcho the commands for the install process without running them.--version X.X.XInstall a specific version instead of the latest.--method [detect | standalone]Choose the installation method. Defaults to detect.- detect detects the system package manager and tries to use it.Full reference on the process is further below.- standalone installs a standalone release archive into ~/.localAdd ~/.local/bin to your \$PATH to use it.--prefix <dir>Sets the prefix used by standalone release archives. Defaults to ~/.localThe release is unarchived into ~/.local/lib/code-server-X.X.Xand the binary symlinked into ~/.local/bin/code-serverTo install system wide pass ---prefix=/usr/local--rsh <bin>Specifies the remote shell for remote installation. Defaults to ssh.- For Debian, Ubuntu and Raspbian it will install the latest deb package.- For Fedora, CentOS, RHEL and 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 standalonerelease into ~/.local- For macOS it will install the Homebrew package.- If Homebrew is not installed it will install the latest standalone releaseinto ~/.local- For FreeBSD, it will install the npm package with yarn or npm.- If ran on an architecture with no releases, it will install thenpm package with yarn or npm.- We only have releases for amd64 and arm64 presently.- The npm package builds the native modules on postinstall.It will cache all downloaded assets into ~/.cache/code-serverMore installation docs are at https://github.com/cdr/code-server/blob/master/doc/install.mdEOF}echo_latest_version() {# https://gist.github.com/lukechilds/a83e1d7127b78fef38c2914c4ececc3c#gistcomment-2758860version="$(curl -fsSLI -o /dev/null -w "%{url_effective}" https://github.com/cdr/code-server/releases/latest)"version="${version#https://github.com/cdr/code-server/releases/tag/}"version="${version#v}"echo "$version"}echo_standalone_postinstall() {echohcath << EOFStandalone release has been installed into $STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSIONPlease extend your path to use code-server:PATH="$STANDALONE_INSTALL_PREFIX/bin:\$PATH"Then you can run:code-serverEOF}echo_systemd_postinstall() {echohcath << EOFTo have systemd start code-server now and restart on boot:sudo systemctl enable --now code-server@\$USEROr, if you don't want/need a background service you can run:code-serverEOF}main() {if [ "${TRACE-}" ]; thenset -xfiunset \DRY_RUN \METHOD \STANDALONE_INSTALL_PREFIX \VERSION \OPTIONAL \ALL_FLAGS \RSH_ARGS \RSHALL_FLAGS=""while [ "$#" -gt 0 ]; docase "1ドル" in-*)ALL_FLAGS="${ALL_FLAGS}1ドル";;esaccase "1ドル" in--dry-run)DRY_RUN=1;;--method)METHOD="$(parse_arg "$@")"shift;;--method=*)METHOD="$(parse_arg "$@")";;--prefix)STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")"shift;;--prefix=*)STANDALONE_INSTALL_PREFIX="$(parse_arg "$@")";;--version)VERSION="$(parse_arg "$@")"shift;;--version=*)VERSION="$(parse_arg "$@")";;--rsh)RSH="$(parse_arg "$@")"shift;;--rsh=*)RSH="$(parse_arg "$@")";;-h | --h | -help | --help)usageexit 0;;--)shift# We remove the -- added above.ALL_FLAGS="${ALL_FLAGS% --}"RSH_ARGS="$*"break;;-*)echoerr "Unknown flag 1ドル"echoerr "Run with --help to see usage."exit 1;;*)RSH_ARGS="$*"break;;esacshiftdoneif [ "${RSH_ARGS-}" ]; thenRSH="${RSH-ssh}"echoh "Installing remotely with $RSH$RSH_ARGS"curl -fsSL https://code-server.dev/install.sh | prefix "$RSH_ARGS" "$RSH" "$RSH_ARGS" sh -s -- "$ALL_FLAGS"returnfiVERSION="${VERSION-$(echo_latest_version)}"METHOD="${METHOD-detect}"if [ "$METHOD" != detect ] && [ "$METHOD" != standalone ]; thenechoerr "Unknown install method \"$METHOD\""echoerr "Run with --help to see usage."exit 1fiSTANDALONE_INSTALL_PREFIX="${STANDALONE_INSTALL_PREFIX-$HOME/.local}"OS="$(os)"if [ ! "$OS" ]; thenechoerr "Unsupported OS $(uname)."exit 1fidistro_nameARCH="$(arch)"if [ ! "$ARCH" ]; thenif [ "$METHOD" = standalone ]; thenechoerr "No precompiled releases for $(uname -m)."echoerr 'Please rerun without the "--method standalone" flag to install from npm.'exit 1fiechoh "No precompiled releases for $(uname -m)."install_npmreturnfiif [ "$OS" = "freebsd" ]; thenif [ "$METHOD" = standalone ]; thenechoerr "No precompiled releases available for $OS."echoerr 'Please rerun without the "--method standalone" flag to install from npm.'exit 1fiechoh "No precompiled releases available for $OS."install_npmreturnfiCACHE_DIR="$(echo_cache_dir)"if [ "$METHOD" = standalone ]; theninstall_standalonereturnficase "$(distro)" inmacos)install_macos;;ubuntu | debian | raspbian)install_deb;;centos | fedora | rhel | opensuse)install_rpm;;arch)install_aur;;*)echoh "Unsupported package manager."install_standalone;;esac}parse_arg() {case "1ドル" in*=*)# Remove everything after first equal sign.opt="${1%%=*}"# Remove everything before first equal sign.optarg="${1#*=}"if [ ! "$optarg" ] && [ ! "${OPTIONAL-}" ]; thenechoerr "$opt requires an argument"echoerr "Run with --help to see usage."exit 1fiecho "$optarg"return;;esaccase "${2-}" in"" | -*)if [ ! "${OPTIONAL-}" ]; thenechoerr "1ドル requires an argument"echoerr "Run with --help to see usage."exit 1fi;;*)echo "2ドル"return;;esac}fetch() {URL="1ドル"FILE="2ドル"if [ -e "$FILE" ]; thenechoh "+ Reusing $FILE"returnfish_c mkdir -p "$CACHE_DIR"sh_c curl \-#fL \-o "$FILE.incomplete" \-C - \"$URL"sh_c mv "$FILE.incomplete" "$FILE"}install_macos() {if command_exists brew; thenechoh "Installing from Homebrew."echohsh_c brew install code-serverreturnfiechoh "Homebrew not installed."install_standalone}install_deb() {echoh "Installing v$VERSION deb package from GitHub releases."echohfetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server_${VERSION}_$ARCH.deb" \"$CACHE_DIR/code-server_${VERSION}_$ARCH.deb"sudo_sh_c dpkg -i "$CACHE_DIR/code-server_${VERSION}_$ARCH.deb"echo_systemd_postinstall}install_rpm() {echoh "Installing v$VERSION rpm package from GitHub releases."echohfetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-$ARCH.rpm" \"$CACHE_DIR/code-server-$VERSION-$ARCH.rpm"sudo_sh_c rpm -i "$CACHE_DIR/code-server-$VERSION-$ARCH.rpm"echo_systemd_postinstall}install_aur() {echoh "Installing from the AUR."echohsh_c mkdir -p "$CACHE_DIR/code-server-aur"sh_c "curl -#fsSL https://aur.archlinux.org/cgit/aur.git/snapshot/code-server.tar.gz | tar -xzC $CACHE_DIR/code-server-aur --strip-components 1"echo "+ cd $CACHE_DIR/code-server-aur"if [ ! "${DRY_RUN-}" ]; thencd "$CACHE_DIR/code-server-aur"fish_c makepkg -siecho_systemd_postinstall}install_standalone() {echoh "Installing standalone release archive v$VERSION from GitHub releases."echohfetch "https://github.com/cdr/code-server/releases/download/v$VERSION/code-server-$VERSION-$OS-$ARCH.tar.gz" \"$CACHE_DIR/code-server-$VERSION-$OS-$ARCH.tar.gz"sh_c="sh_c"if [ ! -w "$STANDALONE_INSTALL_PREFIX" ]; thensh_c="sudo_sh_c"fiif [ -e "$STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION" ]; thenechohechoh "code-server-$VERSION is already installed at $STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION"echoh "Remove it to reinstall."exit 0fi"$sh_c" mkdir -p "$STANDALONE_INSTALL_PREFIX/lib" "$STANDALONE_INSTALL_PREFIX/bin""$sh_c" tar -C "$STANDALONE_INSTALL_PREFIX/lib" -xzf "$CACHE_DIR/code-server-$VERSION-$OS-$ARCH.tar.gz""$sh_c" mv -f "$STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION-$OS-$ARCH" "$STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION""$sh_c" ln -fs "$STANDALONE_INSTALL_PREFIX/lib/code-server-$VERSION/bin/code-server" "$STANDALONE_INSTALL_PREFIX/bin/code-server"echo_standalone_postinstall}install_npm() {if command_exists yarn; thensh_c="sh_c"if [ ! -w "$(yarn global bin)" ]; thensh_c="sudo_sh_c"fiechoh "Installing with yarn."echoh"$sh_c" yarn global add code-server --unsafe-permreturnelif command_exists npm; thensh_c="sh_c"if [ ! -w "$(npm config get prefix)" ]; thensh_c="sudo_sh_c"fiechoh "Installing with npm."echoh"$sh_c" npm install -g code-server --unsafe-permreturnfiechohechoerr "Please install npm or yarn to install code-server!"echoerr "You will need at least node v12 and a few C dependencies."echoerr "See the docs https://github.com/cdr/code-server#yarn-npm"exit 1}os() {case "$(uname)" inLinux)echo linux;;Darwin)echo macos;;FreeBSD)echo freebsd;;esac}# distro prints the detected operating system including linux distros.## Example outputs:# - macos# - debian, ubuntu, raspbian# - centos, fedora, rhel, opensuse# - alpine# - arch# - freebsd## Inspired by https://github.com/docker/docker-install/blob/26ff363bcf3b3f5a00498ac43694bf1c7d9ce16c/install.sh#L111-L120.distro() {if [ "$OS" = "macos" ] || [ "$OS" = "freebsd" ]; thenecho "$OS"returnfiif [ -f /etc/os-release ]; then(. /etc/os-releasecase "$ID" in opensuse-*)# opensuse's ID's look like opensuse-leap and opensuse-tumbleweed.echo "opensuse"return;;esacecho "$ID")returnfi}# os_name prints a pretty human readable name for the OS/Distro.distro_name() {if [ "$(uname)" = "Darwin" ]; thenecho "macOS v$(sw_vers -productVersion)"returnfiif [ -f /etc/os-release ]; then(. /etc/os-releaseecho "$PRETTY_NAME")returnfi# Prints something like: Linux 4.19.0-9-amd64uname -sr}arch() {case "$(uname -m)" inaarch64)echo arm64;;x86_64)echo amd64;;amd64) # FreeBSD.echo amd64;;esac}command_exists() {command -v "$@" > /dev/null}sh_c() {echoh "+ $*"if [ ! "${DRY_RUN-}" ]; thensh -c "$*"fi}sudo_sh_c() {if [ "$(id -u)" = 0 ]; thensh_c "$@"elif command_exists sudo; thensh_c "sudo $*"elif command_exists su; thensh_c "su -c '$*'"elseechohechoerr "This script needs to run the following command as root."echoerr " $*"echoerr "Please install sudo or su."exit 1fi}echo_cache_dir() {if [ "${XDG_CACHE_HOME-}" ]; thenecho "$XDG_CACHE_HOME/code-server"elif [ "${HOME-}" ]; thenecho "$HOME/.cache/code-server"elseecho "/tmp/code-server-cache"fi}echoh() {echo "$@" | humanpath}cath() {humanpath}echoerr() {echoh "$@" >&2}# humanpath replaces all occurances of " $HOME" with " ~"# and all occurances of '"$HOME' with the literal '"$HOME'.humanpath() {sed "s# $HOME# ~#g; s#\"$HOME#\"\$HOME#g"}# We need to make sure we exit with a non zero exit if the command fails.# /bin/sh does not support -o pipefail unfortunately.prefix() {PREFIX="1ドル"shiftfifo="$(mktemp -d)/fifo"mkfifo "$fifo"sed -e "s#^#$PREFIX: #" "$fifo" &"$@" > "$fifo" 2>&1}main "$@"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。