summaryrefslogtreecommitdiffstats
path: root/recipes-sota
diff options
context:
space:
mode:
authorAnton Gerasimov <anton@advancedtelematic.com>2017-07-05 12:11:52 +0200
committerAnton Gerasimov <anton@advancedtelematic.com>2017-07-05 12:11:52 +0200
commit69a0db9291725b1ddfa643dc00d6d2f1bf6c5caf (patch)
treec9e4c89bce12a81ddd364b2676c8a005fff725dd /recipes-sota
parentb0d9d7018502a29f062895f853efd41e7b760d5a (diff)
parentb56329a3745c93060888492db8e5762ba2628783 (diff)
downloadmeta-updater-69a0db9291725b1ddfa643dc00d6d2f1bf6c5caf.tar.gz
Merge branch 'morty' into pyro
Diffstat (limited to 'recipes-sota')
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb20
-rw-r--r--recipes-sota/aktualizr/files/aktualizr-autoprovision.service14
-rw-r--r--recipes-sota/aktualizr/files/sota_autoprov.toml18
-rw-r--r--recipes-sota/ostree-initrd/files/init.sh34
-rw-r--r--recipes-sota/ostree-initrd/ostree-initrd.bb2
-rw-r--r--recipes-sota/rvi-sota-client/rvi-sota-client_git.bb2
6 files changed, 63 insertions, 27 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index fa71af8..4f9d131 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -5,35 +5,41 @@ SECTION = "base"
5LICENSE = "MPL-2.0" 5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7DEPENDS = "boost curl openssl jansson libsodium ostree" 7DEPENDS = "boost curl openssl jansson libsodium ostree"
8SRCREV = "4e9344ae375a444f02b964dca52fe808010d17df" 8RDEPENDS_${PN} = "lshw"
9PV = "1.0+git${SRCPV}"
10 9
11SRC_URI = " \ 10SRC_URI = " \
12 git://github.com/advancedtelematic/aktualizr \ 11 git://github.com/advancedtelematic/aktualizr \
13 file://aktualizr-manual-provision.service \ 12 file://aktualizr-manual-provision.service \
13 file://aktualizr-autoprovision.service \
14 file://sota_autoprov.toml \
14 " 15 "
16SRCREV = "7ca3af4e2f47ca7a3a67866023de3f8a97425991"
17PV = "1.0+git${SRCPV}"
15 18
16S = "${WORKDIR}/git" 19S = "${WORKDIR}/git"
17SYSTEMD_SERVICE_${PN} = "aktualizr.service" 20SYSTEMD_SERVICE_${PN} = "aktualizr.service"
18 21
19inherit cmake systemd 22inherit cmake systemd
20 23
21EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON" 24EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_OSTREE=ON -DAKTUALIZR_VERSION=${PV}"
22 25
23export SOTA_AUTOPROVISION_CREDENTIALS 26export SOTA_AUTOPROVISION_CREDENTIALS
27export SOTA_PACKED_CREDENTIALS
24 28
25do_install_append() { 29do_install_append() {
26 if [ -n "$SOTA_AUTOPROVISION_CREDENTIALS" ]; then 30 if [ -n "${SOTA_AUTOPROVISION_CREDENTIALS}" -o -n "${SOTA_PACKED_CREDENTIALS}" ]; then
27 bbwarn "Aktualizr recipe currently lacks support for SOTA_AUTOPROVISION_CREDENTIALS. No systemd service will be created" 31 install -d ${D}/${systemd_unitdir}/system
32 install -m 0644 ${WORKDIR}/aktualizr-autoprovision.service ${D}/${systemd_unitdir}/system/aktualizr.service
33 install -d ${D}/usr/lib/sota
34 install -m "0644" ${WORKDIR}/sota_autoprov.toml ${D}/usr/lib/sota/sota.toml
28 else 35 else
29 install -d ${D}/${systemd_unitdir}/system 36 install -d ${D}/${systemd_unitdir}/system
30 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service 37 install -m 0644 ${WORKDIR}/aktualizr-manual-provision.service ${D}/${systemd_unitdir}/system/aktualizr.service
31 fi 38 fi
32} 39}
33 40
34RDEPENDS = ""
35
36FILES_${PN} = " \ 41FILES_${PN} = " \
37 ${bindir}/aktualizr \ 42 ${bindir}/aktualizr \
38 ${systemd_unitdir}/system/aktualizr.service \ 43 ${systemd_unitdir}/system/aktualizr.service \
44 /usr/lib/sota/sota.toml \
39 " 45 "
diff --git a/recipes-sota/aktualizr/files/aktualizr-autoprovision.service b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
new file mode 100644
index 0000000..fd0ab09
--- /dev/null
+++ b/recipes-sota/aktualizr/files/aktualizr-autoprovision.service
@@ -0,0 +1,14 @@
1[Unit]
2Description=Aktualizr SOTA Client
3Wants=network-online.target
4After=network.target network-online.target
5Requires=network-online.target
6
7[Service]
8RestartSec=10
9Restart=always
10EnvironmentFile=/var/sota/sota_provisioning_url.env
11ExecStart=/usr/bin/aktualizr --disable-keyid-validation --tls-server ${SOTA_GATEWAY_URI} --config /usr/lib/sota/sota.toml
12
13[Install]
14WantedBy=multi-user.target
diff --git a/recipes-sota/aktualizr/files/sota_autoprov.toml b/recipes-sota/aktualizr/files/sota_autoprov.toml
new file mode 100644
index 0000000..8799553
--- /dev/null
+++ b/recipes-sota/aktualizr/files/sota_autoprov.toml
@@ -0,0 +1,18 @@
1[device]
2packages_dir = "/tmp/packages_dir"
3certificates_directory = "/var/sota"
4system_info = "system_info.sh"
5
6[tls]
7ca_file = "root.crt"
8client_certificate = "client.pem"
9pkey_file = "pkey.pem"
10
11[uptane]
12metadata_path = "/var/sota/metadata"
13private_key_path = "ecukey.der"
14public_key_path = "ecukey.pub"
15
16[provision]
17p12_path = "sota_provisioning_credentials.p12"
18
diff --git a/recipes-sota/ostree-initrd/files/init.sh b/recipes-sota/ostree-initrd/files/init.sh
index 1814ca3..0b0693d 100644
--- a/recipes-sota/ostree-initrd/files/init.sh
+++ b/recipes-sota/ostree-initrd/files/init.sh
@@ -1,17 +1,13 @@
1#!/bin/sh 1#!/bin/sh
2 2set -eu
3# global variables
4
5SMACK=n
6DEBUG=n
7 3
8# ------------------------------------------- 4# -------------------------------------------
9 5
10log_info() { echo "$0[$$]: $@" >&2; } 6log_info() { echo "$0[$$]: $*" >&2; }
11log_error() { echo "$0[$$]: ERROR $@" >&2; } 7log_error() { echo "$0[$$]: ERROR $*" >&2; }
12 8
13do_mount_fs() { 9do_mount_fs() {
14 log_info "mounting FS: $@" 10 log_info "mounting FS: $*"
15 [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } } 11 [[ -e /proc/filesystems ]] && { grep -q "$1" /proc/filesystems || { log_error "Unknown filesystem"; return 1; } }
16 [[ -d "$2" ]] || mkdir -p "$2" 12 [[ -d "$2" ]] || mkdir -p "$2"
17 [[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } } 13 [[ -e /proc/mounts ]] && { grep -q -e "^$1 $2 $1" /proc/mounts && { log_info "$2 ($1) already mounted"; return 0; } }
@@ -26,10 +22,10 @@ bail_out() {
26} 22}
27 23
28get_ostree_sysroot() { 24get_ostree_sysroot() {
29 for opt in `cat /proc/cmdline`; do 25 for opt in $(cat /proc/cmdline); do
30 arg=`echo $opt | cut -d'=' -f1` 26 arg=$(echo "$opt" | cut -d'=' -f1)
31 if [ $arg == "ostree_root" ]; then 27 if [ "$arg" == "ostree_root" ]; then
32 echo $opt | cut -d'=' -f2- 28 echo "$opt" | cut -d'=' -f2-
33 return 29 return
34 fi 30 fi
35 done 31 done
@@ -38,7 +34,7 @@ get_ostree_sysroot() {
38 34
39export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree 35export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/lib/ostree
40 36
41log_info "starting initrd script" 37log_info "Starting OSTree initrd script"
42 38
43do_mount_fs proc /proc 39do_mount_fs proc /proc
44do_mount_fs sysfs /sys 40do_mount_fs sysfs /sys
@@ -50,8 +46,6 @@ do_mount_fs tmpfs /run
50 46
51# check if smack is active (and if so, mount smackfs) 47# check if smack is active (and if so, mount smackfs)
52grep -q smackfs /proc/filesystems && { 48grep -q smackfs /proc/filesystems && {
53 SMACK=y
54
55 do_mount_fs smackfs /sys/fs/smackfs 49 do_mount_fs smackfs /sys/fs/smackfs
56 50
57 # adjust current label and network label 51 # adjust current label and network label
@@ -62,14 +56,20 @@ grep -q smackfs /proc/filesystems && {
62mkdir -p /sysroot 56mkdir -p /sysroot
63ostree_sysroot=$(get_ostree_sysroot) 57ostree_sysroot=$(get_ostree_sysroot)
64 58
65mount $ostree_sysroot /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot" 59mount "$ostree_sysroot" /sysroot || {
60 # The SD card in the R-Car M3 takes a bit of time to come up
61 # Retry the mount if it fails the first time
62 log_info "Mounting $ostree_sysroot failed, waiting 5s for the device to be available..."
63 sleep 5
64 mount "$ostree_sysroot" /sysroot || bail_out "Unable to mount $ostree_sysroot as physical sysroot"
65}
66ostree-prepare-root /sysroot 66ostree-prepare-root /sysroot
67 67
68# move mounted devices to new root 68# move mounted devices to new root
69cd /sysroot 69cd /sysroot
70for x in dev proc; do 70for x in dev proc; do
71 log_info "Moving /$x to new rootfs" 71 log_info "Moving /$x to new rootfs"
72 mount -o move /$x $x 72 mount -o move "/$x" "$x"
73done 73done
74 74
75# switch to new rootfs 75# switch to new rootfs
diff --git a/recipes-sota/ostree-initrd/ostree-initrd.bb b/recipes-sota/ostree-initrd/ostree-initrd.bb
index b721405..6046c81 100644
--- a/recipes-sota/ostree-initrd/ostree-initrd.bb
+++ b/recipes-sota/ostree-initrd/ostree-initrd.bb
@@ -5,7 +5,7 @@ SRC_URI = "file://init.sh"
5 5
6S = "${WORKDIR}" 6S = "${WORKDIR}"
7 7
8PV = "2" 8PV = "3"
9 9
10do_install() { 10do_install() {
11 install -dm 0755 ${D}/etc 11 install -dm 0755 ${D}/etc
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 b0d91eb..5a08670 100644
--- a/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
+++ b/recipes-sota/rvi-sota-client/rvi-sota-client_git.bb
@@ -30,8 +30,6 @@ FILES_${PN} = " \
30 ${bindir}/sota_prov.sh \ 30 ${bindir}/sota_prov.sh \
31 ${sysconfdir}/sota_client.version \ 31 ${sysconfdir}/sota_client.version \
32 ${sysconfdir}/sota_certificates \ 32 ${sysconfdir}/sota_certificates \
33 /var/sota/sota_provisioning_credentials.p12 \
34 /var/sota/sota_provisioning_url.env \
35 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client_autoprovision.service', '', d)} \ 33 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client_autoprovision.service', '', d)} \
36 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \ 34 ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_unitdir}/system/sota_client.service', '', d)} \
37 " 35 "