ondemandnavi-config: Enable Mapbox if MAPBOX_ACCESS_TOKEN is set 72/29572/3
authorScott Murray <scott.murray@konsulko.com>
Fri, 5 Jan 2024 00:56:30 +0000 (19:56 -0500)
committerScott Murray <scott.murray@konsulko.com>
Fri, 5 Jan 2024 16:40:12 +0000 (16:40 +0000)
To avoid needing manual modifications to enable Mapbox support,
rework the ondemandnavi-config recipe to update the configuration
file to enable it if the MAPBOX_ACCESS_TOKEN variable is set,
and remove the placeholder value for MAPBOX_ACCESS_TOKEN.

Bug-AGL: SPEC-5041

Change-Id: Ia6490363b2de6ddf862f25f1c1e0b5eea21c3107
Signed-off-by: Naoto Yamaguchi <naoto.yamaguchi@aisin.co.jp>
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-demo/+/29572
ci-image-build: Jenkins Job builder account
ci-image-boot-test: Jenkins Job builder account
Tested-by: Jenkins Job builder account
recipes-demo/navigation/ondemandnavi-config_1.0.bb

index 212971f..644102e 100644 (file)
@@ -11,11 +11,14 @@ SRC_URI = "file://naviconfig.ini \
 
 inherit allarch
 
 
 inherit allarch
 
-MAPBOX_ACCESS_TOKEN ?= "Please set mapbox access token"
+MAPBOX_ACCESS_TOKEN ?= ""
 
 do_compile[noexec] = "1"
 
 do_install () {
     install -D -m 644 ${WORKDIR}/naviconfig.ini ${D}${sysconfdir}/naviconfig.ini
 
 do_compile[noexec] = "1"
 
 do_install () {
     install -D -m 644 ${WORKDIR}/naviconfig.ini ${D}${sysconfdir}/naviconfig.ini
-    sed -i -e 's/MAPBOX_ACCESS_TOKEN/${MAPBOX_ACCESS_TOKEN}/' ${D}${sysconfdir}/naviconfig.ini
+    if [ -n "${MAPBOX_ACCESS_TOKEN}" ]; then
+        sed -i -e 's/MAPBOX_ACCESS_TOKEN/${MAPBOX_ACCESS_TOKEN}/;s/\("enableOSM":\)true/\1false/' \
+        ${D}${sysconfdir}/naviconfig.ini
+    fi
 }
 }