This script will download and replace ~/Applications/VSCode-linux-x64
with the latest VS Code Insiders.
- Install
jq
: https://stedolan.github.io/jq/download/ - Place
update-code
somewhere in yourPATH
This script will download and replace ~/Applications/VSCode-linux-x64
with the latest VS Code Insiders.
jq
: https://stedolan.github.io/jq/download/update-code
somewhere in your PATH
#!/usr/bin/env bash | |
APPLICATIONS_PATH="$HOME/Applications" | |
CODE_PATH="$APPLICATIONS_PATH/VSCode-linux-x64" | |
PRODUCT_JSON="$CODE_PATH/resources/app/product.json" | |
[ -f $PRODUCT_JSON ] && VERSION=$(cat $PRODUCT_JSON | jq -r '.commit') || VERSION="latest" | |
UPDATE_URL="https://update.code.visualstudio.com/api/update/linux-x64/insider/$VERSION" | |
echo "Fetching $UPDATE_URL..." | |
UPDATE_RESPONSE_FILE=$(mktemp) | |
UPDATE_RESPONSE_CODE=$(curl --silent --output $UPDATE_RESPONSE_FILE --write-out "%{http_code}" $UPDATE_URL) | |
if [ $UPDATE_RESPONSE_CODE -ne 200 ]; then | |
echo "Got $UPDATE_RESPONSE_CODE from server, update not available" | |
exit 0 | |
fi | |
UPDATE_RESPONSE=$(cat $UPDATE_RESPONSE_FILE) | |
rm $UPDATE_RESPONSE_FILE | |
AVAILABLE_PRODUCT_VERSION=$(echo $UPDATE_RESPONSE | jq -r '.productVersion') | |
HASH=$(echo $UPDATE_RESPONSE | jq -r '.sha256hash') | |
DOWNLOAD_URL=$(echo $UPDATE_RESPONSE | jq -r '.url') | |
echo "Found update: $AVAILABLE_PRODUCT_VERSION" | |
echo "Downloading $DOWNLOAD_URL..." | |
DOWNLOAD_PATH=$(mktemp) | |
curl $DOWNLOAD_URL --output $DOWNLOAD_PATH | |
echo "Downloaded to $DOWNLOAD_PATH" | |
echo -n "Hash check: " | |
echo "$HASH $DOWNLOAD_PATH" | sha256sum -c | |
echo "Removing old version..." | |
rm -rf $CODE_PATH | |
echo "Extracting to $CODE_PATH..." | |
mkdir -p $CODE_PATH | |
tar xzf $DOWNLOAD_PATH -C $APPLICATIONS_PATH | |
rm $DOWNLOAD_PATH |
It looks to me like UPDATE_URL
should look like UPDATE_URL="https://update.code.visualstudio.com/api/update/linux-x64/insider/$VERSION"
, since I got a 301 with it like it is in the gist currently.
EDIT: Just used the build number of a stable version to check and yes, it does work. Please update the script!
Fixed, thanks!
Any time!
How do i install it and apply this to code-insiders ..... i use garuda linux ...kinda new to linux actually......i'm trying to install code-insiders on linux with its tar.gz file....kinda stuck , please help
Forked and working for portable VSCode Insiders on Windows (update with zip): https://gist.github.com/henry701/79a872003e3a399c230f4001518d49f0#file-readme-md
This does not work
Simplified script for stable version: https://gist.github.com/SkeLLLa/8709e1bd57c53668c8b901829368a67c