From 5475214823e7a9deaa7925bb0054c22b233658d1 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Thu, 18 Sep 2014 11:40:49 +0200 Subject: Make update more robust. --- sources/languages/update.sh | 25 +++++++++++++++++++++---- sources/update_all.sh | 2 +- 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'sources') diff --git a/sources/languages/update.sh b/sources/languages/update.sh index adcd965..33f8cab 100755 --- a/sources/languages/update.sh +++ b/sources/languages/update.sh @@ -20,6 +20,23 @@ PROPERTY_ALIASES_FILE="$DIR/PropertyValueAliases.txt" DATECMD='date +%Y-%m-%dT%H:%M:%S' +update_file() { + file=$1 + url=$2 + + if curl --silent --fail --location --time-cond $file --output $file $url; then + return 0 + else + error=$? + if [ "$error" = "22" ]; then + echo "WARNING: Getting ${url} failed. Using old version." + else + echo "ERROR: Could not get ${url}: curl error: $error" + exit 1 + fi + fi +} + if [ "x" = "x$DIR" ]; then echo "Usage: update.sh DIR" exit 1 @@ -44,13 +61,13 @@ echo "`$DATECMD` Running pre.sql..." sqlite3 $DATABASE $DIR/$source/taginfo-$source.db echo "Done." done -- cgit v1.2.3