summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Wise <phil@advancedtelematic.com>2018-03-14 16:00:53 +0100
committerPhil Wise <phil@advancedtelematic.com>2018-03-14 16:00:53 +0100
commit66a4721d0b7885a18db952d69f7ee385a95b2f2b (patch)
tree435221c02bad0e8ba4d89350d3c98efaf8be5d53
parentbbce1809a921e627678947e9585ea15223b181d9 (diff)
downloadmeta-updater-66a4721d0b7885a18db952d69f7ee385a95b2f2b.tar.gz
Add systemd socket activation for secondary
-rw-r--r--lib/oeqa/selftest/cases/updater.py5
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb15
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-secondary.service9
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-secondary.socket5
4 files changed, 33 insertions, 1 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index a5072e8..1850d98 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -543,6 +543,11 @@ class SecondaryTests(OESelftestTestCase):
543 self.assertEqual(retcode, 0, "Unable to run aktualizr-secondary --help") 543 self.assertEqual(retcode, 0, "Unable to run aktualizr-secondary --help")
544 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode()) 544 self.assertEqual(stderr, b'', 'Error: ' + stderr.decode())
545 545
546 def test_secondary_listening(self):
547 print('Checking aktualizr-secondary is present')
548 stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030')
549 self.assertEqual(retcode, 0, "Unable to connect to secondary")
550
546def qemu_launch(efi=False, machine=None, imagename=None): 551def qemu_launch(efi=False, machine=None, imagename=None):
547 logger = logging.getLogger("selftest") 552 logger = logging.getLogger("selftest")
548 logger.info('Running bitbake to build core-image-minimal') 553 logger.info('Running bitbake to build core-image-minimal')
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index ad06339..5e683ac 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -18,9 +18,11 @@ PR = "7"
18SRC_URI = " \ 18SRC_URI = " \
19 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ 19 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \
20 file://aktualizr.service \ 20 file://aktualizr.service \
21 file://aktualizr-secondary.service \
22 file://aktualizr-secondary.socket \
21 file://aktualizr-serialcan.service \ 23 file://aktualizr-serialcan.service \
22 " 24 "
23SRCREV = "dca6271f4ec06eb2272cc99b4b9cf76a9805f18d" 25SRCREV = "fbb3404824c4eb239455c7fa1a794c26e2ea954d"
24BRANCH ?= "master" 26BRANCH ?= "master"
25 27
26S = "${WORKDIR}/git" 28S = "${WORKDIR}/git"
@@ -28,7 +30,10 @@ S = "${WORKDIR}/git"
28inherit cmake 30inherit cmake
29 31
30inherit systemd 32inherit systemd
33
34SYSTEMD_PACKAGES = "${PN} ${PN}-secondary"
31SYSTEMD_SERVICE_${PN} = "aktualizr.service" 35SYSTEMD_SERVICE_${PN} = "aktualizr.service"
36SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket"
32 37
33BBCLASSEXTEND =+ "native" 38BBCLASSEXTEND =+ "native"
34 39
@@ -39,6 +44,11 @@ EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF -
39do_install_append () { 44do_install_append () {
40 rm -fr ${D}${libdir}/systemd 45 rm -fr ${D}${libdir}/systemd
41 rm -f ${D}${libdir}/sota/sota.toml # Only needed for the Debian package 46 rm -f ${D}${libdir}/sota/sota.toml # Only needed for the Debian package
47 install -d ${D}${libdir}/sota
48 install -m 0644 ${S}/config/sota_secondary.toml ${D}/${libdir}/sota/sota_secondary.toml
49 install -d ${D}${systemd_unitdir}/system
50 install -m 0644 ${WORKDIR}/aktualizr-secondary.socket ${D}${systemd_unitdir}/system/aktualizr-secondary.socket
51 install -m 0644 ${WORKDIR}/aktualizr-secondary.service ${D}${systemd_unitdir}/system/aktualizr-secondary.service
42} 52}
43do_install_append_class-target () { 53do_install_append_class-target () {
44 install -d ${D}${systemd_unitdir}/system 54 install -d ${D}${systemd_unitdir}/system
@@ -84,6 +94,9 @@ FILES_${PN}-host-tools = " \
84 94
85FILES_${PN}-secondary = " \ 95FILES_${PN}-secondary = " \
86 ${bindir}/aktualizr-secondary \ 96 ${bindir}/aktualizr-secondary \
97 ${libdir}/sota/sota_secondary.toml \
98 ${systemd_unitdir}/system/aktualizr-secondary.socket \
99 ${systemd_unitdir}/system/aktualizr-secondary.service \
87 " 100 "
88 101
89# Both primary and secondary need the SQL Schemas 102# Both primary and secondary need the SQL Schemas
diff --git a/recipes-sota/aktualizr/files/aktualizr-secondary.service b/recipes-sota/aktualizr/files/aktualizr-secondary.service
new file mode 100644
index 0000000..a1e0e1b
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-secondary.service
@@ -0,0 +1,9 @@
1[Unit]
2Description=Aktualizr SOTA Client (UPTANE Secondary)
3
4[Service]
5RestartSec=10
6Restart=always
7EnvironmentFile=-/etc/sota/sota.env
8ExecStart=/usr/bin/aktualizr-secondary --config /usr/lib/sota/sota_secondary.toml
9
diff --git a/recipes-sota/aktualizr/files/aktualizr-secondary.socket b/recipes-sota/aktualizr/files/aktualizr-secondary.socket
new file mode 100644
index 0000000..1cb4269
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-secondary.socket
@@ -0,0 +1,5 @@
1[Socket]
2ListenStream=9030
3
4[Install]
5WantedBy=sockets.target \ No newline at end of file