Created
April 19, 2024 03:08
-
-
Save tienntr/00a05d435690e1da43443c3438c60243 to your computer and use it in GitHub Desktop.
Install VS Code server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eu | |
if [ "$#" -ne 1 ]; then | |
echo "You must pass VS Code commit ID" | |
exit 1 | |
fi | |
COMMIT_ID=$1 | |
TEMP_DIR=$(mktemp -d) | |
echo Files will be downloaded to "${TEMP_DIR}" | |
OLD_DIR=${PWD} | |
cd "${TEMP_DIR}" | |
rm_temp_dir() { | |
echo Removing temporary directory | |
rm -rf "${TEMP_DIR}" | |
} | |
trap rm_temp_dir EXIT INT | |
echo "${COMMIT_ID}" > vscode-commit-id | |
wget --no-verbose --show-progress -O vscode-server-linux-x64.tar.gz "https://update.code.visualstudio.com/commit:${COMMIT_ID}/server-linux-x64/stable" | |
wget --no-verbose --show-progress -O vscode_cli_alpine_x64_cli.tar.gz "https://update.code.visualstudio.com/commit:${COMMIT_ID}/cli-alpine-x64/stable" | |
echo Building directory structure in "${TEMP_DIR}" | |
SERVER_PATH=.vscode-server/cli/servers/Stable-${COMMIT_ID}/server | |
mkdir -p "${SERVER_PATH}" | |
tar --strip-components=1 -C "${SERVER_PATH}" -xf vscode-server-linux-x64.tar.gz | |
tar -C .vscode-server -xf vscode_cli_alpine_x64_cli.tar.gz | |
mv .vscode-server/code ".vscode-server/code-${COMMIT_ID}" | |
echo Moving directory structure to target directory | |
cp -r .vscode-server/. "${HOME}/.vscode-server" | |
cd "${OLD_DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment