1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p common-updater-scripts fd jq
7 REPO
="yandex-music-linux"
8 URL
="https://api.github.com/repos/$OWNER/$REPO"
9 RAW
="https://raw.githubusercontent.com/$OWNER/$REPO"
11 latest_release
="$(curl --silent "$URL/releases
/latest
")"
12 latest_tag
="$(curl --silent "$URL/tags?per_page
=1")"
13 commit_hash
="$(jq -r '.[0].commit.sha' <<<"$latest_tag")"
14 tag
=$
(jq
-r '.tag_name' <<<"$latest_release")
18 date=$
(jq
-r '.created_at' <<<"$latest_release")
22 # update version; otherwise fail
23 update-source-version yandex-music
"$version" --ignore-same-hash
25 # set yandex-music dir
26 dir
="pkgs/by-name/ya/yandex-music"
28 # download and save new version of 'exe' file
29 ym_info
=$
(curl
--silent "$RAW/$commit_hash/utility/version_info.json" |\
32 exe_name
="$(jq -r '.exe_name' <<<"$ym_info")"
33 exe_link
="$(jq -r '.exe_link' <<<"$ym_info")"
34 exe_sha256
="$(jq -r '.exe_sha256' <<<"$ym_info")"
35 exe_hash
="$(nix-hash --to-sri --type sha256 "$exe_sha256")"
37 jq
'.' > "$dir/ym_info.json" <<- EOJSON ||\
38 echo "Please run the script in the root of the Nixpkgs repo"
40 "version": "$version",
41 "exe_name": "$exe_name",
42 "exe_link": "$exe_link",
43 "exe_hash": "$exe_hash"