diff options
author | Patrick Vacek <patrickvacek@gmail.com> | 2019-02-27 13:52:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 13:52:05 +0100 |
commit | 2d2e46834af68b1c22ad0a022001c117caa4929c (patch) | |
tree | 32941919c71e6adde1ef9f477c703d80b5983d3b | |
parent | e9c373dba1e249085de4c9068521a83653fa5d77 (diff) | |
parent | d1e4c55f7b3a677d47755c267fa760d76c3994e4 (diff) | |
download | meta-updater-2d2e46834af68b1c22ad0a022001c117caa4929c.tar.gz |
Merge pull request #497 from advancedtelematic/backport/thud/auto-reboot-etc
Backport/thud/auto reboot etc
-rw-r--r-- | README.adoc | 1 | ||||
-rw-r--r-- | classes/image_types_ostree.bbclass | 12 | ||||
-rw-r--r-- | classes/image_types_ota.bbclass | 2 | ||||
-rw-r--r-- | conf/include/bblayers/sota_am335x-evm.inc | 3 | ||||
-rw-r--r-- | conf/include/bblayers/sota_intel-corei7-64.inc | 4 | ||||
-rw-r--r-- | conf/include/bblayers/sota_m3ulcb.inc | 5 | ||||
-rw-r--r-- | conf/include/bblayers/sota_porter.inc | 6 | ||||
-rw-r--r-- | conf/include/bblayers/sota_qemux86-64.inc | 2 | ||||
-rw-r--r-- | conf/include/bblayers/sota_raspberrypi2.inc | 6 | ||||
-rw-r--r-- | conf/include/bblayers/sota_raspberrypi3.inc | 6 | ||||
-rw-r--r-- | lib/oeqa/selftest/cases/updater.py | 29 | ||||
-rw-r--r-- | recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb | 7 | ||||
-rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 2 | ||||
-rw-r--r-- | recipes-sota/config/aktualizr-auto-reboot.bb | 21 | ||||
-rw-r--r-- | recipes-sota/config/files/35-enable-auto-reboot.toml | 2 |
15 files changed, 59 insertions, 49 deletions
diff --git a/README.adoc b/README.adoc index 27ecabf..d603ade 100644 --- a/README.adoc +++ b/README.adoc | |||
@@ -151,6 +151,7 @@ First, you can set `SOTA_CLIENT_PROV` to control which provisioning recipe is us | |||
151 | 151 | ||
152 | Second, you can write recipes to install additional config files with customized options. A few recipes already exist to address common needs and provide an example: | 152 | Second, you can write recipes to install additional config files with customized options. A few recipes already exist to address common needs and provide an example: |
153 | 153 | ||
154 | * link:recipes-sota/config/aktualizr-auto-reboot.bb[aktualizr-auto-reboot.bb] configures aktualizr to automatically reboot after new updates are installed in order to apply the updates immediately. This is only relevant for package managers (such as OSTree) that require a reboot to complete the installation process. If this is not enabled, you will need to reboot the system through other means. | ||
154 | * link:recipes-sota/config/aktualizr-disable-send-ip.bb[aktualizr-disable-send-ip.bb] disables the reporting of networking information to the server. This is enabled by default and supported by https://connect.ota.here.com/[HERE OTA Connect]. However, if you are using a different server that does not support this feature, you may want to disable it in aktualizr. | 155 | * link:recipes-sota/config/aktualizr-disable-send-ip.bb[aktualizr-disable-send-ip.bb] disables the reporting of networking information to the server. This is enabled by default and supported by https://connect.ota.here.com/[HERE OTA Connect]. However, if you are using a different server that does not support this feature, you may want to disable it in aktualizr. |
155 | * link:recipes-sota/config/aktualizr-log-debug.bb[aktualizr-log-debug.bb] sets the log level of aktualizr to 0 (trace). The default is 2 (info). This recipe is intended for development and debugging purposes. | 156 | * link:recipes-sota/config/aktualizr-log-debug.bb[aktualizr-log-debug.bb] sets the log level of aktualizr to 0 (trace). The default is 2 (info). This recipe is intended for development and debugging purposes. |
156 | 157 | ||
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index 29da78e..41327e1 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass | |||
@@ -148,6 +148,13 @@ IMAGE_CMD_ostreecommit () { | |||
148 | if [ "${OSTREE_UPDATE_SUMMARY}" = "1" ]; then | 148 | if [ "${OSTREE_UPDATE_SUMMARY}" = "1" ]; then |
149 | ostree --repo=${OSTREE_REPO} summary -u | 149 | ostree --repo=${OSTREE_REPO} summary -u |
150 | fi | 150 | fi |
151 | |||
152 | # To enable simultaneous bitbaking of two images with the same branch name, | ||
153 | # create a new ref in the repo using the basename of the image. (This first | ||
154 | # requires deleting it if it already exists.) Fixes OTA-2211. | ||
155 | ostree --repo=${OSTREE_REPO} refs --delete ${OSTREE_BRANCHNAME}-${IMAGE_BASENAME} | ||
156 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | ||
157 | ostree --repo=${OSTREE_REPO} refs --create=${OSTREE_BRANCHNAME}-${IMAGE_BASENAME} ${ostree_target_hash} | ||
151 | } | 158 | } |
152 | 159 | ||
153 | IMAGE_TYPEDEP_ostreepush = "ostreecommit" | 160 | IMAGE_TYPEDEP_ostreepush = "ostreecommit" |
@@ -190,7 +197,7 @@ IMAGE_CMD_garagesign () { | |||
190 | --home-dir ${GARAGE_SIGN_REPO} \ | 197 | --home-dir ${GARAGE_SIGN_REPO} \ |
191 | --credentials ${SOTA_PACKED_CREDENTIALS} | 198 | --credentials ${SOTA_PACKED_CREDENTIALS} |
192 | 199 | ||
193 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 200 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) |
194 | 201 | ||
195 | # Use OSTree target hash as version if none was provided by the user | 202 | # Use OSTree target hash as version if none was provided by the user |
196 | target_version=${ostree_target_hash} | 203 | target_version=${ostree_target_hash} |
@@ -243,7 +250,8 @@ IMAGE_CMD_garagecheck () { | |||
243 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 250 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
244 | # if credentials are issued by a server that doesn't support offline signing, exit silently | 251 | # if credentials are issued by a server that doesn't support offline signing, exit silently |
245 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 | 252 | unzip -p ${SOTA_PACKED_CREDENTIALS} root.json targets.pub targets.sec tufrepo.url 2>&1 >/dev/null || exit 0 |
246 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 253 | |
254 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) | ||
247 | 255 | ||
248 | garage-check --ref=${ostree_target_hash} \ | 256 | garage-check --ref=${ostree_target_hash} \ |
249 | --credentials=${SOTA_PACKED_CREDENTIALS} \ | 257 | --credentials=${SOTA_PACKED_CREDENTIALS} \ |
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass index a31cbd1..12375ec 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass | |||
@@ -59,7 +59,7 @@ IMAGE_CMD_ota () { | |||
59 | bbfatal "Invalid bootloader: ${OSTREE_BOOTLOADER}" | 59 | bbfatal "Invalid bootloader: ${OSTREE_BOOTLOADER}" |
60 | fi | 60 | fi |
61 | 61 | ||
62 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) | 62 | ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}-${IMAGE_BASENAME}) |
63 | 63 | ||
64 | ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} | 64 | ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} |
65 | kargs_list="" | 65 | kargs_list="" |
diff --git a/conf/include/bblayers/sota_am335x-evm.inc b/conf/include/bblayers/sota_am335x-evm.inc index f2d485d..909a7a4 100644 --- a/conf/include/bblayers/sota_am335x-evm.inc +++ b/conf/include/bblayers/sota_am335x-evm.inc | |||
@@ -1,2 +1 @@ | |||
1 | BBLAYERS += "${METADIR}/meta-ti" | ||
2 | BBLAYERS += " ${METADIR}/meta-ti " | ||
diff --git a/conf/include/bblayers/sota_intel-corei7-64.inc b/conf/include/bblayers/sota_intel-corei7-64.inc index 1771e6c..8e85a6c 100644 --- a/conf/include/bblayers/sota_intel-corei7-64.inc +++ b/conf/include/bblayers/sota_intel-corei7-64.inc | |||
@@ -1,2 +1,2 @@ | |||
1 | 1 | BBLAYERS += "${METADIR}/meta-updater-minnowboard" | |
2 | BBLAYERS += " ${METADIR}/meta-updater-minnowboard ${METADIR}/meta-intel " | 2 | BBLAYERS += "${METADIR}/meta-intel" |
diff --git a/conf/include/bblayers/sota_m3ulcb.inc b/conf/include/bblayers/sota_m3ulcb.inc index 04f78e4..4f2e0a9 100644 --- a/conf/include/bblayers/sota_m3ulcb.inc +++ b/conf/include/bblayers/sota_m3ulcb.inc | |||
@@ -1,2 +1,3 @@ | |||
1 | 1 | BBLAYERS += "${METADIR}/meta-renesas" | |
2 | BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas-rcar-gen3 ${METADIR}/meta-openembedded/meta-multimedia" | 2 | BBLAYERS += "${METADIR}/meta-renesas-rcar-gen3" |
3 | BBLAYERS += "${METADIR}/meta-openembedded/meta-multimedia" | ||
diff --git a/conf/include/bblayers/sota_porter.inc b/conf/include/bblayers/sota_porter.inc index 6964ef0..a50b71c 100644 --- a/conf/include/bblayers/sota_porter.inc +++ b/conf/include/bblayers/sota_porter.inc | |||
@@ -1,2 +1,4 @@ | |||
1 | 1 | BBLAYERS += "${METADIR}/meta-renesas" | |
2 | BBLAYERS += " ${METADIR}/meta-renesas ${METADIR}/meta-renesas/meta-rcar-gen2 ${METADIR}/meta-openembedded/meta-multimedia ${METADIR}/meta-updater-porter" | 2 | BBLAYERS += "${METADIR}/meta-renesas/meta-rcar-gen2" |
3 | BBLAYERS += "${METADIR}/meta-openembedded/meta-multimedia" | ||
4 | BBLAYERS += "${METADIR}/meta-updater-porter" | ||
diff --git a/conf/include/bblayers/sota_qemux86-64.inc b/conf/include/bblayers/sota_qemux86-64.inc index 12d32ff..9ccbfa6 100644 --- a/conf/include/bblayers/sota_qemux86-64.inc +++ b/conf/include/bblayers/sota_qemux86-64.inc | |||
@@ -1 +1 @@ | |||
BBLAYERS += " ${METADIR}/meta-updater-qemux86-64 " | BBLAYERS += "${METADIR}/meta-updater-qemux86-64" | ||
diff --git a/conf/include/bblayers/sota_raspberrypi2.inc b/conf/include/bblayers/sota_raspberrypi2.inc index cc26679..03f8f44 100644 --- a/conf/include/bblayers/sota_raspberrypi2.inc +++ b/conf/include/bblayers/sota_raspberrypi2.inc | |||
@@ -1,3 +1,3 @@ | |||
1 | BBLAYERS += " ${METADIR}/meta-openembedded/meta-python " | 1 | BBLAYERS += "${METADIR}/meta-openembedded/meta-python" |
2 | 2 | BBLAYERS += "${METADIR}/meta-updater-raspberrypi" | |
3 | BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " | 3 | BBLAYERS += "${METADIR}/meta-raspberrypi" |
diff --git a/conf/include/bblayers/sota_raspberrypi3.inc b/conf/include/bblayers/sota_raspberrypi3.inc index cc26679..03f8f44 100644 --- a/conf/include/bblayers/sota_raspberrypi3.inc +++ b/conf/include/bblayers/sota_raspberrypi3.inc | |||
@@ -1,3 +1,3 @@ | |||
1 | BBLAYERS += " ${METADIR}/meta-openembedded/meta-python " | 1 | BBLAYERS += "${METADIR}/meta-openembedded/meta-python" |
2 | 2 | BBLAYERS += "${METADIR}/meta-updater-raspberrypi" | |
3 | BBLAYERS += " ${METADIR}/meta-updater-raspberrypi ${METADIR}/meta-raspberrypi " | 3 | BBLAYERS += "${METADIR}/meta-raspberrypi" |
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 08521d5..550d9de 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py | |||
@@ -67,35 +67,6 @@ class GeneralTests(OESelftestTestCase): | |||
67 | self.assertEqual(result.status, 0, | 67 | self.assertEqual(result.status, 0, |
68 | "Java not found. Do you have a JDK installed on your host machine?") | 68 | "Java not found. Do you have a JDK installed on your host machine?") |
69 | 69 | ||
70 | def test_add_package(self): | ||
71 | deploydir = get_bb_var('DEPLOY_DIR_IMAGE') | ||
72 | imagename = get_bb_var('IMAGE_LINK_NAME', 'core-image-minimal') | ||
73 | image_path = deploydir + '/' + imagename + '.ota-ext4' | ||
74 | logger = logging.getLogger("selftest") | ||
75 | |||
76 | logger.info('Running bitbake with man in the image package list') | ||
77 | self.append_config('IMAGE_INSTALL_append = " man "') | ||
78 | bitbake('-c cleanall man-db') | ||
79 | bitbake('core-image-minimal') | ||
80 | result = runCmd('oe-pkgdata-util find-path /usr/bin/man') | ||
81 | self.assertEqual(result.output, 'man-db: /usr/bin/man') | ||
82 | path1 = os.path.realpath(image_path) | ||
83 | size1 = os.path.getsize(path1) | ||
84 | logger.info('First image %s has size %i' % (path1, size1)) | ||
85 | |||
86 | logger.info('Running bitbake without man in the image package list') | ||
87 | self.append_config('IMAGE_INSTALL_remove = " man "') | ||
88 | bitbake('-c cleanall man-db') | ||
89 | bitbake('core-image-minimal') | ||
90 | result = runCmd('oe-pkgdata-util find-path /usr/bin/man', ignore_status=True) | ||
91 | self.assertEqual(result.status, 1, "Status different than 1. output: %s" % result.output) | ||
92 | self.assertEqual(result.output, 'ERROR: Unable to find any package producing path /usr/bin/man') | ||
93 | path2 = os.path.realpath(image_path) | ||
94 | size2 = os.path.getsize(path2) | ||
95 | logger.info('Second image %s has size %i', path2, size2) | ||
96 | self.assertNotEqual(path1, path2, "Image paths are identical; image was not rebuilt.") | ||
97 | self.assertNotEqual(size1, size2, "Image sizes are identical; image was not rebuilt.") | ||
98 | |||
99 | 70 | ||
100 | class AktualizrToolsTests(OESelftestTestCase): | 71 | class AktualizrToolsTests(OESelftestTestCase): |
101 | 72 | ||
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb b/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb index 34460af..0628a61 100644 --- a/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb +++ b/recipes-sota/aktualizr/aktualizr-auto-prov-creds.bb | |||
@@ -11,9 +11,14 @@ require credentials.inc | |||
11 | do_install() { | 11 | do_install() { |
12 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then | 12 | if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then |
13 | install -m 0700 -d ${D}${localstatedir}/sota | 13 | install -m 0700 -d ${D}${localstatedir}/sota |
14 | cp ${SOTA_PACKED_CREDENTIALS} ${D}${localstatedir}/sota/sota_provisioning_credentials.zip | 14 | cp "${SOTA_PACKED_CREDENTIALS}" ${D}${localstatedir}/sota/sota_provisioning_credentials.zip |
15 | # Device should not be able to push data to treehub | 15 | # Device should not be able to push data to treehub |
16 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json | 16 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip treehub.json |
17 | # Device has no use for the API Gateway. Remove if present. See: | ||
18 | # https://github.com/advancedtelematic/ota-plus-server/pull/1913/ | ||
19 | if unzip -l ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url > /dev/null; then | ||
20 | zip -d ${D}${localstatedir}/sota/sota_provisioning_credentials.zip api_gateway.url | ||
21 | fi | ||
17 | fi | 22 | fi |
18 | } | 23 | } |
19 | 24 | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 3b48e58..a8f40d6 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -23,7 +23,7 @@ SRC_URI = " \ | |||
23 | file://aktualizr-serialcan.service \ | 23 | file://aktualizr-serialcan.service \ |
24 | " | 24 | " |
25 | 25 | ||
26 | SRCREV = "2aa9d93ccea09ec327789eecf858de561ef632da" | 26 | SRCREV = "c71ec0a320d85a3e75ba37bff7dc40ad02e9d655" |
27 | BRANCH ?= "master" | 27 | BRANCH ?= "master" |
28 | 28 | ||
29 | S = "${WORKDIR}/git" | 29 | S = "${WORKDIR}/git" |
diff --git a/recipes-sota/config/aktualizr-auto-reboot.bb b/recipes-sota/config/aktualizr-auto-reboot.bb new file mode 100644 index 0000000..ad4d17c --- /dev/null +++ b/recipes-sota/config/aktualizr-auto-reboot.bb | |||
@@ -0,0 +1,21 @@ | |||
1 | SUMMARY = "Enable auto reboot to apply updates" | ||
2 | DESCRIPTION = "Configures aktualizr to automatically reboot after new updates are installed in order to apply the updates immediately" | ||
3 | HOMEPAGE = "https://github.com/advancedtelematic/aktualizr" | ||
4 | SECTION = "base" | ||
5 | LICENSE = "MPL-2.0" | ||
6 | LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" | ||
7 | |||
8 | SRC_URI = " \ | ||
9 | file://35-enable-auto-reboot.toml \ | ||
10 | " | ||
11 | |||
12 | do_install_append () { | ||
13 | install -m 0700 -d ${D}${libdir}/sota/conf.d | ||
14 | install -m 0644 ${WORKDIR}/35-enable-auto-reboot.toml ${D}${libdir}/sota/conf.d/35-enable-auto-reboot.toml | ||
15 | } | ||
16 | |||
17 | FILES_${PN} = " \ | ||
18 | ${libdir}/sota/conf.d/35-enable-auto-reboot.toml \ | ||
19 | " | ||
20 | |||
21 | # vim:set ts=4 sw=4 sts=4 expandtab: | ||
diff --git a/recipes-sota/config/files/35-enable-auto-reboot.toml b/recipes-sota/config/files/35-enable-auto-reboot.toml new file mode 100644 index 0000000..f83810e --- /dev/null +++ b/recipes-sota/config/files/35-enable-auto-reboot.toml | |||
@@ -0,0 +1,2 @@ | |||
1 | [uptane] | ||
2 | force_install_completion = true | ||