2021-03-24 08:18:33 +00:00
|
|
|
#!/usr/bin/env nix-shell
|
2021-03-28 11:36:21 +00:00
|
|
|
#!nix-shell -i bash -p curl gnused nix-prefetch jq
|
2021-03-24 08:18:33 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
dirname="$(dirname "$0")"
|
|
|
|
|
|
|
|
updateHash()
|
|
|
|
{
|
|
|
|
version=$1
|
|
|
|
arch=$2
|
|
|
|
os=$3
|
|
|
|
|
|
|
|
hashKey="${arch}-${os}_hash"
|
|
|
|
|
|
|
|
url="https://github.com/Radarr/Radarr/releases/download/v$version/Radarr.master.$version.$os-core-$arch.tar.gz"
|
|
|
|
hash=$(nix-prefetch-url --type sha256 $url)
|
2022-02-17 22:44:54 +00:00
|
|
|
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
2021-03-24 08:18:33 +00:00
|
|
|
|
2021-03-28 11:36:21 +00:00
|
|
|
sed -i "s|$hashKey = \"[a-zA-Z0-9\/+-=]*\";|$hashKey = \"$sriHash\";|g" "$dirname/default.nix"
|
2021-03-24 08:18:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
updateVersion()
|
|
|
|
{
|
|
|
|
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
|
|
|
|
}
|
|
|
|
|
2022-02-17 22:44:54 +00:00
|
|
|
currentVersion=$(cd $dirname && nix eval --raw -f ../../.. radarr.version)
|
2021-03-24 08:18:33 +00:00
|
|
|
|
|
|
|
latestTag=$(curl https://api.github.com/repos/Radarr/Radarr/releases/latest | jq -r ".tag_name")
|
|
|
|
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
|
|
|
|
|
|
|
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
|
|
|
echo "Radarr is up-to-date: ${currentVersion}"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
updateVersion $latestVersion
|
|
|
|
|
|
|
|
updateHash $latestVersion x64 linux
|
|
|
|
updateHash $latestVersion arm64 linux
|
|
|
|
updateHash $latestVersion x64 osx
|
2023-08-29 18:52:57 +00:00
|
|
|
updateHash $latestVersion arm64 osx
|