blob: 4688d8b1df5c4aae98e5e605e4a4c5532375b7ed [file] [log] [blame]
Kumar Thangavelbf2522d2021-11-26 12:03:10 +05301FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2
Patrick Williamsb7950ee2022-11-02 12:50:45 -05003OVERRIDES:append = "${@bb.utils.contains('VIRTUAL-RUNTIME_obmc-host-state-manager', 'phosphor-state-manager-host', ':phosphor-fan-with-psm', ':phosphor-fan-without-psm', d)}"
4
5PHOSPHOR_FAN_EXTRA_SERVICES = "obmc-poweroff.service"
6PHOSPHOR_FAN_EXTRA_SERVICES:append:phosphor-fan-without-psm = " \
7 obmc-chassis-hard-poweroff@.target \
8 obmc-chassis-poweroff@.target \
9 "
10
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053011SRC_URI:append:fb-withhost = " file://obmc-chassis-hard-poweroff@.target \
12 file://obmc-chassis-poweroff@0.target \
13 file://obmc-poweroff.service \
14 file://host-poweroff"
15
16PACKAGECONFIG:append = " json sensor-monitor"
17
Matt Spinlerdbdec8b2022-08-19 18:14:38 +000018EXTRA_OEMESON = "-Duse-host-power-state=enabled"
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053019
20RDEPENDS:sensor-monitor = " bash"
21
22do_install:append:fb-withhost() {
Patrick Williamsb7950ee2022-11-02 12:50:45 -050023 install -d ${D}${systemd_system_unitdir}
24 for svc in ${PHOSPHOR_FAN_EXTRA_SERVCIES}; do
25 install -m 0644 ${WORKDIR}/${svc} ${D}${systemd_system_unitdir}
26 done
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053027
Patrick Williamsb7950ee2022-11-02 12:50:45 -050028 # Store the bitbake variable OBMC_HOST_INSTANCES inside the script as HOST_INSTANCES variable using sed.
29 sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/host-poweroff
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053030
Patrick Williamsb7950ee2022-11-02 12:50:45 -050031 install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053032
Patrick Williamsb7950ee2022-11-02 12:50:45 -050033 install -d ${D}/usr/libexec/phosphor-fan-sensor-monitor
34 install -m 0777 ${WORKDIR}/host-poweroff ${D}/usr/libexec/phosphor-fan-sensor-monitor/
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053035}
36
37pkg_postinst:${PN}() {
Patrick Williamsb7950ee2022-11-02 12:50:45 -050038 mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires
39 mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@0.target.requires
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053040
Patrick Williamsb7950ee2022-11-02 12:50:45 -050041 LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@0.target"
42 TARGET="../obmc-chassis-poweroff@0.target"
43 ln -s $TARGET $LINK
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053044
Patrick Williamsb7950ee2022-11-02 12:50:45 -050045 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service"
46 TARGET="../../obmc-poweroff.service"
47 ln -s $TARGET $LINK
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053048}
49
50FILES:sensor-monitor += "/usr/libexec/phosphor-fan-sensor-monitor/host-poweroff"
Patrick Williamsb7950ee2022-11-02 12:50:45 -050051FILES:sensor-monitor += "${systemd_system_unitdir}"