blob: 9b4364b92f280d61c1165a5965521ed515b656b1 [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
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053018
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080019RDEPENDS:${PN}-sensor-monitor = " bash"
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053020
21do_install:append:fb-withhost() {
Patrick Williamsb7950ee2022-11-02 12:50:45 -050022 install -d ${D}${systemd_system_unitdir}
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080023 for svc in ${PHOSPHOR_FAN_EXTRA_SERVICES}; do
Patrick Williamsb7950ee2022-11-02 12:50:45 -050024 install -m 0644 ${WORKDIR}/${svc} ${D}${systemd_system_unitdir}
25 done
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053026
Patrick Williamsb7950ee2022-11-02 12:50:45 -050027 # Store the bitbake variable OBMC_HOST_INSTANCES inside the script as HOST_INSTANCES variable using sed.
28 sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/host-poweroff
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053029
Patrick Williamsb7950ee2022-11-02 12:50:45 -050030 install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053031
Patrick Williamsedf8fe52023-03-24 09:46:00 -050032 install -d ${D}${libexecdir}/phosphor-fan-sensor-monitor
Patrick Williamsd3135242024-01-19 16:45:58 -060033 install -m 0755 ${WORKDIR}/host-poweroff ${D}${libexecdir}/phosphor-fan-sensor-monitor/
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053034}
35
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080036pkg_postinst:${PN}-sensor-monitor() {
Patrick Williamsb7950ee2022-11-02 12:50:45 -050037 mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080038 mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires
39 mkdir -p $D/var/lib/phosphor-fan-presence
Kumar Thangavelbf2522d2021-11-26 12:03:10 +053040
Peter Yin989a4182024-06-18 23:13:14 +080041# It should be create by PSM, should we remove it?
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
Peter Yin989a4182024-06-18 23:13:14 +080051pkg_postinst:${PN}-sensor-monitor:harma() {
52 rm -f $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@.target
53}
54
55
Patrick Williamsedf8fe52023-03-24 09:46:00 -050056FILES:${PN}-sensor-monitor += "${libexecdir}/phosphor-fan-sensor-monitor/host-poweroff"
Delphine CC Chiu3b3d40e2023-01-05 13:50:29 +080057FILES:${PN}-sensor-monitor += "${systemd_system_unitdir}"