···172 '';
173174 passthru.ffmpegSupport = true;
175- passthru.updateScript =
176- let
177- version = (builtins.parseDrvName name).version;
178- isBeta = builtins.stringLength version + 1 == builtins.stringLength (builtins.replaceStrings ["b"] ["bb"] version);
179- in
180- writeScript "update-firefox-bin" ''
181- PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin
182-183- pushd pkgs/applications/networking/browsers/firefox-bin
184-185- tmpfile=`mktemp`
186- url=http://archive.mozilla.org/pub/firefox/releases/
187-188- # retriving latest released version
189- # - extracts all links from the $url
190- # - removes . and ..
191- # - this line remove everything not starting with a number
192- # - this line sorts everything with semver in mind
193- # - we remove lines that are mentioning funnelcake
194- # - this line removes beta version if we are looking for final release
195- # versions or removes release versions if we are looking for beta
196- # versions
197- # - this line pick up latest release
198- version=`xidel -q $url --extract "//a" | \
199- sed s"/.$//" | \
200- grep "^[0-9]" | \
201- sort --version-sort | \
202- grep -v "funnelcake" | \
203- grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \
204- tail -1`
205-206- # this is a list of sha512 and tarballs for both arches
207- shasums=`curl --silent $url$version/SHA512SUMS`
208-209- cat > $tmpfile <<EOF
210- {
211- version = "$version";
212- sources = [
213- EOF
214- for arch in linux-x86_64 linux-i686; do
215- # retriving a list of all tarballs for each arch
216- # - only select tarballs for current arch
217- # - only select tarballs for current version
218- # - rename space with colon so that for loop doesnt
219- # - inteprets sha and path as 2 lines
220- for line in `echo "$shasums" | \
221- grep $arch | \
222- grep "firefox-$version.tar.bz2$" | \
223- tr " " ":"`; do
224- # create an entry for every locale
225- cat >> $tmpfile <<EOF
226- { url = "$url$version/`echo $line | cut -d":" -f3`";
227- locale = "`echo $line | cut -d":" -f3 | sed "s/$arch\///" | sed "s/\/.*//"`";
228- arch = "$arch";
229- sha512 = "`echo $line | cut -d":" -f1`";
230- }
231- EOF
232- done
233- done
234- cat >> $tmpfile <<EOF
235- ];
236- }
237- EOF
238-239- mv $tmpfile ${if isBeta then "beta_" else ""}sources.nix
240-241- popd
242- '';
243-244 meta = with stdenv.lib; {
245 description = "Mozilla Firefox, free web browser (binary package)";
246 homepage = http://www.mozilla.org/firefox/;
···1+{ name
2+, writeScript
3+, xidel
4+, coreutils
5+, gnused
6+, gnugrep
7+, curl
8+, baseName ? "firefox"
9+, basePath ? "pkgs/applications/networking/browsers/firefox-bin"
10+, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
11+}:
12+13+let
14+ version = (builtins.parseDrvName name).version;
15+ isBeta = builtins.stringLength version + 1 == builtins.stringLength (builtins.replaceStrings ["b"] ["bb"] version);
16+in writeScript "update-${baseName}-bin" ''
17+ PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin
18+19+ pushd ${basePath}
20+21+ tmpfile=`mktemp`
22+ url=${baseUrl}
23+24+ # retriving latest released version
25+ # - extracts all links from the $url
26+ # - removes . and ..
27+ # - this line remove everything not starting with a number
28+ # - this line sorts everything with semver in mind
29+ # - we remove lines that are mentioning funnelcake
30+ # - this line removes beta version if we are looking for final release
31+ # versions or removes release versions if we are looking for beta
32+ # versions
33+ # - this line pick up latest release
34+ version=`xidel -q $url --extract "//a" | \
35+ sed s"/.$//" | \
36+ grep "^[0-9]" | \
37+ sort --version-sort | \
38+ grep -v "funnelcake" | \
39+ grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \
40+ tail -1`
41+42+ # this is a list of sha512 and tarballs for both arches
43+ shasums=`curl --silent $url$version/SHA512SUMS`
44+45+ cat > $tmpfile <<EOF
46+ {
47+ version = "$version";
48+ sources = [
49+ EOF
50+ for arch in linux-x86_64 linux-i686; do
51+ # retriving a list of all tarballs for each arch
52+ # - only select tarballs for current arch
53+ # - only select tarballs for current version
54+ # - rename space with colon so that for loop doesnt
55+ # - inteprets sha and path as 2 lines
56+ for line in `echo "$shasums" | \
57+ grep $arch | \
58+ grep "${baseName}-$version.tar.bz2$" | \
59+ tr " " ":"`; do
60+ # create an entry for every locale
61+ cat >> $tmpfile <<EOF
62+ { url = "$url$version/`echo $line | cut -d":" -f3`";
63+ locale = "`echo $line | cut -d":" -f3 | sed "s/$arch\///" | sed "s/\/.*//"`";
64+ arch = "$arch";
65+ sha512 = "`echo $line | cut -d":" -f1`";
66+ }
67+ EOF
68+ done
69+ done
70+ cat >> $tmpfile <<EOF
71+ ];
72+ }
73+ EOF
74+75+ mv $tmpfile ${if isBeta then "beta_" else ""}sources.nix
76+77+ popd
78+''