diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2016-06-13 20:56:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-13 20:56:15 +0300 |
commit | 9f1d336d6708a63c7c59f8938bc0d4f365d4671a (patch) | |
tree | eb1d42e158106f729df29c7bed51c4697ebdd112 | |
parent | 73a644099913b30391f7757edc3b7c4aaf6a32f0 (diff) | |
parent | 10c2f855e927bcfdaedbf93681f2734792f0675e (diff) | |
download | openbmc-9f1d336d6708a63c7c59f8938bc0d4f365d4671a.tar.xz |
Merge pull request #323 from bradbishop/rest-dbus-socket
Turn on socket activation for rest-dbus
-rw-r--r-- | meta-phosphor/classes/obmc-phosphor-systemd.bbclass | 56 | ||||
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw.service (renamed from meta-phosphor/common/recipes-phosphor/host-ipmid/host-ipmi-hw-example/host-ipmi-hw-example.service) | 0 | ||||
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.service | 3 | ||||
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.socket | 8 | ||||
-rw-r--r-- | meta-phosphor/common/recipes-phosphor/rest-dbus/rest-dbus.bb | 5 |
5 files changed, 58 insertions, 14 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass index 12e0bc168b..b07174f9fb 100644 --- a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass @@ -1,14 +1,52 @@ -# Common code for Phosphor OpenBMC systemd services. - +# Common code for systemd based services. +# +# Prior to inheriting this class, recipes can define services like this: +# +# SYSTEMD_SERVICE_${PN} = "foo.service bar.socket baz@.service" +# +# and these files will be added to the main package if they exist. +# +# Alternatively this class can just be inherited and +# ${BPN}.service will be added to the main package. inherit systemd -SYSTEMD_SERVICE_${PN} = "${BPN}.service" -SRC_URI += " \ - file://${BPN}.service \ - " + +python() { + bpn = d.getVar('BPN', True) + searchpaths = d.getVar('FILESPATH', True) + + services = d.getVar('SYSTEMD_SERVICE_' + bpn, True) + + if services: + services = services.split() + else: + services = [bpn + '.service'] + + for s in services: + file = s + path = bb.utils.which(searchpaths, file) + if os.path.isfile(path): + d.appendVar('SRC_URI', ' file://' + file) + d.appendVar( + 'FILES_' + bpn, ' ' + + d.getVar('systemd_system_unitdir', True) + file) + d.appendVar('OBMC_SYSTEMD_SERVICES', ' ' + file) + if file not in (d.getVar('SYSTEMD_SERVICE_' + bpn, True) or "").split(): + d.appendVar('SYSTEMD_SERVICE_' + bpn, ' ' + file) + else: + bb.error("Could not find service file: %s" % file) +} do_install_append() { - # install systemd unit files - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${WORKDIR}/${BPN}.service ${D}${systemd_unitdir}/system + # install systemd service/socket/template files + if [ "${OBMC_SYSTEMD_SERVICES}" ]; then + install -d ${D}${systemd_system_unitdir} + fi + for s in ${OBMC_SYSTEMD_SERVICES}; do + install -m 0644 ${WORKDIR}/$s ${D}${systemd_system_unitdir} + sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' \ + -e 's,@BINDIR@,${bindir},g' \ + -e 's,@SBINDIR@,${sbindir},g' \ + ${D}${systemd_system_unitdir}/$s + 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.service index e15d8d71b2..e15d8d71b2 100644 --- 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.service diff --git a/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.service b/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.service index 79a848a43e..5ad582f4b0 100644 --- a/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.service +++ b/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.service @@ -4,6 +4,3 @@ Description=DBUS introspecting REST server. [Service] Restart=always ExecStart=/usr/sbin/rest-dbus - -[Install] -WantedBy=multi-user.target diff --git a/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.socket b/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.socket new file mode 100644 index 0000000000..89f99b8c34 --- /dev/null +++ b/meta-phosphor/common/recipes-phosphor/rest-dbus/files/rest-dbus.socket @@ -0,0 +1,8 @@ +[Unit] +Description=DBUS introspecting REST server socket. + +[Socket] +ListenStream=3000 + +[Install] +WantedBy=sockets.target diff --git a/meta-phosphor/common/recipes-phosphor/rest-dbus/rest-dbus.bb b/meta-phosphor/common/recipes-phosphor/rest-dbus/rest-dbus.bb index 7f990aaa3c..afee21c5e7 100644 --- a/meta-phosphor/common/recipes-phosphor/rest-dbus/rest-dbus.bb +++ b/meta-phosphor/common/recipes-phosphor/rest-dbus/rest-dbus.bb @@ -16,11 +16,12 @@ RDEPENDS_${PN} += " \ pyphosphor \ " +SYSTEMD_SERVICE_${PN} += "rest-dbus.service rest-dbus.socket" + SRC_URI += " \ git://github.com/openbmc/rest-dbus.git \ - file://rest-dbus.service \ " -SRCREV = "64077101d9f2b6e51c897db82ffc0a399a34d15b" +SRCREV = "5a65d2f605494d5c308171ba4fd1ab08d7b3a91d" S = "${WORKDIR}/git" |