diff --git a/pkgs/applications/networking/browsers/chromium/source/update.nix b/pkgs/applications/networking/browsers/chromium/source/update.nix index 49864cf1c7b..77ebb9488e2 100644 --- a/pkgs/applications/networking/browsers/chromium/source/update.nix +++ b/pkgs/applications/networking/browsers/chromium/source/update.nix @@ -62,14 +62,18 @@ in rec { pname = if channel == "dev" then "google-chrome-unstable" else "google-chrome-${channel}"; - arch = if stdenv.is64bit then "amd64" else "i386"; - relpath = "${pname}/${pname}_${chanAttrs.version}-1_${arch}.deb"; - in lib.optionalAttrs (chanAttrs ? sha256bin64) { - urls = map (url: "${url}/${relpath}") ([ debURL ] ++ debMirrors); - sha256 = if stdenv.is64bit - then chanAttrs.sha256bin64 - else chanAttrs.sha256bin32; - }; + + mkUrls = arch: let + relpath = "${pname}/${pname}_${chanAttrs.version}-1_${arch}.deb"; + in map (url: "${url}/${relpath}") ([ debURL ] ++ debMirrors); + + in if stdenv.is64bit && chanAttrs ? sha256bin64 then { + urls = mkUrls "amd64"; + sha256 = chanAttrs.sha256bin64; + } else if stdenv.is32bit && chanAttrs ? sha256bin32 then { + urls = mkUrls "i386"; + sha256 = chanAttrs.sha256bin64; + } else throw "No Chrome plugins are available for your architecture."; }; updateHelpers = writeText "update-helpers.sh" '' @@ -91,11 +95,15 @@ in rec { deb_pre="${debURL}/$pname/$pname"; - deb32=$(nix-prefetch-url "''${deb_pre}_$version-1_i386.deb"); - deb64=$(nix-prefetch-url "''${deb_pre}_$version-1_amd64.deb"); + deb32="$(nix-prefetch-url "''${deb_pre}_$version-1_i386.deb")" || : + deb64="$(nix-prefetch-url "''${deb_pre}_$version-1_amd64.deb")" || : - echo "$deb32.$deb64"; - return 0; + if [ -n "$deb32" -o -n "$deb64" ]; then + echo "$deb32.$deb64"; + return 0 + else + return 1 + fi } prefetch_sha() diff --git a/pkgs/applications/networking/browsers/chromium/update.sh b/pkgs/applications/networking/browsers/chromium/update.sh index e079762420b..975e141e668 100755 --- a/pkgs/applications/networking/browsers/chromium/update.sh +++ b/pkgs/applications/networking/browsers/chromium/update.sh @@ -77,9 +77,10 @@ get_channel_exprs() echo " $channel = {"; echo " version = \"$version\";"; echo " sha256 = \"$main\";"; - if [ "x${deb#*[a-z0-9].[a-z0-9]}" != "x$deb" ]; - then + if [ "x${deb#[a-z0-9]}" != "x$deb" ]; then echo " sha256bin32 = \"$deb32\";"; + fi; + if [ "x${deb#*.[a-z0-9]}" != "x$deb" ]; then echo " sha256bin64 = \"$deb64\";"; fi; echo " };";