Created
October 29, 2021 22:34
-
-
Save OlliV/ad7dbb9dfdc45cdb367519bee47bd5bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
: "${2:?Version} ${1:?Package name}" | |
# e.g. fftw | |
name=${1} | |
# e.g. 3.3.10 | |
ver=${2} | |
arch=${3:-big_sur} | |
outfile="${name}_${ver}-${arch}.tar.gz" | |
echo Downloading ${outfile} | |
digest=$(curl --disable --cookie /dev/null --globoff --show-error --header 'Accept-Language: en' --retry 3 --header 'Accept: application/vnd.oci.image.index.v1+json' --header 'Authorization: Bearer QQ==' --location --silent "https://ghcr.io/v2/homebrew/core/${name}/manifests/${ver}" | jq -r ".manifests[].annotations | select(.[\"org.opencontainers.image.ref.name\"] == \"${ver}.${arch}\") | .[\"sh.brew.bottle.digest\"]") | |
curl -o ${outfile} --disable --cookie /dev/null --globoff --show-error --header 'Accept-Language: en' --retry 3 --header 'Authorization: Bearer QQ==' --location --silent --request GET "https://ghcr.io/v2/homebrew/core/${name}/blobs/sha256:${digest}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment