4 common-updater-scripts,
15 downloadPageUrl = "https://dist.torproject.org";
17 # See https://support.torproject.org/little-t-tor/#fetching-the-tor-developers-key
19 "514102454D0A87DB0767A1EBBE6A0531C18A9179" # Alexander Færøy
20 "B74417EDDF22AC9F9E90F49142E86A2A11F48D36" # David Goulet
21 "2133BC600AB133E1D826D173FE43009C4607B1FB" # Nick Mathewson
25 writeScript "update-tor" ''
32 common-updater-scripts
42 srcBase=$(curl -L --list-only -- "${downloadPageUrl}" \
43 | grep -Eo 'tor-([[:digit:]]+\.?)+\.tar\.gz' \
47 srcUrl=${downloadPageUrl}/$srcBase
49 srcName=''${srcBase/.tar.gz/}
50 srcVers=(''${srcName//-/ })
51 version=''${srcVers[1]}
53 checksumUrl=$srcUrl.sha256sum
54 checksumFile=''${checksumUrl##*/}
56 sigUrl=$checksumUrl.asc
57 sigFile=''${sigUrl##*/}
59 # upstream does not support byte ranges ...
60 [[ -e "$srcFile" ]] || curl -L -o "$srcFile" -- "$srcUrl"
61 [[ -e "$checksumFile" ]] || curl -L -o "$checksumFile" -- "$checksumUrl"
62 [[ -e "$sigFile" ]] || curl -L -o "$sigFile" -- "$sigUrl"
64 export GNUPGHOME=$PWD/gnupg
65 mkdir -m 700 -p "$GNUPGHOME"
67 gpg --batch --recv-keys ${lib.concatStringsSep " " (map (x: "'${x}'") signingKeys)}
68 gpg --batch --verify "$sigFile" "$checksumFile"
70 sha256sum -c "$checksumFile"
72 update-source-version tor "$version" "$(cut -d ' ' "$checksumFile")"