From 00ec1ca642865bc6051d5f62df2e1bed7ba6fd58 Mon Sep 17 00:00:00 2001 From: Anton Gerasimov Date: Thu, 8 Dec 2016 18:03:33 +0100 Subject: Add a recipe deploying credentials on the device --- conf/distro/sota.conf.inc | 2 +- recipes-sota/sota-credentials/sota-credentials.bb | 27 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 recipes-sota/sota-credentials/sota-credentials.bb diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc index 30d2ae5..5520154 100644 --- a/conf/distro/sota.conf.inc +++ b/conf/distro/sota.conf.inc @@ -1,4 +1,4 @@ -IMAGE_INSTALL_append = " ostree rvi-sota-client" +IMAGE_INSTALL_append = " ostree rvi-sota-client sota-credentials" # live image for OSTree-enabled systems IMAGE_CLASSES_append = " image_types_ostree image_types_ota" diff --git a/recipes-sota/sota-credentials/sota-credentials.bb b/recipes-sota/sota-credentials/sota-credentials.bb new file mode 100644 index 0000000..f523f21 --- /dev/null +++ b/recipes-sota/sota-credentials/sota-credentials.bb @@ -0,0 +1,27 @@ +SUMMARY = "Deploy SOTA credentials on the defice" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" + +FILES_${PN} += "${sysconfdir}/sota.toml" + +ALLOW_EMPTY_${PN} = "1" + +export SOTA_CREDENTIALS + +do_install() { + if [ -n "$SOTA_CREDENTIALS" ]; then + if [ -f "$SOTA_CREDENTIALS" ]; then + EXT=`basename $SOTA_CREDENTIALS | cut -d'.' -f2` + if [ "$EXT" != "toml" ]; then + bbwarn "File\'s extension is not \'toml\', make sure you have the correct file" + fi + + install -d ${D}${sysconfdir} + cat $SOTA_CREDENTIALS | sed 's/^package_manager = .*$/package_manager = "ostree"/' > ${D}${sysconfdir}/sota.toml + chmod 644 ${D}${sysconfdir}/sota.toml + else + bberror "File $SOTA_CREDENTIALS does not exist" + fi + fi +} + -- cgit v1.2.3-54-g00ecf