diff options
author | Rok Garbas <rok@garbas.si> | 2016-12-03 17:43:38 +0100 |
---|---|---|
committer | Rok Garbas <rok@garbas.si> | 2016-12-09 03:19:07 +0100 |
commit | d295d6860965622d7e565d3edc2f29a234aa527c (patch) | |
tree | ea43a7a34b59d5c724b0582250f7963d91a4082a /pkgs/applications/networking/browsers | |
parent | 3a1d52ff4f818aa918f429a67bee473192e9d2f1 (diff) | |
download | nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.tar nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.tar.gz nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.tar.bz2 nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.tar.lz nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.tar.xz nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.tar.zst nixlib-d295d6860965622d7e565d3edc2f29a234aa527c.zip |
firefox-bin: updated the updateScript with suggestions from @Mic92
also added some comments to the update script so that a new person looking at it know what is happening
Diffstat (limited to 'pkgs/applications/networking/browsers')
-rw-r--r-- | pkgs/applications/networking/browsers/firefox-bin/default.nix | 50 |
1 files changed, 39 insertions, 11 deletions
diff --git a/pkgs/applications/networking/browsers/firefox-bin/default.nix b/pkgs/applications/networking/browsers/firefox-bin/default.nix index dd767d6984f6..d828a5486fd6 100644 --- a/pkgs/applications/networking/browsers/firefox-bin/default.nix +++ b/pkgs/applications/networking/browsers/firefox-bin/default.nix @@ -184,6 +184,17 @@ stdenv.mkDerivation { tmpfile=`mktemp` url=http://archive.mozilla.org/pub/firefox/releases/ + + # retriving latest released version + # - extracts all links from the $url + # - removes . and .. + # - this line remove everything not starting with a number + # - this line sorts everything with semver in mind + # - we remove lines that are mentioning funnelcake + # - this line removes beta version if we are looking for final release + # versions or removes release versions if we are looking for beta + # versions + # - this line pick up latest release version=`xidel -q $url --extract "//a" | \ sed s"/.$//" | \ grep "^[0-9]" | \ @@ -191,22 +202,39 @@ stdenv.mkDerivation { grep -v "funnelcake" | \ grep -e "${if isBeta then "b" else ""}\([[:digit:]]\|[[:digit:]][[:digit:]]\)$" | ${if isBeta then "" else "grep -v \"b\" |"} \ tail -1` + + # this is a list of sha512 and tarballs for both arches shasums=`curl --silent $url$version/SHA512SUMS` - echo "{" > $tmpfile - echo " version = \"$version\";" >> $tmpfile - echo " sources = [" >> $tmpfile + cat > $tmpfile <<EOF + { + version = "$version"; + sources = [ + EOF for arch in linux-x86_64 linux-i686; do - for line in `echo "$shasums" | grep $arch | grep "firefox-$version.tar.bz2$" | tr " " ":"`; do - echo " { url = \"$url$version/$arch/`echo $line | cut -d\":\" -f3`\";" >> $tmpfile - echo " locale = \"`echo $line | cut -d\":\" -f3 | sed \"s/$arch\///\" | sed \"s/\/.*//\"`\";" >> $tmpfile - echo " arch = \"$arch\";" >> $tmpfile - echo " sha512 = \"`echo $line | cut -d\":\" -f1`\";" >> $tmpfile - echo " }" >> $tmpfile + # retriving a list of all tarballs for each arch + # - only select tarballs for current arch + # - only select tarballs for current version + # - rename space with colon so that for loop doesnt + # - inteprets sha and path as 2 lines + for line in `echo "$shasums" | \ + grep $arch | \ + grep "firefox-$version.tar.bz2$" | \ + tr " " ":"`; do + # create an entry for every locale + cat >> $tmpfile <<EOF + { url = "$url$version/$arch/`echo $line | cut -d":" -f3`";" + locale = "`echo $line | cut -d":" -f3 | sed "s/$arch\///" | sed "s/\/.*//"`"; + arch = "$arch"; + sha512 = "`echo $line | cut -d":" -f1`"; + } + EOF done done - echo " ];" >> $tmpfile - echo "}" >> $tmpfile + cat >> $tmpfile <<EOF + ]; + } + EOF cat $tmpfile > ${if isBeta then "beta_" else ""}sources.nix |