From 736cab695d5f8ef8fce8230f1495d5d6310f6ec5 Mon Sep 17 00:00:00 2001 From: Mykhaylo Sul Date: Wed, 5 Feb 2020 12:58:57 +0100 Subject: OTA-4388: Conf variable to specify an update type for secondary Signed-off-by: Mykhaylo Sul --- .../demo-config/files/30-ostree-pacman.toml | 2 -- .../demo-config/files/30-pacman-config.toml | 2 ++ recipes-test/demo-config/secondary-config.bb | 22 +++++++++++++++++++--- 3 files changed, 21 insertions(+), 5 deletions(-) delete mode 100644 recipes-test/demo-config/files/30-ostree-pacman.toml create mode 100644 recipes-test/demo-config/files/30-pacman-config.toml diff --git a/recipes-test/demo-config/files/30-ostree-pacman.toml b/recipes-test/demo-config/files/30-ostree-pacman.toml deleted file mode 100644 index d2cf5b8..0000000 --- a/recipes-test/demo-config/files/30-ostree-pacman.toml +++ /dev/null @@ -1,2 +0,0 @@ -[pacman] -type = "ostree" diff --git a/recipes-test/demo-config/files/30-pacman-config.toml b/recipes-test/demo-config/files/30-pacman-config.toml new file mode 100644 index 0000000..750cf5c --- /dev/null +++ b/recipes-test/demo-config/files/30-pacman-config.toml @@ -0,0 +1,2 @@ +[pacman] +type = @UPDATE_TYPE@ diff --git a/recipes-test/demo-config/secondary-config.bb b/recipes-test/demo-config/secondary-config.bb index 58b18df..638f0ae 100644 --- a/recipes-test/demo-config/secondary-config.bb +++ b/recipes-test/demo-config/secondary-config.bb @@ -10,16 +10,32 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" SECONDARY_SERIAL_ID ?= "" SOTA_HARDWARE_ID ?= "${MACHINE}-sndry" SECONDARY_HARDWARE_ID ?= "${SOTA_HARDWARE_ID}" +SECONDARY_UPDATE_TYPE ?= "ostree" + +UPDATE_TYPE = "${SECONDARY_UPDATE_TYPE}" +python () { + update_type = d.getVar('UPDATE_TYPE') + if update_type not in [ 'ostree', 'file']: + bb.fatal('Unsupported type of an update specified for secondary: SECONDARY_UPDATE_TYPE = {}\n' + 'Supported update types are: ostree and file' + .format(update_type)) + + if update_type == 'file': + d.setVar('UPDATE_TYPE', 'none') +} SRC_URI = "\ - file://30-ostree-pacman.toml \ + file://30-pacman-config.toml \ file://35-network-config.toml \ file://45-id-config.toml \ " + do_install () { install -m 0700 -d ${D}${libdir}/sota/conf.d - install -m 0644 ${WORKDIR}/30-ostree-pacman.toml ${D}${libdir}/sota/conf.d/30-ostree-pacman.toml + + install -m 0644 ${WORKDIR}/30-pacman-config.toml ${D}${libdir}/sota/conf.d/30-pacman-config.toml + sed -i -e 's|@UPDATE_TYPE@|${UPDATE_TYPE}|g' ${D}${libdir}/sota/conf.d/30-pacman-config.toml install -m 0644 ${WORKDIR}/35-network-config.toml ${D}${libdir}/sota/conf.d/35-network-config.toml sed -i -e 's|@PORT@|${SECONDARY_PORT}|g' \ @@ -36,7 +52,7 @@ do_install () { FILES_${PN} = " \ ${libdir}/sota/conf.d \ - ${libdir}/sota/conf.d/30-ostree-pacman.toml \ + ${libdir}/sota/conf.d/30-pacman-config.toml \ ${libdir}/sota/conf.d/35-network-config.toml \ ${libdir}/sota/conf.d/45-id-config.toml \ " -- cgit v1.2.3-54-g00ecf