Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 1 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" |
| 2 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 3 | OVERRIDES:append = "${@bb.utils.contains('VIRTUAL-RUNTIME_obmc-host-state-manager', 'phosphor-state-manager-host', ':phosphor-fan-with-psm', ':phosphor-fan-without-psm', d)}" |
| 4 | |
| 5 | PHOSPHOR_FAN_EXTRA_SERVICES = "obmc-poweroff.service" |
| 6 | PHOSPHOR_FAN_EXTRA_SERVICES:append:phosphor-fan-without-psm = " \ |
| 7 | obmc-chassis-hard-poweroff@.target \ |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 8 | obmc-chassis-poweroff@0.target \ |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 9 | " |
| 10 | |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 11 | SRC_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 | |
| 16 | PACKAGECONFIG:append = " json sensor-monitor" |
| 17 | |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 18 | |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 19 | RDEPENDS:${PN}-sensor-monitor = " bash" |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 20 | |
| 21 | do_install:append:fb-withhost() { |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 22 | install -d ${D}${systemd_system_unitdir} |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 23 | for svc in ${PHOSPHOR_FAN_EXTRA_SERVICES}; do |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 24 | install -m 0644 ${WORKDIR}/${svc} ${D}${systemd_system_unitdir} |
| 25 | done |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 26 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 27 | # 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 Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 29 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 30 | install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 31 | |
Patrick Williams | edf8fe5 | 2023-03-24 09:46:00 -0500 | [diff] [blame] | 32 | install -d ${D}${libexecdir}/phosphor-fan-sensor-monitor |
Patrick Williams | d313524 | 2024-01-19 16:45:58 -0600 | [diff] [blame] | 33 | install -m 0755 ${WORKDIR}/host-poweroff ${D}${libexecdir}/phosphor-fan-sensor-monitor/ |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 34 | } |
| 35 | |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 36 | pkg_postinst:${PN}-sensor-monitor() { |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 37 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 38 | mkdir -p $D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires |
| 39 | mkdir -p $D/var/lib/phosphor-fan-presence |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 40 | |
Peter Yin | 989a418 | 2024-06-18 23:13:14 +0800 | [diff] [blame] | 41 | # It should be create by PSM, should we remove it? |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 42 | LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@.target" |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 43 | TARGET="../obmc-chassis-poweroff@0.target" |
| 44 | ln -s $TARGET $LINK |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 45 | |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 46 | LINK="$D$systemd_system_unitdir/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service" |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 47 | TARGET="../obmc-poweroff.service" |
Patrick Williams | b7950ee | 2022-11-02 12:50:45 -0500 | [diff] [blame] | 48 | ln -s $TARGET $LINK |
Kumar Thangavel | bf2522d | 2021-11-26 12:03:10 +0530 | [diff] [blame] | 49 | } |
| 50 | |
Peter Yin | 989a418 | 2024-06-18 23:13:14 +0800 | [diff] [blame] | 51 | pkg_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 Williams | edf8fe5 | 2023-03-24 09:46:00 -0500 | [diff] [blame] | 56 | FILES:${PN}-sensor-monitor += "${libexecdir}/phosphor-fan-sensor-monitor/host-poweroff" |
Delphine CC Chiu | 3b3d40e | 2023-01-05 13:50:29 +0800 | [diff] [blame] | 57 | FILES:${PN}-sensor-monitor += "${systemd_system_unitdir}" |