nixpkgs/pkgs/servers/jellyseerr/update.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
950 B
Bash
Raw Normal View History

2023-02-12 18:01:48 +00:00
#!/usr/bin/env nix-shell
2024-06-18 21:57:03 +00:00
#!nix-shell -i bash -p curl jq common-updater-scripts nix prefetch-yarn-deps
2023-02-12 18:01:48 +00:00
2024-06-18 21:57:03 +00:00
set -eu -o pipefail
2023-02-12 18:01:48 +00:00
2024-06-18 21:57:03 +00:00
version=${1:-$(curl -s https://api.github.com/repos/Fallenbagel/jellyseerr/releases/latest | jq --raw-output '.tag_name[1:]')}
update-source-version jellyseerr $version
2023-02-12 18:01:48 +00:00
2024-06-18 21:57:03 +00:00
nix_file=$(nix-instantiate --eval --strict -A "jellyseerr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
nix_dir=$(dirname $nix_file)
cp $(nix-instantiate --eval --expr 'with import ./default.nix { }; "${jellyseerr.src}/package.json"' | sed 's/"//g') $nix_dir
2023-02-12 18:01:48 +00:00
2024-06-18 21:57:03 +00:00
old_yarn_hash=$(nix-instantiate --eval --strict -A "jellyseerr.offlineCache.outputHash" | tr -d '"' | sed -re 's|[+]|\\&|g')
lock_file=$(nix-instantiate --eval --expr 'with import ./default.nix { }; "${jellyseerr.src}/yarn.lock"' | sed 's/"//g')
new_yarn_hash=$(nix hash to-sri --type sha256 $(prefetch-yarn-deps $lock_file))
sed -i "$nix_file" -re "s|\"$old_yarn_hash\"|\"$new_yarn_hash\"|"