1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/applications/networking/browsers/chromium/update.sh
aszlig d342672f5a 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.
2012-06-22 15:53:28 -04:00

35 lines
742 B
Bash
Executable file

#!/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