diff options
| author | Anton Gerasimov <anton@advancedtelematic.com> | 2016-12-23 12:34:33 +0100 |
|---|---|---|
| committer | Anton Gerasimov <anton@advancedtelematic.com> | 2016-12-23 12:34:33 +0100 |
| commit | db58e575655be131df4a597d66bfdec2ca128474 (patch) | |
| tree | 8a83a7330a61342c777e2b7379dd8d99597932c8 | |
| parent | 96ed051bfbee1d3c01d9ad7a45ad53c672623a24 (diff) | |
| download | meta-updater-db58e575655be131df4a597d66bfdec2ca128474.tar.gz | |
Deploy credentials to physical sysroot's /boot
| -rw-r--r-- | classes/image_types_ota.bbclass | 17 | ||||
| -rw-r--r-- | conf/distro/sota.conf.inc | 3 | ||||
| -rw-r--r-- | recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | 6 | ||||
| -rw-r--r-- | recipes-sota/sota-credentials/sota-credentials.bb | 27 |
4 files changed, 24 insertions, 29 deletions
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index d017904..bee1ea4 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
| @@ -87,6 +87,22 @@ IMAGE_CMD_otaimg () { | |||
| 87 | mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ | 87 | mv ${HOME_TMP}/usr/homedirs/home ${PHYS_SYSROOT}/ |
| 88 | rm -rf ${HOME_TMP} | 88 | rm -rf ${HOME_TMP} |
| 89 | 89 | ||
| 90 | # Deploy device credentials | ||
| 91 | if [ -n "$SOTA_CREDENTIALS" ]; then | ||
| 92 | if [ -f "$SOTA_CREDENTIALS" ]; then | ||
| 93 | EXT=`basename $SOTA_CREDENTIALS | cut -d'.' -f2` | ||
| 94 | if [ "$EXT" != "toml" ]; then | ||
| 95 | bbwarn "File\'s extension is not \'toml\', make sure you have the correct file" | ||
| 96 | fi | ||
| 97 | |||
| 98 | cat $SOTA_CREDENTIALS | sed 's/^package_manager = .*$/package_manager = "ostree"/' > ${PHYS_SYSROOT}/boot/sota.toml | ||
| 99 | chmod 644 ${PHYS_SYSROOT}/boot/sota.toml | ||
| 100 | else | ||
| 101 | bberror "File $SOTA_CREDENTIALS does not exist" | ||
| 102 | fi | ||
| 103 | fi | ||
| 104 | |||
| 105 | # Calculate image type | ||
| 90 | OTA_ROOTFS_SIZE=$(calculate_size `du -ks $PHYS_SYSROOT | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") | 106 | OTA_ROOTFS_SIZE=$(calculate_size `du -ks $PHYS_SYSROOT | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") |
| 91 | 107 | ||
| 92 | if [ $OTA_ROOTFS_SIZE -lt 0 ]; then | 108 | if [ $OTA_ROOTFS_SIZE -lt 0 ]; then |
| @@ -98,6 +114,7 @@ IMAGE_CMD_otaimg () { | |||
| 98 | eval COUNT=\"$MIN_COUNT\" | 114 | eval COUNT=\"$MIN_COUNT\" |
| 99 | fi | 115 | fi |
| 100 | 116 | ||
| 117 | # create image | ||
| 101 | rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg | 118 | rm -rf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg |
| 102 | sync | 119 | sync |
| 103 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024 | 120 | dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.otaimg seek=$OTA_ROOTFS_SIZE count=$COUNT bs=1024 |
diff --git a/conf/distro/sota.conf.inc b/conf/distro/sota.conf.inc index 3136092..7602464 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 sota-credentials" | 1 | IMAGE_INSTALL_append = " ostree rvi-sota-client" |
| 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" |
| @@ -28,3 +28,4 @@ PREFERRED_PROVIDER_virtual/bootloader_raspberrypi3 = "u-boot" | |||
| 28 | DISTRO_TYPE ?= "${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "debug", "release",d)}" | 28 | DISTRO_TYPE ?= "${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "debug", "release",d)}" |
| 29 | 29 | ||
| 30 | DISTROOVERRIDES_append = ":sota" | 30 | DISTROOVERRIDES_append = ":sota" |
| 31 | DISTRO_FEATURES_append = " sota" | ||
diff --git a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb index 0acc6c6..8ffe7ce 100644 --- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb +++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb | |||
| @@ -118,7 +118,11 @@ do_install() { | |||
| 118 | 118 | ||
| 119 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | 119 | if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then |
| 120 | install -d ${D}${systemd_unitdir}/system | 120 | install -d ${D}${systemd_unitdir}/system |
| 121 | install -c ${S}/run/sota_client.service ${D}${systemd_unitdir}/system | 121 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sota', 'true', 'false', d)}; then |
| 122 | install -c ${S}/run/sota_client_ostree.service ${D}${systemd_unitdir}/system/sota_client.service | ||
| 123 | else | ||
| 124 | install -c ${S}/run/sota_client.service ${D}${systemd_unitdir}/system/sota_client.service | ||
| 125 | fi | ||
| 122 | fi | 126 | fi |
| 123 | 127 | ||
| 124 | install -d ${D}${sysconfdir} | 128 | install -d ${D}${sysconfdir} |
diff --git a/recipes-sota/sota-credentials/sota-credentials.bb b/recipes-sota/sota-credentials/sota-credentials.bb deleted file mode 100644 index f523f21..0000000 --- a/recipes-sota/sota-credentials/sota-credentials.bb +++ /dev/null | |||
| @@ -1,27 +0,0 @@ | |||
| 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 | |||
