diff mbox series

[isar-cip-core,v3,1/4] swupdate-config: move swupdate.cfg from customizations to own recipe

Message ID 20240216153024.260416-2-Quirin.Gylstorff@siemens.com (mailing list archive)
State Superseded
Headers show
Series Reduce difference to debian | expand

Commit Message

Gylstorff Quirin Feb. 16, 2024, 3:30 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows downstream customizations without including unwanted
packages.

It also adds the new variable `MACHINE_HW_VERSION` to check the
compatibility between machine/image and the swupdate file.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 recipes-core/customizations/common.inc        |  8 ++----
 .../swupdate-config/files/hwrevision.tmpl     |  1 +
 .../files/swupdate.cfg                        |  0
 .../swupdate-config/swupdate-config_0.1.bb    | 27 +++++++++++++++++++
 4 files changed, 30 insertions(+), 6 deletions(-)
 create mode 100644 recipes-core/swupdate-config/files/hwrevision.tmpl
 rename recipes-core/{customizations => swupdate-config}/files/swupdate.cfg (100%)
 create mode 100644 recipes-core/swupdate-config/swupdate-config_0.1.bb
diff mbox series

Patch

diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
index 79bf80d..37872c1 100644
--- a/recipes-core/customizations/common.inc
+++ b/recipes-core/customizations/common.inc
@@ -19,8 +19,6 @@  SRC_URI = " \
     file://99-silent-printk.conf \
     file://99-watchdog.conf"
 
-SRC_URI:append:swupdate = " file://swupdate.cfg"
-
 CUSTOM_HOSTNAME ??= "demo"
 WIRELESS_FIRMWARE_PACKAGE ?= ""
 INSTALL_WIRELESS_TOOLS ??= "0"
@@ -29,12 +27,14 @@  TEMPLATE_FILES += "postinst.tmpl"
 TEMPLATE_VARS += "CUSTOM_HOSTNAME"
 
 DEPENDS += "sshd-regen-keys change-root-homedir"
+RDEPENDS:append:swupdate = " swupdate-config"
 
 DEBIAN_DEPENDS = " \
     ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
     change-root-homedir \
     ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
 	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
+DEBIAN_DEPENDS:append:swupdate = ", swupdate-config"
 
 do_install() {
 	install -v -d ${D}/etc/network/interfaces.d
@@ -46,7 +46,3 @@  do_install() {
 	install -v -d ${D}/etc/systemd/system.conf.d
 	install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/
 }
-
-do_install:append:swupdate() {
-	install -v -m 644 ${WORKDIR}/swupdate.cfg ${D}/etc/
-}
diff --git a/recipes-core/swupdate-config/files/hwrevision.tmpl b/recipes-core/swupdate-config/files/hwrevision.tmpl
new file mode 100644
index 0000000..1eb0996
--- /dev/null
+++ b/recipes-core/swupdate-config/files/hwrevision.tmpl
@@ -0,0 +1 @@ 
+cip-${MACHINE} ${MACHINE_HW_VERSION}
diff --git a/recipes-core/customizations/files/swupdate.cfg b/recipes-core/swupdate-config/files/swupdate.cfg
similarity index 100%
rename from recipes-core/customizations/files/swupdate.cfg
rename to recipes-core/swupdate-config/files/swupdate.cfg
diff --git a/recipes-core/swupdate-config/swupdate-config_0.1.bb b/recipes-core/swupdate-config/swupdate-config_0.1.bb
new file mode 100644
index 0000000..6991321
--- /dev/null
+++ b/recipes-core/swupdate-config/swupdate-config_0.1.bb
@@ -0,0 +1,27 @@ 
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI = "file://swupdate.cfg \
+           file://hwrevision.tmpl"
+
+MACHINE_HW_VERSION ??= ""
+TEMPLATE_FILES += "hwrevision.tmpl"
+TEMPLATE_VARS += "MACHINE MACHINE_HW_VERSION"
+
+do_install[cleandirs] = "${D}/etc/"
+do_install() {
+	install -v -m 644 "${WORKDIR}"/swupdate.cfg "${D}"/etc/
+        if [ -n "${MACHINE_HW_VERSION}" ]; then
+            install -v -m 644 "${WORKDIR}"/hwrevision "${D}"/etc/
+        fi
+}