summaryrefslogtreecommitdiff
path: root/meta-facebook/recipes-phosphor/fans/phosphor-fan_%.bbappend
blob: 54eb51d1bbd05ee513e1a2b0aca5cb1a4f9e441d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"

SRC_URI:append:fb-withhost = " file://obmc-chassis-hard-poweroff@.target \
                               file://obmc-chassis-poweroff@0.target \
                               file://obmc-poweroff.service \
                               file://host-poweroff"

PACKAGECONFIG:append = " json sensor-monitor"

EXTRA_OEMESON = "-Duse-host-power-state=enabled"

RDEPENDS:sensor-monitor = " bash"

do_install:append:fb-withhost() {

install -d ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/obmc-chassis-hard-poweroff@.target ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/obmc-chassis-poweroff@0.target ${D}${systemd_system_unitdir}
install -m 0644 ${WORKDIR}/obmc-poweroff.service ${D}${systemd_system_unitdir}

# Store the bitbake variable OBMC_HOST_INSTANCES  inside the script as HOST_INSTANCES variable using sed.
sed -i -e "s,HOST_INSTANCES_SED_REPLACEMENT_VALUE,${OBMC_HOST_INSTANCES},g" ${WORKDIR}/host-poweroff

install -m 0755 -d ${D}/var/lib/phosphor-fan-presence/sensor-monitor

install -d ${D}/usr/libexec/phosphor-fan-sensor-monitor
install -m 0777 ${WORKDIR}/host-poweroff ${D}/usr/libexec/phosphor-fan-sensor-monitor/

}

pkg_postinst:${PN}() {

mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires
mkdir -p $D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@0.target.requires

LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@0.target"
TARGET="../obmc-chassis-poweroff@0.target"
ln -s $TARGET $LINK

LINK="$D$systemd_system_unitdir/obmc-chassis-hard-poweroff@0.target.requires/obmc-chassis-poweroff@0.target.requires/obmc-poweroff.service"
TARGET="../../obmc-poweroff.service"
ln -s $TARGET $LINK

}

FILES:sensor-monitor += "/usr/libexec/phosphor-fan-sensor-monitor/host-poweroff"

FILES:sensor-monitor += "${systemd_system_unitdir}/obmc-chassis-hard-poweroff@.target"
FILES:sensor-monitor += "${systemd_system_unitdir}/obmc-chassis-poweroff@0.target "
FILES:sensor-monitor += "${systemd_system_unitdir}/obmc-poweroff.service"