mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-24 05:00:19 +00:00
chromium: Add an update script.
It fetches the latest version based on the bucketlist XML from commondatastorage and generates a "source.nix" which contains an attribute set about where to fetch the latest version. The XML is parsed in a somewhat hackish way using sed, but as this is just an updater, its okay and we don't want to break a fly on the wheel by employing a full XML parser.
This commit is contained in:
parent
b5956ec179
commit
d342672f5a
@ -14,6 +14,8 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
sourceInfo = import ./source.nix;
|
||||||
|
|
||||||
mkGypFlags = with stdenv.lib; let
|
mkGypFlags = with stdenv.lib; let
|
||||||
sanitize = value:
|
sanitize = value:
|
||||||
if value == true then "1"
|
if value == true then "1"
|
||||||
@ -25,11 +27,11 @@ let
|
|||||||
in stdenv.mkDerivation rec {
|
in stdenv.mkDerivation rec {
|
||||||
name = "chromium-${version}";
|
name = "chromium-${version}";
|
||||||
|
|
||||||
version = "21.0.1171.0";
|
version = sourceInfo.version;
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-${version}.tar.bz2";
|
url = sourceInfo.url;
|
||||||
sha256 = "3fd9b2d8895750a4435a585b9c2dc7d34b583c6470ba67eb6ea6c2579f126377";
|
sha256 = sourceInfo.sha256;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
|
34
pkgs/applications/networking/browsers/chromium/update.sh
Executable file
34
pkgs/applications/networking/browsers/chromium/update.sh
Executable file
@ -0,0 +1,34 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
bucket_url="http://commondatastorage.googleapis.com/chromium-browser-official/";
|
||||||
|
|
||||||
|
get_newest_version()
|
||||||
|
{
|
||||||
|
curl -s "$bucket_url" | sed -ne ' H;/<[Kk][Ee][Yy]>chromium-[^<]*</h;${
|
||||||
|
g;s/^.*<Key>chromium-\([^<.]\+\(\.[^<.]\+\)\+\)\.tar\.bz2<.*$/\1/p
|
||||||
|
}';
|
||||||
|
}
|
||||||
|
|
||||||
|
cd "$(dirname "$0")";
|
||||||
|
|
||||||
|
version="$(get_newest_version)";
|
||||||
|
|
||||||
|
if [ -e source.nix ]; then
|
||||||
|
oldver="$(sed -n 's/^ *version *= *"\([^"]\+\)".*$/\1/p' source.nix)";
|
||||||
|
if [ "x$oldver" = "x$version" ]; then
|
||||||
|
echo "Already the newest version: $version" >&2;
|
||||||
|
exit 1;
|
||||||
|
fi;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
url="${bucket_url%/}/chromium-$version.tar.bz2";
|
||||||
|
|
||||||
|
sha256="$(nix-prefetch-url "$url")";
|
||||||
|
|
||||||
|
cat > source.nix <<EOF
|
||||||
|
{
|
||||||
|
version = "$version";
|
||||||
|
url = "$url";
|
||||||
|
sha256 = "$sha256";
|
||||||
|
}
|
||||||
|
EOF
|
Loading…
Reference in New Issue
Block a user