google-cloud-sdk: add passthru.updateScript (#222631)

authored by Nick Novitski and committed by GitHub 1ead2ab0 a9e05139

+7 -6
+1
pkgs/tools/admin/google-cloud-sdk/default.nix
··· 112 112 113 113 passthru = { 114 114 inherit components withExtraComponents; 115 + updateScript = ./update.sh; 115 116 }; 116 117 117 118 meta = with lib; {
+6 -6
pkgs/tools/admin/google-cloud-sdk/update.sh
··· 1 1 #!/usr/bin/env nix-shell 2 - #! nix-shell -i bash -p nix 2 + #! nix-shell -i bash -p nix jq curl 3 3 4 4 CHANNEL_URL="https://dl.google.com/dl/cloudsdk/channels/rapid" 5 5 BASE_URL="$CHANNEL_URL/downloads/google-cloud-sdk" 6 6 7 - # Version of Google Cloud SDK from 8 - # https://cloud.google.com/sdk/docs/release-notes 9 - VERSION="426.0.0" 7 + PACKAGE_DIR=$(dirname -- "$0") 8 + 9 + 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+")') 10 10 11 11 function genMainSrc() { 12 12 local url="${BASE_URL}-${VERSION}-${1}-${2}.tar.gz" ··· 45 45 echo " };" 46 46 echo "}" 47 47 48 - } >data.nix 48 + } > "${PACKAGE_DIR}/data.nix" 49 49 50 - curl "${CHANNEL_URL}/components-v${VERSION}.json" -w "\n" > components.json 50 + curl "${CHANNEL_URL}/components-v${VERSION}.json" -w "\n" > "${PACKAGE_DIR}/components.json"