mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-15 06:14:57 +01:00
7b5e4989ad
https://github.com/Prowlarr/Prowlarr/releases/tag/v1.2.2.2699 This update adds support for aarch64-darwin systems. Refactors the url download logic by relying strictly on the system identifier and using a unified throw that is more informative. Also prowlarr now seems to be doing releases on the master branch, instead of develop. I updated the update script accordingly.
45 lines
1.2 KiB
Bash
Executable file
45 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env nix-shell
|
|
#!nix-shell -i bash -p curl gnused nix-prefetch jq
|
|
|
|
set -eou pipefail
|
|
|
|
dirname="$(dirname "$0")"
|
|
|
|
updateHash()
|
|
{
|
|
# nixos
|
|
version=$1
|
|
system=$2
|
|
|
|
# prowlarr
|
|
arch=$3
|
|
os=$4
|
|
|
|
url="https://github.com/Prowlarr/Prowlarr/releases/download/v$version/Prowlarr.master.$version.$os-core-$arch.tar.gz"
|
|
hash=$(nix-prefetch-url --type sha256 $url)
|
|
sriHash="$(nix hash to-sri --type sha256 $hash)"
|
|
|
|
sed -i "s|$system = \"sha256-[a-zA-Z0-9\/+-=]*\";|$system = \"$sriHash\";|g" "$dirname/default.nix"
|
|
}
|
|
|
|
updateVersion()
|
|
{
|
|
sed -i "s/version = \"[0-9.]*\";/version = \"$1\";/g" "$dirname/default.nix"
|
|
}
|
|
|
|
currentVersion=$(cd $dirname && nix eval --raw -f ../../.. prowlarr.version)
|
|
|
|
latestTag=$(curl https://api.github.com/repos/Prowlarr/Prowlarr/releases/latest | jq -r ".tag_name")
|
|
latestVersion="$(expr $latestTag : 'v\(.*\)')"
|
|
|
|
if [[ "$currentVersion" == "$latestVersion" ]]; then
|
|
echo "Prowlarr is up-to-date: ${currentVersion}"
|
|
exit 0
|
|
fi
|
|
|
|
updateVersion $latestVersion
|
|
|
|
updateHash $latestVersion aarch64-darwin arm64 osx
|
|
updateHash $latestVersion aarch64-linux arm64 linux
|
|
updateHash $latestVersion x86_64-darwin x64 osx
|
|
updateHash $latestVersion x86_64-linux x64 linux
|