diff options
author | taku0 <mxxouy6x3m_github@tatapa.org> | 2016-12-25 17:35:20 +0900 |
---|---|---|
committer | Rok Garbas <rok@garbas.si> | 2016-12-29 11:19:50 +0100 |
commit | 93d917fa220c159ea2f785ecb967efab2d55a4a6 (patch) | |
tree | c50a55194cc8402fdb0a5303f0587255dae9f89b /pkgs/applications | |
parent | 2f977b4af111288318bab3823e850ebe9aef3af6 (diff) | |
download | nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.tar nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.tar.gz nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.tar.bz2 nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.tar.lz nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.tar.xz nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.tar.zst nixlib-93d917fa220c159ea2f785ecb967efab2d55a4a6.zip |
firefox, thunderbird: add updateScript
Diffstat (limited to 'pkgs/applications')
3 files changed, 77 insertions, 4 deletions
diff --git a/pkgs/applications/networking/browsers/firefox/default.nix b/pkgs/applications/networking/browsers/firefox/default.nix index a170b7fbab82..3b0eb1405169 100644 --- a/pkgs/applications/networking/browsers/firefox/default.nix +++ b/pkgs/applications/networking/browsers/firefox/default.nix @@ -5,6 +5,7 @@ , hunspell, libevent, libstartup_notification, libvpx , cairo, gstreamer, gst_plugins_base, icu, libpng, jemalloc, libpulseaudio , autoconf213, which +, writeScript, xidel, coreutils, gnused, gnugrep, curl, ed , enableGTK3 ? false , debugBuild ? false , # If you want the resulting program to call itself "Firefox" instead @@ -19,7 +20,7 @@ assert stdenv.cc ? libc && stdenv.cc.libc != null; let -common = { pname, version, sha512 }: stdenv.mkDerivation rec { +common = { pname, version, sha512, updateScript }: stdenv.mkDerivation rec { name = "${pname}-unwrapped-${version}"; src = fetchurl { @@ -135,7 +136,7 @@ common = { pname, version, sha512 }: stdenv.mkDerivation rec { }; passthru = { - inherit nspr version; + inherit nspr version updateScript; gtk = gtk2; isFirefox3Like = true; browserName = "firefox"; @@ -148,13 +149,22 @@ in { firefox-unwrapped = common { pname = "firefox"; version = "50.1.0"; - sha512 = "2jwpk3aymkcq9f4xhzc31sb1c90vy3dvyqq2hvw97vk9dw7rgvv2cki10ns5cshbc4k57yd3j8nm7ppy2kw6na6771mj6sbijdjw39p"; + sha512 = "370d2e9b8c4b1b59c3394659c3a7f0f79e6a911ccd9f32095b50b3a22d087132b1f7cb87b734f7497c4381b1df6df80d120b4b87c13eecc425cc66f56acccba5"; + updateScript = import ./update.nix { + name = "firefox"; + inherit writeScript xidel coreutils gnused gnugrep curl ed; + }; }; firefox-esr-unwrapped = common { pname = "firefox-esr"; version = "45.6.0esr"; - sha512 = "086ci461hmz6kdn0ly9dlc723gc117si4a11a1c51gh79hczhahdaxg5s4r3k59rb43gpwxrlvm4wx1aka36bsihnh8a4caxnp72v5r"; + sha512 = "b96c71aeed8a1185a085512f33d454a1735237cd9ddf37c8caa9cc91892eafab0615fc0ca6035f282ca8101489fa84c0de1087d1963c05b64df32b0c86446610"; + updateScript = import ./update.nix { + name = "firefox-esr"; + versionSuffix = "esr"; + inherit writeScript xidel coreutils gnused gnugrep curl ed; + }; }; } diff --git a/pkgs/applications/networking/browsers/firefox/update.nix b/pkgs/applications/networking/browsers/firefox/update.nix new file mode 100644 index 000000000000..33c9f3079181 --- /dev/null +++ b/pkgs/applications/networking/browsers/firefox/update.nix @@ -0,0 +1,54 @@ +{ name +, writeScript +, xidel +, coreutils +, gnused +, gnugrep +, curl +, ed +, sourceSectionRegex ? "${name}-unwrapped = common" +, basePath ? "pkgs/applications/networking/browsers/firefox" +, baseUrl ? "http://archive.mozilla.org/pub/firefox/releases/" +, versionSuffix ? "" +}: + +let + version = (builtins.parseDrvName name).version; +in writeScript "update-${name}" '' + PATH=${coreutils}/bin:${gnused}/bin:${gnugrep}/bin:${xidel}/bin:${curl}/bin:${ed}/bin + + pushd ${basePath} + + url=${baseUrl} + + # retriving latest released version + # - extracts all links from the $url + # - extracts lines only with number and dots followed by a slash + # - removes trailing slash + # - sorts everything with semver in mind + # - picks up latest release + version=`xidel -q $url --extract "//a" | \ + grep "^[0-9.]*${versionSuffix}/$" | \ + sed s/[/]$// | \ + sort --version-sort | \ + tail -n 1` + + shasum=`curl --silent $url$version/SHA512SUMS | grep 'source\.tar\.xz' | cut -d ' ' -f 1` + + ed default.nix <<COMMANDS + # search line + /${sourceSectionRegex}/ + # search version number line + /version/ + # update the version + s/".*"/"$version"/ + # search hash line + /sha512/ + # update the hash + s/".*"/"$shasum"/ + # write then quit + wq + COMMANDS + + popd +'' diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix index cd16b73dc5d6..2ea0f6127de6 100644 --- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix +++ b/pkgs/applications/networking/mailreaders/thunderbird/default.nix @@ -4,6 +4,7 @@ , yasm, mesa, sqlite, unzip, makeWrapper , hunspell, libevent, libstartup_notification, libvpx , cairo, gstreamer, gst_plugins_base, icu +, writeScript, xidel, coreutils, gnused, gnugrep, curl, ed , debugBuild ? false , # If you want the resulting program to call itself "Thunderbird" # instead of "Earlybird", enable this option. However, those @@ -128,4 +129,12 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.pierron maintainers.eelco ]; platforms = platforms.linux; }; + + passthru.updateScript = import ./../../browsers/firefox/update.nix { + name = "thunderbird"; + sourceSectionRegex = "."; + basePath = "pkgs/applications/networking/mailreaders/thunderbird"; + baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/"; + inherit writeScript xidel coreutils gnused gnugrep curl ed; + }; } |