···1+{ lib
2+, writeShellScript
3+, coreutils
4+, gnused
5+, gnugrep
6+, curl
7+, gnupg
8+, nix
9+, common-updater-scripts
10+11+# options
12+, pname
13+, version
14+, meta
15+, baseUrl ? "https://dist.torproject.org/torbrowser/"
16+# prefix used to match published archive
17+, prefix ? "tor-browser-"
18+# suffix used to match published archive
19+, suffix ? "_ALL.tar.xz"
20+}:
21+22+writeShellScript "update-${pname}" ''
23+ PATH="${lib.makeBinPath [ coreutils curl gnugrep gnused gnupg nix common-updater-scripts ]}"
24+ set -euo pipefail
25+26+ trap
27+28+ url=${baseUrl}
29+ version=$(curl -s $url \
30+ | sed -rne 's,^.*href="([0-9]+(\.[0-9]+)*)/".*,\1,p' \
31+ | sort --version-sort | tail -1)
32+33+ if [[ "${version}" = "$version" ]]; then
34+ echo "The new version same as the old version."
35+ exit 0
36+ fi
37+38+ HOME=$(mktemp -d)
39+ export GNUPGHOME=$(mktemp -d)
40+ trap 'rm -rf "$HOME" "$GNUPGHOME"' EXIT
41+42+ gpg --auto-key-locate nodefault,wkd --locate-keys torbrowser@torproject.org
43+ gpg --output $HOME/tor.keyring --export 0xEF6E286DDA85EA2A4BA7DE684E2C6E8793298290
44+45+ curl --silent --show-error --fail -o $HOME/shasums "$url$version/sha256sums-signed-build.txt"
46+ curl --silent --show-error --fail -o $HOME/shasums.asc "$url$version/sha256sums-signed-build.txt.asc"
47+ gpgv --keyring=$HOME/tor.keyring $HOME/shasums.asc $HOME/shasums
48+49+ declare -A platforms=(
50+ ['x86_64-linux']='linux64'
51+ ['i686-linux']='linux32'
52+ )
53+54+ for platform in ${lib.escapeShellArgs meta.platforms}; do
55+ arch="''${platforms[$platform]}"
56+ sha256=$(cat "$HOME/shasums" | grep "${prefix}""$arch-$version""${suffix}" | cut -d" " -f1)
57+ hash=$(nix hash to-sri --type sha256 "$sha256")
58+59+ update-source-version "${pname}" "0" "sha256-${lib.fakeSha256}" --source-key="sources.$platform"
60+ update-source-version "${pname}" "$version" "$hash" --source-key="sources.$platform"
61+ done
62+''
+8
pkgs/applications/video/filebot/default.nix
···1{ lib, stdenv, fetchurl, coreutils, openjdk17, makeWrapper, autoPatchelfHook
2, zlib, libzen, libmediainfo, curlWithGnuTls, libmms, glib
03}:
45let
···42 # Expose the binary in bin to make runnable.
43 ln -s $out/opt/filebot.sh $out/bin/filebot
44 '';
00000004546 meta = with lib; {
47 description = "The ultimate TV and Movie Renamer";
···1{ lib, stdenv, fetchurl, coreutils, openjdk17, makeWrapper, autoPatchelfHook
2, zlib, libzen, libmediainfo, curlWithGnuTls, libmms, glib
3+, genericUpdater, writeShellScript
4}:
56let
···43 # Expose the binary in bin to make runnable.
44 ln -s $out/opt/filebot.sh $out/bin/filebot
45 '';
46+47+ passthru.updateScript = genericUpdater {
48+ versionLister = writeShellScript "filebot-versionLister" ''
49+ curl -s https://www.filebot.net \
50+ | sed -rne 's,^.*FileBot_([0-9]*\.[0-9]+\.[0-9]+)-portable.tar.xz.*,\1,p'
51+ '';
52+ };
5354 meta = with lib; {
55 description = "The ultimate TV and Movie Renamer";