blob: 819903adb16a74ff05eb5d36a40f168f839249bb [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 \
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +08008 obmc-chassis-poweroff@0.target \
Patrick Williamsb7950ee2022-11-02 12:50:45 -05009 "
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
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080020RDEPENDS:${PN}-sensor-monitor = " bash"
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053021
22do_install:append:fb-withhost() {
Patrick Williamsb7950ee2022-11-02 12:50:45 -050023 install -d ${D}${systemd_system_unitdir}
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080024 for svc in ${PHOSPHOR_FAN_EXTRA_SERVICES}; do
Patrick Williamsb7950ee2022-11-02 12:50:45 -050025 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 Williamsedf8fe52023-03-24 09:46:00 -050033 install -d ${D}${libexecdir}/phosphor-fan-sensor-monitor
Patrick Williamsd3135242024-01-19 16:45:58 -060034 install -m 0755 ${WORKDIR}/host-poweroff ${D}${libexecdir}/phosphor-fan-sensor-monitor/
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053035}
36
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080037pkg_postinst:${PN}-sensor-monitor() {
Patrick Williamsb7950ee2022-11-02 12:50:45 -050038 mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080039 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires
40 mkdir -p $D/var/lib/phosphor-fan-presence
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053041
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080042 LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@.target"
Patrick Williamsb7950ee2022-11-02 12:50:45 -050043 TARGET="../obmc-chassis-poweroff@0.target"
44 ln -s $TARGET $LINK
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053045
Patrick Williamsb7950ee2022-11-02 12:50:45 -050046 LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service"
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080047 TARGET="../obmc-poweroff.service"
Patrick Williamsb7950ee2022-11-02 12:50:45 -050048 ln -s $TARGET $LINK
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053049}
50
Patrick Williamsedf8fe52023-03-24 09:46:00 -050051FILES:${PN}-sensor-monitor += "${libexecdir}/phosphor-fan-sensor-monitor/host-poweroff"
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080052FILES:${PN}-sensor-monitor += "${systemd_system_unitdir}"