summaryrefslogtreecommitdiffstats
path: root/scripts/sdks/agl/db-update
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-09 14:39:25 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-09 14:39:25 +0100
commit889325999e1755b57631d380a048b365ea26fc37 (patch)
tree7c3f1e61ae319d4a58a902f77f05491007926c93 /scripts/sdks/agl/db-update
parent4119f6ebcabfb4285fb2456f10461cee57c6560a (diff)
Create sdk directory when needed.
Diffstat (limited to 'scripts/sdks/agl/db-update')
-rwxr-xr-xscripts/sdks/agl/db-update6
1 files changed, 6 insertions, 0 deletions
diff --git a/scripts/sdks/agl/db-update b/scripts/sdks/agl/db-update
index 4f8d933..68bd26a 100755
--- a/scripts/sdks/agl/db-update
+++ b/scripts/sdks/agl/db-update
@@ -23,6 +23,12 @@ sdksDBFile=${1}
[ "${sdksDBFile}" = "" ] && sdksDBFile=${SDK_ROOT_DIR}/sdks_latest.json
+# Backup previous file
[ -f "${sdksDBFile}" ] && mv "${sdksDBFile}" "${sdksDBFile}.old"
+# Create destination directory when needed
+instDir=$(dirname "${sdksDBFile}")
+[ ! -d "${instDir}" ] && mkdir -p "${instDir}"
+
+# Get database
wget -q --connect-timeout=30 "${SDK_DATABASE}" -O "${sdksDBFile}"