12 , baseName ? "firefox"
13 , basePath ? "pkgs/applications/networking/browsers/firefox-bin"
22 in writeScript "update-${pname}" ''
24 PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin:${gnupg}/bin
29 export GNUPGHOME=`mktemp -d`
31 curl https://keys.openpgp.org/vks/v1/by-fingerprint/14F26682D0916CDD81E37B6D61B7B526D98F0353 | gpg --import -
36 # retriving latest released version
37 # - extracts all links from the $url
39 # - this line remove everything not starting with a number
40 # - this line sorts everything with semver in mind
41 # - we remove lines that are mentioning funnelcake
42 # - this line removes beta version if we are looking for final release
43 # versions or removes release versions if we are looking for beta
45 # - this line pick up latest release
46 version=`xidel -s $url --extract "//a" | \
49 sort --version-sort | \
50 grep -v "funnelcake" | \
51 grep -e "${lib.optionalString isBeta "b"}\([[:digit:]]\|[[:digit:]][[:digit:]]\)${versionSuffix}$" | ${lib.optionalString (!isBeta) "grep -v \"b\" |"} \
54 curl --silent -o $HOME/shasums "$url$version/SHA256SUMS"
55 curl --silent -o $HOME/shasums.asc "$url$version/SHA256SUMS.asc"
56 gpgv --keyring=$GNUPGHOME/pubring.kbx $HOME/shasums.asc $HOME/shasums
58 # this is a list of sha256 and tarballs for both arches
59 # Upstream files contains python repr strings like b'somehash', hence the sed dance
60 shasums=`cat $HOME/shasums | sed -E s/"b'([a-f0-9]{64})'?(.*)"/'\1\2'/ | grep tar.bz2`
67 for arch in linux-x86_64 linux-i686; do
68 # retriving a list of all tarballs for each arch
69 # - only select tarballs for current arch
70 # - only select tarballs for current version
71 # - rename space with colon so that for loop doesnt
72 # - inteprets sha and path as 2 lines
73 for line in `echo "$shasums" | \
75 grep "${baseName}-$version.tar.bz2$" | \
77 # create an entry for every locale
79 { url = "$url$version/`echo $line | cut -d":" -f3`";
80 locale = "`echo $line | cut -d":" -f3 | sed "s/$arch\///" | sed "s/\/.*//"`";
82 sha256 = "`echo $line | cut -d":" -f1`";
92 mv $tmpfile ${channel}_sources.nix