diff options
Diffstat (limited to 'external/meta-updater/recipes-test')
10 files changed, 50 insertions, 30 deletions
diff --git a/external/meta-updater/recipes-test/demo-config/files/30-fake-pacman.toml b/external/meta-updater/recipes-test/demo-config/files/30-fake-pacman.toml deleted file mode 100644 index 3fb5cf2c..00000000 --- a/external/meta-updater/recipes-test/demo-config/files/30-fake-pacman.toml +++ /dev/null @@ -1,2 +0,0 @@ -[pacman] -type = "fake" diff --git a/external/meta-updater/recipes-test/demo-config/files/30-pacman-config.toml b/external/meta-updater/recipes-test/demo-config/files/30-pacman-config.toml new file mode 100644 index 00000000..750cf5c7 --- /dev/null +++ b/external/meta-updater/recipes-test/demo-config/files/30-pacman-config.toml @@ -0,0 +1,2 @@ +[pacman] +type = @UPDATE_TYPE@ diff --git a/external/meta-updater/recipes-test/demo-config/primary-config.bb b/external/meta-updater/recipes-test/demo-config/primary-config.bb index 27cb553e..5c8abb54 100644 --- a/external/meta-updater/recipes-test/demo-config/primary-config.bb +++ b/external/meta-updater/recipes-test/demo-config/primary-config.bb @@ -4,11 +4,14 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7 require shared-conf.inc +inherit allarch + PRIMARY_SECONDARIES ?= "${SECONDARY_IP}:${SECONDARY_PORT}" SRC_URI = "\ file://30-secondary-config.toml \ file://ip_secondary_config.json \ + ${@('file://' + d.getVar('SOTA_SECONDARY_CONFIG')) if d.getVar('SOTA_SECONDARY_CONFIG') else ''} \ " def get_secondary_addrs(d): diff --git a/external/meta-updater/recipes-test/demo-config/secondary-config.bb b/external/meta-updater/recipes-test/demo-config/secondary-config.bb index 9411646b..638f0aea 100644 --- a/external/meta-updater/recipes-test/demo-config/secondary-config.bb +++ b/external/meta-updater/recipes-test/demo-config/secondary-config.bb @@ -4,36 +4,55 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7 require shared-conf.inc +# Because of the dependency on MACHINE. +PACKAGE_ARCH = "${MACHINE_ARCH}" + SECONDARY_SERIAL_ID ?= "" SOTA_HARDWARE_ID ?= "${MACHINE}-sndry" SECONDARY_HARDWARE_ID ?= "${SOTA_HARDWARE_ID}" +SECONDARY_UPDATE_TYPE ?= "ostree" + +UPDATE_TYPE = "${SECONDARY_UPDATE_TYPE}" +python () { + update_type = d.getVar('UPDATE_TYPE') + if update_type not in [ 'ostree', 'file']: + bb.fatal('Unsupported type of an update specified for secondary: SECONDARY_UPDATE_TYPE = {}\n' + 'Supported update types are: ostree and file' + .format(update_type)) + + if update_type == 'file': + d.setVar('UPDATE_TYPE', 'none') +} SRC_URI = "\ - file://30-fake-pacman.toml \ + file://30-pacman-config.toml \ file://35-network-config.toml \ file://45-id-config.toml \ " + do_install () { install -m 0700 -d ${D}${libdir}/sota/conf.d - install -m 0644 ${WORKDIR}/30-fake-pacman.toml ${D}/${libdir}/sota/conf.d/30-fake-pacman.toml - install -m 0644 ${WORKDIR}/35-network-config.toml ${D}/${libdir}/sota/conf.d/35-network-config.toml + install -m 0644 ${WORKDIR}/30-pacman-config.toml ${D}${libdir}/sota/conf.d/30-pacman-config.toml + sed -i -e 's|@UPDATE_TYPE@|${UPDATE_TYPE}|g' ${D}${libdir}/sota/conf.d/30-pacman-config.toml + + install -m 0644 ${WORKDIR}/35-network-config.toml ${D}${libdir}/sota/conf.d/35-network-config.toml sed -i -e 's|@PORT@|${SECONDARY_PORT}|g' \ -e 's|@PRIMARY_IP@|${PRIMARY_IP}|g' \ -e 's|@PRIMARY_PORT@|${PRIMARY_PORT}|g' \ - ${D}/${libdir}/sota/conf.d/35-network-config.toml + ${D}${libdir}/sota/conf.d/35-network-config.toml - install -m 0644 ${WORKDIR}/45-id-config.toml ${D}/${libdir}/sota/conf.d/45-id-config.toml + install -m 0644 ${WORKDIR}/45-id-config.toml ${D}${libdir}/sota/conf.d/45-id-config.toml sed -i -e 's|@SERIAL@|${SECONDARY_SERIAL_ID}|g' \ -e 's|@HWID@|${SECONDARY_HARDWARE_ID}|g' \ - ${D}/${libdir}/sota/conf.d/45-id-config.toml + ${D}${libdir}/sota/conf.d/45-id-config.toml } FILES_${PN} = " \ ${libdir}/sota/conf.d \ - ${libdir}/sota/conf.d/30-fake-pacman.toml \ + ${libdir}/sota/conf.d/30-pacman-config.toml \ ${libdir}/sota/conf.d/35-network-config.toml \ ${libdir}/sota/conf.d/45-id-config.toml \ " diff --git a/external/meta-updater/recipes-test/demo-config/shared-conf.inc b/external/meta-updater/recipes-test/demo-config/shared-conf.inc index c5ab5987..55234068 100644 --- a/external/meta-updater/recipes-test/demo-config/shared-conf.inc +++ b/external/meta-updater/recipes-test/demo-config/shared-conf.inc @@ -1,5 +1,5 @@ -SECONDARY_IP ?= "10.0.3.2" +SECONDARY_IP ?= "192.168.254.2" SECONDARY_PORT ?= "9050" -PRIMARY_IP ?= "10.0.3.1" +PRIMARY_IP ?= "192.168.254.1" PRIMARY_PORT ?= "9040" PRIMARY_WAIT_TIMEOUT ?= "240" diff --git a/external/meta-updater/recipes-test/demo-network-config/files/25-dhcp-server.network b/external/meta-updater/recipes-test/demo-network-config/files/25-dhcp-server.network index 4766f9ae..03bb3023 100644 --- a/external/meta-updater/recipes-test/demo-network-config/files/25-dhcp-server.network +++ b/external/meta-updater/recipes-test/demo-network-config/files/25-dhcp-server.network @@ -4,9 +4,9 @@ Name=enp0s4 [Network] Description=Private internal network between aktualizr Primary and Secondary nodes DHCPServer=yes -Address=10.0.3.1/24 +Address=192.168.254.1/24 IPForward=yes IPMasquerade=yes [DHCPServer] -PoolOffset=10
\ No newline at end of file +PoolOffset=10 diff --git a/external/meta-updater/recipes-test/demo-network-config/network-config.inc b/external/meta-updater/recipes-test/demo-network-config/network-config.inc index ed623d46..b023f514 100644 --- a/external/meta-updater/recipes-test/demo-network-config/network-config.inc +++ b/external/meta-updater/recipes-test/demo-network-config/network-config.inc @@ -2,15 +2,18 @@ SRC_URI_append = "\ file://26-${CONF_TYPE}-client.network \ " +# Because of the dependency on MACHINE. +PACKAGE_ARCH = "${MACHINE_ARCH}" + SECONDARY_INTERFACE ?= "${@ 'eth0' if d.getVar('MACHINE') == 'raspberrypi3' else 'enp0s5'}" do_install_append() { bbnote "Network configuration type to be applied: ${CONF_TYPE}" - install -d ${D}/usr/lib/systemd/network - install -m 0644 ${WORKDIR}/26-${CONF_TYPE}-client.network ${D}/usr/lib/systemd/network/ + install -d ${D}${libdir}/systemd/network + install -m 0644 ${WORKDIR}/26-${CONF_TYPE}-client.network ${D}${libdir}/systemd/network/ sed -i -e 's|@ADDR@|${IP_ADDR}|g' \ -e 's|@IFNAME@|${SECONDARY_INTERFACE}|g' \ - ${D}/usr/lib/systemd/network/26-${CONF_TYPE}-client.network + ${D}${libdir}/systemd/network/26-${CONF_TYPE}-client.network } diff --git a/external/meta-updater/recipes-test/demo-network-config/primary-network-config.bb b/external/meta-updater/recipes-test/demo-network-config/primary-network-config.bb index d840a951..7ee873f4 100644 --- a/external/meta-updater/recipes-test/demo-network-config/primary-network-config.bb +++ b/external/meta-updater/recipes-test/demo-network-config/primary-network-config.bb @@ -2,22 +2,20 @@ DESCRIPTION = "Sample network configuration for an Uptane Primary" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" -inherit allarch - SRC_URI = "\ file://27-dhcp-client-external.network \ " -FILES_${PN} = "/usr/lib/systemd/network" +FILES_${PN} = "${libdir}/systemd/network" PR = "1" do_install() { - install -d ${D}/usr/lib/systemd/network - install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}/usr/lib/systemd/network/ + install -d ${D}${libdir}/systemd/network + install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}${libdir}/systemd/network/ } -PRIMARY_IP ?= "10.0.3.1" +PRIMARY_IP ?= "192.168.254.1" IP_ADDR = "${PRIMARY_IP}" CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('RPI_WIFI_ENABLE') != '1' else 'static'}" diff --git a/external/meta-updater/recipes-test/demo-network-config/secondary-network-config.bb b/external/meta-updater/recipes-test/demo-network-config/secondary-network-config.bb index b1d70f1f..b268cd38 100644 --- a/external/meta-updater/recipes-test/demo-network-config/secondary-network-config.bb +++ b/external/meta-updater/recipes-test/demo-network-config/secondary-network-config.bb @@ -2,8 +2,6 @@ DESCRIPTION = "Sample network configuration for an Uptane Secondary" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" -inherit allarch - # TODO: It configures the 'user' interface in NAT mode and provides an access to public Inet via it # which is not desired for Secondary. It cannot be just removed since we get SSH access to Secondary # VM via this interface. So, the task is to configure the interface in such way that it does provide access @@ -12,18 +10,18 @@ SRC_URI = "\ file://27-dhcp-client-external.network \ " -FILES_${PN} = "/usr/lib/systemd/network" +FILES_${PN} = "${libdir}/systemd/network" PR = "1" do_install() { - install -d ${D}/usr/lib/systemd/network - install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}/usr/lib/systemd/network/ + install -d ${D}${libdir}/systemd/network + install -m 0644 ${WORKDIR}/27-dhcp-client-external.network ${D}${libdir}/systemd/network/ } -SECONDARY_IP ?= "10.0.3.2" +SECONDARY_IP ?= "192.168.254.2" IP_ADDR = "${SECONDARY_IP}" -CONF_TYPE = "static" +CONF_TYPE ?= "${@ 'multihomed' if d.getVar('MACHINE') == 'raspberrypi3' and d.getVar('RPI_WIFI_ENABLE') != '1' else 'static'}" require network-config.inc diff --git a/external/meta-updater/recipes-test/images/secondary-image.bb b/external/meta-updater/recipes-test/images/secondary-image.bb index 27d1e3f9..7db2c684 100644 --- a/external/meta-updater/recipes-test/images/secondary-image.bb +++ b/external/meta-updater/recipes-test/images/secondary-image.bb @@ -14,7 +14,6 @@ IMAGE_INSTALL_remove = " \ aktualizr-shared-prov \ aktualizr-shared-prov-creds \ aktualizr-device-prov \ - aktualizr-device-prov-creds \ aktualizr-device-prov-hsm \ aktualizr-uboot-env-rollback \ virtual/network-configuration \ |