Install phosphor-fan-monitor app and service

Resolves openbmc/openbmc#1346

Change-Id: I9abac19b18b02158ff4fdae6e94406b64957cefb
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb
index 736149c..19eb4db 100644
--- a/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb
+++ b/meta-phosphor/common/recipes-phosphor/fans/phosphor-fan.bb
@@ -22,11 +22,12 @@
 FAN_PACKAGES = " \
         ${PN}-presence-tach \
         ${PN}-control \
+        ${PN}-monitor \
         phosphor-chassis-cooling-type \
 "
 PACKAGES_remove = "${PN}"
 PACKAGES += "${FAN_PACKAGES}"
-PACKAGECONFIG ??= "presence control cooling-type"
+PACKAGECONFIG ??= "presence control cooling-type monitor"
 SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
 RDEPENDS_${PN}-dev = "${FAN_PACKAGES}"
 RDEPENDS_${PN}-staticdev = "${FAN_PACKAGES}"
@@ -79,3 +80,23 @@
 PACKAGECONFIG[cooling-type] = "--enable-cooling-type,--disable-cooling-type,libevdev,"
 RDEPENDS_phosphor-chassis-cooling-type += "libevdev"
 FILES_phosphor-chassis-cooling-type = "${sbindir}/phosphor-cooling-type"
+
+# --------------------------------------
+# ${PN}-monitor specific configuration
+PACKAGECONFIG[monitor] = "--enable-monitor \
+     FAN_MONITOR_YAML_FILE=${STAGING_DIR_NATIVE}${monitor_datadir}/monitor.yaml \
+     FAN_MONITOR_OUTPUT_DIR=${S}/monitor, \
+    --disable-monitor, \
+    phosphor-fan-monitor-config-native \
+    , \
+"
+
+RDEPENDS_${PN}-monitor += "sdbusplus"
+
+TMPL_MONITOR = "phosphor-fan-monitor@.service"
+INSTFMT_MONITOR = "phosphor-fan-monitor@{0}.service"
+FMT_MONITOR = "../${TMPL_MONITOR}:${TGTFMT}.requires/${INSTFMT_MONITOR}"
+
+FILES_${PN}-monitor = "${sbindir}/phosphor-fan-monitor"
+SYSTEMD_SERVICE_${PN}-monitor += "${TMPL_MONITOR}"
+SYSTEMD_LINK_${PN}-monitor += "${@compose_list(d, 'FMT_MONITOR', 'OBMC_CHASSIS_INSTANCES')}"