aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/sdks
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sdks')
-rwxr-xr-xscripts/sdks/agl/db-update19
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/sdks/agl/db-update b/scripts/sdks/agl/db-update
index 68bd26a..7ebd928 100755
--- a/scripts/sdks/agl/db-update
+++ b/scripts/sdks/agl/db-update
@@ -23,6 +23,17 @@ sdksDBFile=${1}
[ "${sdksDBFile}" = "" ] && sdksDBFile=${SDK_ROOT_DIR}/sdks_latest.json
+# Restore previous file on error
+exitCode=0
+trap "OnExit" 0 1 2 15
+OnExit ()
+{
+ if [ "${exitCode}" != "0" ] && [ -f "${sdksDBFile}.old" ]; then
+ echo "Error detected, restore previous database version"
+ mv "${sdksDBFile}.old" "${sdksDBFile}"
+ fi
+}
+
# Backup previous file
[ -f "${sdksDBFile}" ] && mv "${sdksDBFile}" "${sdksDBFile}.old"
@@ -31,4 +42,10 @@ instDir=$(dirname "${sdksDBFile}")
[ ! -d "${instDir}" ] && mkdir -p "${instDir}"
# Get database
-wget -q --connect-timeout=30 "${SDK_DATABASE}" -O "${sdksDBFile}"
+echo "Updating AGL SDK database..."
+wget --no-verbose --connect-timeout=30 "${SDK_DATABASE}" -O "${sdksDBFile}"
+exitCode=$?
+
+[ "${exitCode}" = "0" ] && echo "Done: AGL SDK database is up-to-date"
+
+exit $exitCode