diff options
| author | Anton Gerasimov <anton@advancedtelematic.com> | 2016-12-08 18:03:33 +0100 |
|---|---|---|
| committer | Anton Gerasimov <anton@advancedtelematic.com> | 2016-12-08 18:25:33 +0100 |
| commit | 00ec1ca642865bc6051d5f62df2e1bed7ba6fd58 (patch) | |
| tree | f3dcba0df4f8d6643e88fef514e8a46d88b0d787 | |
| parent | 8450a21f9c60c27a123375bac0ad29d876e2e52e (diff) | |
| download | meta-updater-00ec1ca642865bc6051d5f62df2e1bed7ba6fd58.tar.gz | |
Add a recipe deploying credentials on the device
| -rw-r--r-- | conf/distro/sota.conf.inc | 2 | ||||
| -rw-r--r-- | recipes-sota/sota-credentials/sota-credentials.bb | 27 |
2 files changed, 28 insertions, 1 deletions
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 @@ | |||
| 1 | IMAGE_INSTALL_append = " ostree rvi-sota-client" | 1 | IMAGE_INSTALL_append = " ostree rvi-sota-client sota-credentials" |
| 2 | 2 | ||
| 3 | # live image for OSTree-enabled systems | 3 | # live image for OSTree-enabled systems |
| 4 | IMAGE_CLASSES_append = " image_types_ostree image_types_ota" | 4 | 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 @@ | |||
| 1 | SUMMARY = "Deploy SOTA credentials on the defice" | ||
| 2 | LICENSE = "MIT" | ||
| 3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
| 4 | |||
| 5 | FILES_${PN} += "${sysconfdir}/sota.toml" | ||
| 6 | |||
| 7 | ALLOW_EMPTY_${PN} = "1" | ||
| 8 | |||
| 9 | export SOTA_CREDENTIALS | ||
| 10 | |||
| 11 | do_install() { | ||
| 12 | if [ -n "$SOTA_CREDENTIALS" ]; then | ||
| 13 | if [ -f "$SOTA_CREDENTIALS" ]; then | ||
| 14 | EXT=`basename $SOTA_CREDENTIALS | cut -d'.' -f2` | ||
| 15 | if [ "$EXT" != "toml" ]; then | ||
| 16 | bbwarn "File\'s extension is not \'toml\', make sure you have the correct file" | ||
| 17 | fi | ||
| 18 | |||
| 19 | install -d ${D}${sysconfdir} | ||
| 20 | cat $SOTA_CREDENTIALS | sed 's/^package_manager = .*$/package_manager = "ostree"/' > ${D}${sysconfdir}/sota.toml | ||
| 21 | chmod 644 ${D}${sysconfdir}/sota.toml | ||
| 22 | else | ||
| 23 | bberror "File $SOTA_CREDENTIALS does not exist" | ||
| 24 | fi | ||
| 25 | fi | ||
| 26 | } | ||
| 27 | |||
