2022-02-18 00:15:04 +00:00
|
|
|
#! /usr/bin/env nix-shell
|
|
|
|
#! nix-shell update-shell.nix -i bash
|
2020-06-13 06:49:24 +00:00
|
|
|
|
2020-10-16 07:28:17 +00:00
|
|
|
# Update script for the vscode versions and hashes.
|
|
|
|
# Usually doesn't need to be called by hand,
|
|
|
|
# but is called by a bot: https://github.com/samuela/nixpkgs-upkeep/actions
|
|
|
|
# Call it by hand if the bot fails to automatically update the versions.
|
|
|
|
|
2020-09-13 16:09:05 +00:00
|
|
|
set -eou pipefail
|
|
|
|
|
2020-06-13 06:49:24 +00:00
|
|
|
ROOT="$(dirname "$(readlink -f "$0")")"
|
|
|
|
if [ ! -f "$ROOT/vscode.nix" ]; then
|
|
|
|
echo "ERROR: cannot find vscode.nix in $ROOT"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# VSCode
|
|
|
|
|
2021-02-01 12:03:03 +00:00
|
|
|
VSCODE_VER=$(curl --fail --silent https://api.github.com/repos/Microsoft/vscode/releases/latest | jq --raw-output .tag_name)
|
2020-06-13 06:49:24 +00:00
|
|
|
sed -i "s/version = \".*\"/version = \"${VSCODE_VER}\"/" "$ROOT/vscode.nix"
|
|
|
|
|
2022-03-13 09:38:22 +00:00
|
|
|
TEMP_FOLDER=$(mktemp -d)
|
|
|
|
|
2021-07-11 22:46:30 +00:00
|
|
|
VSCODE_X64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-x64/stable"
|
2022-03-13 09:38:22 +00:00
|
|
|
|
|
|
|
# Split output by newlines into Bash array
|
|
|
|
readarray -t VSCODE_X64_LINUX <<< $(nix-prefetch-url --print-path ${VSCODE_X64_LINUX_URL})
|
|
|
|
|
|
|
|
sed -i "s/x86_64-linux = \".\{52\}\"/x86_64-linux = \"${VSCODE_X64_LINUX[0]}\"/" "$ROOT/vscode.nix"
|
|
|
|
|
2023-05-31 15:09:50 +00:00
|
|
|
tar xf ${VSCODE_X64_LINUX[1]} -C $TEMP_FOLDER
|
2022-03-13 09:38:22 +00:00
|
|
|
VSCODE_COMMIT=$(jq --raw-output .commit $TEMP_FOLDER/VSCode-linux-x64/resources/app/product.json)
|
2023-05-31 15:09:50 +00:00
|
|
|
sed -i "s/rev = \".\{40\}\"/rev = \"${VSCODE_COMMIT}\"/" "$ROOT/vscode.nix"
|
2022-03-13 09:38:22 +00:00
|
|
|
|
|
|
|
SERVER_X64_LINUX_URL="https://update.code.visualstudio.com/commit:${VSCODE_COMMIT}/server-linux-x64/stable"
|
|
|
|
SERVER_X64_LINUX_SHA256=$(nix-prefetch-url ${SERVER_X64_LINUX_URL})
|
2023-05-31 15:09:50 +00:00
|
|
|
sed -i "s/sha256 = \".\{51,52\}\"/sha256 = \"${SERVER_X64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
|
2020-06-13 06:49:24 +00:00
|
|
|
|
2021-07-11 22:46:30 +00:00
|
|
|
VSCODE_X64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin/stable"
|
|
|
|
VSCODE_X64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_X64_DARWIN_URL})
|
|
|
|
sed -i "s/x86_64-darwin = \".\{52\}\"/x86_64-darwin = \"${VSCODE_X64_DARWIN_SHA256}\"/" "$ROOT/vscode.nix"
|
2020-12-16 16:40:14 +00:00
|
|
|
|
2021-07-11 22:46:30 +00:00
|
|
|
VSCODE_AARCH64_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-arm64/stable"
|
|
|
|
VSCODE_AARCH64_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_AARCH64_LINUX_URL})
|
|
|
|
sed -i "s/aarch64-linux = \".\{52\}\"/aarch64-linux = \"${VSCODE_AARCH64_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
|
2020-12-16 16:40:14 +00:00
|
|
|
|
2021-07-11 22:46:30 +00:00
|
|
|
VSCODE_AARCH64_DARWIN_URL="https://update.code.visualstudio.com/${VSCODE_VER}/darwin-arm64/stable"
|
|
|
|
VSCODE_AARCH64_DARWIN_SHA256=$(nix-prefetch-url ${VSCODE_AARCH64_DARWIN_URL})
|
|
|
|
sed -i "s/aarch64-darwin = \".\{52\}\"/aarch64-darwin = \"${VSCODE_AARCH64_DARWIN_SHA256}\"/" "$ROOT/vscode.nix"
|
|
|
|
|
|
|
|
VSCODE_ARMV7L_LINUX_URL="https://update.code.visualstudio.com/${VSCODE_VER}/linux-armhf/stable"
|
|
|
|
VSCODE_ARMV7L_LINUX_SHA256=$(nix-prefetch-url ${VSCODE_ARMV7L_LINUX_URL})
|
|
|
|
sed -i "s/armv7l-linux = \".\{52\}\"/armv7l-linux = \"${VSCODE_ARMV7L_LINUX_SHA256}\"/" "$ROOT/vscode.nix"
|