1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p curl gnused jq nix-prefetch
7 dirname="$(dirname "$0")"
11 echo "Updating the version..."
12 sed -i "s#version = \"[0-9.]*\"#version = \"$version\"#" "$dirname/package.nix"
21 system
="${arch}-${os}"
22 hashKey
="${system}-hash"
24 echo "Updating the hash for the \`${system}\` system..."
25 url
="https://whisparr.servarr.com/v1/update/nightly/updatefile?runtime=netcore&version=${version}&arch=${arch}&os=${os}"
26 hash=$
(nix-prefetch-url
--type sha256
--name "whisparr-$system-$version.tar.gz" "$url")
27 sriHash
="$(nix hash to-sri --type sha256 "$hash")"
29 sed -i "s#$hashKey = \"[a-zA-Z0-9\/+-=]*\"#$hashKey = \"$sriHash\"#" "$dirname/package.nix"
32 echo "Checking for updates of Whisparr..."
34 currentVersion
=$
(nix
eval --raw -f "$dirname"/..
/..
/..
/.. whisparr.version
)
35 echo "Current version: \`$currentVersion\`."
37 echo "Fetching the latest version..."
39 curl
-s "https://whisparr.servarr.com/v1/update/nightly/changes?runtime=netcore&os=linux" |
43 if [[ "$currentVersion" == "$latestVersion" ]]; then
44 echo "Whisparr is up-to-date."
47 echo "New version is available: \`$latestVersion\`."
50 updateHash
"$latestVersion" arm64 linux
51 updateHash
"$latestVersion" arm64 osx
52 updateHash
"$latestVersion" x64 linux
53 updateHash
"$latestVersion" x64 osx
55 updateVersion
"$latestVersion"