2012-06-15 08:23:33 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-07-03 19:48:19 +00:00
|
|
|
channels_url="http://omahaproxy.appspot.com/";
|
2012-06-15 08:23:33 +00:00
|
|
|
bucket_url="http://commondatastorage.googleapis.com/chromium-browser-official/";
|
2012-07-03 19:48:19 +00:00
|
|
|
output_file="$(cd "$(dirname "$0")" && pwd)/sources.nix";
|
2012-06-15 08:23:33 +00:00
|
|
|
|
2012-07-03 19:48:19 +00:00
|
|
|
get_channels()
|
2012-06-15 08:23:33 +00:00
|
|
|
{
|
2012-07-03 19:48:19 +00:00
|
|
|
for chline in $(echo "$1" | cut -d, -f-2);
|
|
|
|
do
|
|
|
|
channel="${chline%%,*}";
|
|
|
|
version="${chline##*,}";
|
|
|
|
|
|
|
|
url="${bucket_url%/}/chromium-$version.tar.bz2";
|
|
|
|
|
|
|
|
sha256="$(nix-prefetch-url "$url")";
|
|
|
|
|
|
|
|
echo " $channel = {";
|
|
|
|
echo " version = \"$version\";";
|
|
|
|
echo " url = \"$url\";";
|
|
|
|
echo " sha256 = \"$sha256\";";
|
|
|
|
echo " };";
|
|
|
|
done;
|
2012-06-15 08:23:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cd "$(dirname "$0")";
|
|
|
|
|
2012-07-03 19:48:19 +00:00
|
|
|
versions="$(curl -s "$channels_url" | sed -n -e 's/^linux,\(\([^,]\+,\)\{2\}\).*$/\1/p')";
|
2012-06-15 08:23:33 +00:00
|
|
|
|
2012-07-03 19:48:19 +00:00
|
|
|
if [ -e "$output_file" ];
|
|
|
|
then
|
|
|
|
vhash="$(echo "$versions" | sha256sum | cut -d' ' -f1)";
|
|
|
|
old_vhash="$(sed -n 's/# *VHASH: *//p' "$output_file")";
|
|
|
|
|
|
|
|
if [ "x$vhash" = "x$old_vhash" ];
|
|
|
|
then
|
|
|
|
echo "$output_file is already up to date, bailing out." >&2;
|
2012-06-15 08:23:33 +00:00
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
fi;
|
|
|
|
|
2012-07-03 19:48:19 +00:00
|
|
|
channels="$(get_channels "$versions")";
|
2012-06-15 08:23:33 +00:00
|
|
|
|
2012-07-03 19:48:19 +00:00
|
|
|
cat > "$output_file" <<-EOF
|
|
|
|
# This file is autogenerated from update.sh in the same directory.
|
|
|
|
# VHASH: $vhash
|
2012-06-15 08:23:33 +00:00
|
|
|
{
|
2012-07-03 19:48:19 +00:00
|
|
|
$channels
|
2012-06-15 08:23:33 +00:00
|
|
|
}
|
|
|
|
EOF
|