Last active
December 8, 2023 16:42
-
-
Save yerdzxc/c86b00e007d28f2132652a20a382b1e4 to your computer and use it in GitHub Desktop.
if the official one isn't working
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/bash | |
if [[ $(arch) == "x86_64" ]]; then | |
arch="amd64" | |
fi | |
# Get the latest release URL | |
url=$(curl -I https://github.com/coder/code-server/releases/latest | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}') | |
# Get the release tag from the URL | |
tag=$(echo "$url" | sed 's/.*\///;s/^v//') | |
# Set the filename | |
filename="code-server-$tag-linux-$arch" | |
# Download the release | |
echo "Downloading $filename.tar.gz" | |
curl -L -o "/tmp/$filename.tar.gz" "https://github.com/coder/code-server/releases/download/v$tag/$filename.tar.gz" | |
# Extract the release to /tmp/code-server | |
echo "Extracting to /tmp/code-server" | |
tar -xzf "/tmp/$filename.tar.gz" -C /tmp | |
mv "/tmp/$filename" /tmp/code-server | |
rm "/tmp/$filename.tar.gz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment