summaryrefslogtreecommitdiffstats
path: root/scripts/sdks/agl/db-update
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/sdks/agl/db-update')
-rwxr-xr-xscripts/sdks/agl/db-update14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/sdks/agl/db-update b/scripts/sdks/agl/db-update
index 7ebd928..a1f949e 100755
--- a/scripts/sdks/agl/db-update
+++ b/scripts/sdks/agl/db-update
@@ -34,18 +34,18 @@ OnExit ()
fi
}
-# Backup previous file
-[ -f "${sdksDBFile}" ] && mv "${sdksDBFile}" "${sdksDBFile}.old"
-
# Create destination directory when needed
instDir=$(dirname "${sdksDBFile}")
[ ! -d "${instDir}" ] && mkdir -p "${instDir}"
# Get database
echo "Updating AGL SDK database..."
-wget --no-verbose --connect-timeout=30 "${SDK_DATABASE}" -O "${sdksDBFile}"
-exitCode=$?
+wget --no-verbose --connect-timeout=30 "${SDK_DATABASE}" -O "${sdksDBFile}.new" || exit $?
+
+# Backup previous file
+[ -f "${sdksDBFile}" ] && cp -f "${sdksDBFile}" "${sdksDBFile}.old"
-[ "${exitCode}" = "0" ] && echo "Done: AGL SDK database is up-to-date"
+mv --update "${sdksDBFile}.new" "${sdksDBFile}"
+[ -f "${sdksDBFile}.new" ] && rm -f "${sdksDBFile}.new"
-exit $exitCode
+echo "Done: AGL SDK database is up-to-date"