[PATCH openbmc v2] Allow multiple systemd service files
OpenBMC Patches
openbmc-patches at stwcx.xyz
Wed May 18 00:30:53 AEST 2016
From: Brad Bishop <bradleyb at fuzziesquirrel.com>
Enhance the obmc-phosphor-systemd class such that an array
of service files in SYSTEMD_SERVICES works.
Signed-off-by: Brad Bishop <bradleyb at fuzziesquirrel.com>
---
meta-phosphor/classes/obmc-phosphor-systemd.bbclass | 18 +++++++++++++-----
.../host-ipmi-hw-example/host-ipmi-hw-example.service | 8 --------
.../host-ipmi-hw-example/host-ipmi-hw.service | 8 ++++++++
3 files changed, 21 insertions(+), 13 deletions(-)
delete mode 100644 meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service
create mode 100644 meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw.service
diff --git a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
index 12e0bc1..44d363e 100644
--- a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
@@ -2,13 +2,21 @@
inherit systemd
-SYSTEMD_SERVICE_${PN} = "${BPN}.service"
-SRC_URI += " \
- file://${BPN}.service \
- "
+SYSTEMD_SERVICE_${PN} ?= "${BPN}.service"
+
+python() {
+ service_files = d.getVar(
+ 'SYSTEMD_SERVICE_' + d.getVar('BPN', True),
+ True)
+ if service_files:
+ uris = " ".join(['file://' + s for s in service_files.split()])
+ d.appendVar('SRC_URI', ' ' + uris)
+}
do_install_append() {
# install systemd unit files
install -d ${D}${systemd_unitdir}/system
- install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_unitdir}/system
+ for i in ${SYSTEMD_SERVICE_${PN}}; do
+ install -m 0644 ${WORKDIR}/$i ${D}${systemd_unitdir}/system
+ done
}
diff --git a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service
deleted file mode 100644
index b6baa6f..0000000
--- a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service
+++ /dev/null
@@ -1,8 +0,0 @@
-[Unit]
-Description=Phosphor OpenBMC host IPMI to DBUS example implementation
-
-[Service]
-ExecStart=/usr/sbin/host-ipmi-hw
-
-[Install]
-WantedBy=multi-user.target
diff --git a/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw.service b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw.service
new file mode 100644
index 0000000..b6baa6f
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=Phosphor OpenBMC host IPMI to DBUS example implementation
+
+[Service]
+ExecStart=/usr/sbin/host-ipmi-hw
+
+[Install]
+WantedBy=multi-user.target
--
2.8.2
More information about the openbmc
mailing list