1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnused nix-prefetch jq
6 dirname="$(dirname "$0")"
14 hashKey
="${arch}-${os}_hash"
16 url
="https://github.com/Readarr/Readarr/releases/download/v$version/Readarr.develop.$version.$os-core-$arch.tar.gz"
17 hash=$
(nix-prefetch-url
--type sha256
$url)
18 sriHash
="$(nix hash to-sri --type sha256 $hash)"
20 sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
25 sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
28 currentVersion
=$
(cd $dirname && nix
eval --raw -f ..
/..
/.. readarr.version
)
30 # We cannot use the latest releases as in the past Readarr released old version with v2.0 and then went back to 0.1
31 latestTag
=$
(curl https
://api.github.com
/repos
/Readarr
/Readarr
/releases | jq
-r ".[0].tag_name")
32 latestVersion
="$(expr $latestTag : 'v\(.*\)')"
34 if [[ "$currentVersion" == "$latestVersion" ]]; then
35 echo "Readarr is up-to-date: ${currentVersion}"
39 updateVersion
$latestVersion
41 updateHash
$latestVersion x64 linux
42 updateHash
$latestVersion arm64 linux
43 updateHash
$latestVersion x64 osx