3 , common-updater-scripts
16 downloadPageUrl = "https://dist.torproject.org";
18 # See https://support.torproject.org/little-t-tor/#fetching-the-tor-developers-key
20 "514102454D0A87DB0767A1EBBE6A0531C18A9179" # Alexander Færøy
21 "B74417EDDF22AC9F9E90F49142E86A2A11F48D36" # David Goulet
22 "2133BC600AB133E1D826D173FE43009C4607B1FB" # Nick Mathewson
26 writeScript "update-tor" ''
31 export PATH=${makeBinPath [
32 common-updater-scripts
41 srcBase=$(curl -L --list-only -- "${downloadPageUrl}" \
42 | grep -Eo 'tor-([[:digit:]]+\.?)+\.tar\.gz' \
46 srcUrl=${downloadPageUrl}/$srcBase
48 srcName=''${srcBase/.tar.gz/}
49 srcVers=(''${srcName//-/ })
50 version=''${srcVers[1]}
52 checksumUrl=$srcUrl.sha256sum
53 checksumFile=''${checksumUrl##*/}
55 sigUrl=$checksumUrl.asc
56 sigFile=''${sigUrl##*/}
58 # upstream does not support byte ranges ...
59 [[ -e "$srcFile" ]] || curl -L -o "$srcFile" -- "$srcUrl"
60 [[ -e "$checksumFile" ]] || curl -L -o "$checksumFile" -- "$checksumUrl"
61 [[ -e "$sigFile" ]] || curl -L -o "$sigFile" -- "$sigUrl"
63 export GNUPGHOME=$PWD/gnupg
64 mkdir -m 700 -p "$GNUPGHOME"
66 gpg --batch --recv-keys ${concatStringsSep " " (map (x: "'${x}'") signingKeys)}
67 gpg --batch --verify "$sigFile" "$checksumFile"
69 sha256sum -c "$checksumFile"
71 update-source-version tor "$version" "$(cut -d ' ' "$checksumFile")"