Skip to content

Instantly share code, notes, and snippets.

@thatrandomperson5
Last active August 27, 2024 17:55
Show Gist options
  • Save thatrandomperson5/231ab631fa3f46152a2db92910d38d4b to your computer and use it in GitHub Desktop.
Save thatrandomperson5/231ab631fa3f46152a2db92910d38d4b to your computer and use it in GitHub Desktop.
VSCode Linux CLI install
echo "Installing VSCode CLI in $PREFIX/bin"
ARCHITECTURE=$(lscpu | grep "Architecture" | tr -d " \t\n\r" | cut -c 14-) # Extract the architecture
URL=""
TAR_LOCATION="$PREFIX/bin/vscode.tar.gz"
if [ "$ARCHITECTURE" = "arm64" ] || [ "$ARCHITECTURE" = "aarch64" ]; then
URL="https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-arm64"
elif [ "$ARCHITECTURE" = "arm32" ]; then
URL="https://code.visualstudio.com/sha/download?build=stable&os=cli-linux-armhf"
elif [ "$ARCHITECTURE" = "x64" ] || [ "$ARCHITECTURE" = "x86_64" ] || [ "$ARCHITECTURE" = "amd64" ]; then
URL="https://code.visualstudio.com/sha/download?build=stable&os=cli-alpine-x64"
fi
echo "Downloading $URL"
curl -sSfL "$URL" -o "$TAR_LOCATION"
FILECOUNT=$(tar -tzf "$TAR_LOCATION" | wc -l)
if [ "$FILECOUNT" != "1" ]; then
exit 1
fi
echo "Extracting $TAR_LOCATION"
tar -xzf "$TAR_LOCATION" -C "$PREFIX/bin"
rm "$TAR_LOCATION"
# Run: curl -sSfL https://gist.githubusercontent.com/thatrandomperson5/231ab631fa3f46152a2db92910d38d4b/raw/install.sh | sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment