···172172 '';
173173174174 passthru.ffmpegSupport = true;
175175- passthru.updateScript =
176176- let
177177- version = (builtins.parseDrvName name).version;
178178- isBeta = builtins.stringLength version + 1 == builtins.stringLength (builtins.replaceStrings ["b"] ["bb"] version);
179179- in
180180- writeScript "update-firefox-bin" ''
181181- PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin
182182-183183- pushd pkgs/applications/networking/browsers/firefox-bin
184184-185185- tmpfile=`mktemp`
186186- url=http://archive.mozilla.org/pub/firefox/releases/
187187-188188- # retriving latest released version
189189- # - extracts all links from the $url
190190- # - removes . and ..
191191- # - this line remove everything not starting with a number
192192- # - this line sorts everything with semver in mind
193193- # - we remove lines that are mentioning funnelcake
194194- # - this line removes beta version if we are looking for final release
195195- # versions or removes release versions if we are looking for beta
196196- # versions
197197- # - this line pick up latest release
198198- version=`xidel -q $url --extract "//a" | \
199199- sed s"/.$//" | \
200200- grep "^[0-9]" | \
201201- sort --version-sort | \
202202- grep -v "funnelcake" | \
203203- grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \
204204- tail -1`
205205-206206- # this is a list of sha512 and tarballs for both arches
207207- shasums=`curl --silent $url$version/SHA512SUMS`
208208-209209- cat > $tmpfile <<EOF
210210- {
211211- version = "$version";
212212- sources = [
213213- EOF
214214- for arch in linux-x86_64 linux-i686; do
215215- # retriving a list of all tarballs for each arch
216216- # - only select tarballs for current arch
217217- # - only select tarballs for current version
218218- # - rename space with colon so that for loop doesnt
219219- # - inteprets sha and path as 2 lines
220220- for line in `echo "$shasums" | \
221221- grep $arch | \
222222- grep "firefox-$version.tar.bz2$" | \
223223- tr " " ":"`; do
224224- # create an entry for every locale
225225- cat >> $tmpfile <<EOF
226226- { url = "$url$version/`echo $line | cut -d":" -f3`";
227227- locale = "`echo $line | cut -d":" -f3 | sed "s/$arch\///" | sed "s/\/.*//"`";
228228- arch = "$arch";
229229- sha512 = "`echo $line | cut -d":" -f1`";
230230- }
231231- EOF
232232- done
233233- done
234234- cat >> $tmpfile <<EOF
235235- ];
236236- }
237237- EOF
238238-239239- mv $tmpfile ${if isBeta then "beta_" else ""}sources.nix
240240-241241- popd
242242- '';
243243-175175+ passthru.updateScript = import ./update.nix {
176176+ inherit name writeScript xidel coreutils gnused gnugrep curl;
177177+ };
244178 meta = with stdenv.lib; {
245179 description = "Mozilla Firefox, free web browser (binary package)";
246180 homepage = http://www.mozilla.org/firefox/;
···11+{ name
22+, writeScript
33+, xidel
44+, coreutils
55+, gnused
66+, gnugrep
77+, curl
88+, baseName ? "firefox"
99+, basePath ? "pkgs/applications/networking/browsers/firefox-bin"
1010+, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/"
1111+}:
1212+1313+let
1414+ version = (builtins.parseDrvName name).version;
1515+ isBeta = builtins.stringLength version + 1 == builtins.stringLength (builtins.replaceStrings ["b"] ["bb"] version);
1616+in writeScript "update-${baseName}-bin" ''
1717+ PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin
1818+1919+ pushd ${basePath}
2020+2121+ tmpfile=`mktemp`
2222+ url=${baseUrl}
2323+2424+ # retriving latest released version
2525+ # - extracts all links from the $url
2626+ # - removes . and ..
2727+ # - this line remove everything not starting with a number
2828+ # - this line sorts everything with semver in mind
2929+ # - we remove lines that are mentioning funnelcake
3030+ # - this line removes beta version if we are looking for final release
3131+ # versions or removes release versions if we are looking for beta
3232+ # versions
3333+ # - this line pick up latest release
3434+ version=`xidel -q $url --extract "//a" | \
3535+ sed s"/.$//" | \
3636+ grep "^[0-9]" | \
3737+ sort --version-sort | \
3838+ grep -v "funnelcake" | \
3939+ grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \
4040+ tail -1`
4141+4242+ # this is a list of sha512 and tarballs for both arches
4343+ shasums=`curl --silent $url$version/SHA512SUMS`
4444+4545+ cat > $tmpfile <<EOF
4646+ {
4747+ version = "$version";
4848+ sources = [
4949+ EOF
5050+ for arch in linux-x86_64 linux-i686; do
5151+ # retriving a list of all tarballs for each arch
5252+ # - only select tarballs for current arch
5353+ # - only select tarballs for current version
5454+ # - rename space with colon so that for loop doesnt
5555+ # - inteprets sha and path as 2 lines
5656+ for line in `echo "$shasums" | \
5757+ grep $arch | \
5858+ grep "${baseName}-$version.tar.bz2$" | \
5959+ tr " " ":"`; do
6060+ # create an entry for every locale
6161+ cat >> $tmpfile <<EOF
6262+ { url = "$url$version/`echo $line | cut -d":" -f3`";
6363+ locale = "`echo $line | cut -d":" -f3 | sed "s/$arch\///" | sed "s/\/.*//"`";
6464+ arch = "$arch";
6565+ sha512 = "`echo $line | cut -d":" -f1`";
6666+ }
6767+ EOF
6868+ done
6969+ done
7070+ cat >> $tmpfile <<EOF
7171+ ];
7272+ }
7373+ EOF
7474+7575+ mv $tmpfile ${if isBeta then "beta_" else ""}sources.nix
7676+7777+ popd
7878+''