From 777351bce483dbe76694e2d570ac8995e8770ed9 Mon Sep 17 00:00:00 2001 From: aszlig Date: Fri, 14 Jun 2013 14:41:16 +0200 Subject: [PATCH] chromium/updater: Avoid downgrading versions. Previously we have just checked for equality. When going back in history, that way if the history is somewhat out-of-sync, we could end up "updating" to an older version, which we definitely don't want. Signed-off-by: aszlig --- .../networking/browsers/chromium/update.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/chromium/update.sh b/pkgs/applications/networking/browsers/chromium/update.sh index 5c89c8e492ac..0c4881bb3962 100755 --- a/pkgs/applications/networking/browsers/chromium/update.sh +++ b/pkgs/applications/networking/browsers/chromium/update.sh @@ -42,6 +42,17 @@ sha_insert() ver_sha_table="$ver_sha_table $version:$sha256"; } +get_newest_ver() +{ + versions="$(for v in $@; do echo "$v"; done)"; + if oldest="$(echo "$versions" | sort -V 2> /dev/null | tail -n1)"; + then + echo "$oldest"; + else + echo "$versions" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | tail -n1; + fi; +} + if [ -e "$output_file" ]; then get_sha256() @@ -54,7 +65,7 @@ then echo -n "Checking if $oldver ($channel) is up to date..." >&2; - if [ "x$version" != "x$oldver" ]; + if [ "x$(get_newest_ver "$version" "$oldver")" != "x$oldver" ]; then echo " no, getting sha256 for new version $version:" >&2; sha256="$(nix-prefetch-url "$url")" || return 1;