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/Lidarr/Lidarr/releases/download/v$version/Lidarr.master.$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 ..
/..
/.. lidarr.version
)
30 latestTag
=$
(curl https
://api.github.com
/repos
/Lidarr
/Lidarr
/releases
/latest | jq
-r ".tag_name")
31 latestVersion
="$(expr $latestTag : 'v\(.*\)')"
33 if [[ "$currentVersion" == "$latestVersion" ]]; then
34 echo "Lidarr is up-to-date: ${currentVersion}"
38 updateVersion
$latestVersion
40 updateHash
$latestVersion x64 linux
41 updateHash
$latestVersion arm64 linux
42 updateHash
$latestVersion x64 osx