2021-12-06 16:07:01 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
2023-04-29 16:46:19 +00:00
|
|
|
#! nix-shell -i bash -p nix jq curl
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
CHANNEL_URL="https://dl.google.com/dl/cloudsdk/channels/rapid"
|
|
|
|
BASE_URL="$CHANNEL_URL/downloads/google-cloud-sdk"
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
PACKAGE_DIR=$(dirname -- "$0")
|
|
|
|
|
|
|
|
VERSION=$(curl "https://storage.googleapis.com/storage/v1/b/cloud-sdk-release/o?delimiter=/&startOffset=google-cloud-sdk-${UPDATE_NIX_OLD_VERSION}&endOffset=google-cloud-sdk-9" | jq --raw-output '.items[-1].name | scan("\\d+\\.\\d+\\.\\d+")')
|
2021-12-06 16:07:01 +00:00
|
|
|
|
|
|
|
function genMainSrc() {
|
|
|
|
local url="${BASE_URL}-${VERSION}-${1}-${2}.tar.gz"
|
|
|
|
local sha256
|
|
|
|
sha256=$(nix-prefetch-url "$url")
|
|
|
|
echo " {"
|
|
|
|
echo " url = \"${url}\";"
|
|
|
|
echo " sha256 = \"${sha256}\";"
|
|
|
|
echo " };"
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
# DO NOT EDIT! This file is generated automatically by update.sh
|
|
|
|
{ }:
|
|
|
|
{
|
|
|
|
version = "${VERSION}";
|
|
|
|
googleCloudSdkPkgs = {
|
|
|
|
EOF
|
|
|
|
|
|
|
|
echo " x86_64-linux ="
|
|
|
|
genMainSrc "linux" "x86_64"
|
|
|
|
|
|
|
|
echo " x86_64-darwin ="
|
|
|
|
genMainSrc "darwin" "x86_64"
|
|
|
|
|
|
|
|
echo " aarch64-linux ="
|
|
|
|
genMainSrc "linux" "arm"
|
|
|
|
|
|
|
|
echo " aarch64-darwin ="
|
|
|
|
genMainSrc "darwin" "arm"
|
|
|
|
|
|
|
|
echo " i686-linux ="
|
|
|
|
genMainSrc "linux" "x86"
|
|
|
|
|
|
|
|
echo " };"
|
|
|
|
echo "}"
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
} > "${PACKAGE_DIR}/data.nix"
|
2022-09-09 14:08:57 +00:00
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
curl "${CHANNEL_URL}/components-v${VERSION}.json" -w "\n" > "${PACKAGE_DIR}/components.json"
|