summaryrefslogtreecommitdiffstats
path: root/scripts/sdks/agl/db-update
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-04-04 21:11:07 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-04-05 01:30:31 +0200
commit607fa1dcb03e482415cf70a50fcd094c8bd88c9d (patch)
tree567b0e2dbe5ec5dd7668b668b30c71e2a6091e3e /scripts/sdks/agl/db-update
parent4a199b578b3bdfca70cdbb1ecd399fda90116087 (diff)
Fixed sdk uuid setting during install [SPEC-1377]
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
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"