2023-05-24 13:37:59 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
|
|
|
#! nix-shell -i bash --keep GITHUB_TOKEN -p nix-prefetch jq
|
|
|
|
|
|
|
|
set -eo pipefail
|
|
|
|
|
|
|
|
curl_args=( '--silent' )
|
|
|
|
|
|
|
|
# optionally takes a GITHUB_TOKEN to overcome api rate limiting.
|
|
|
|
if [ -n "$GITHUB_TOKEN" ]; then curl_args+=( --header "authorization: Bearer ${GITHUB_TOKEN}" ); fi
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# get latest release assets
|
|
|
|
curl_args+=( --url https://api.github.com/repos/adi1090x/plymouth-themes/releases/latest )
|
|
|
|
theme_archives=$(curl "${curl_args[@]}" | jq -r '.assets' )
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
dirname="$(dirname "$0")"
|
|
|
|
|
|
|
|
printf '{\n' > "$dirname/shas.nix"
|
|
|
|
|
|
|
|
while
|
|
|
|
read -r file_path
|
|
|
|
do
|
2023-11-16 04:20:00 +00:00
|
|
|
name="$(basename $file_path)"
|
|
|
|
name="${name/.tar.gz/}"
|
|
|
|
|
|
|
|
printf ' "%s" = {\n url = "%s";\n sha = "%s";\n };\n' "${name}" "$file_path" "$(nix-prefetch-url "$file_path")" >>"$dirname/shas.nix"
|
|
|
|
done < <(jq -r '.[].browser_download_url' <<<"$theme_archives")
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
printf '}\n' >> "$dirname/shas.nix"
|