meta-phosphor:fans:presence: Enable JSON config install from repo

Add setting the `MACHINE` name to the recipe and pass it to the fan
presence package to use in installing its JSON config files for that
machine into the image from the repository.

Change-Id: Ib782d9013c5ad0cfc1b283563ef07dc812fb12f2
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/meta-phosphor/recipes-phosphor/fans/phosphor-fan_git.bb b/meta-phosphor/recipes-phosphor/fans/phosphor-fan_git.bb
index 7c72b65..4f5d560 100644
--- a/meta-phosphor/recipes-phosphor/fans/phosphor-fan_git.bb
+++ b/meta-phosphor/recipes-phosphor/fans/phosphor-fan_git.bb
@@ -35,18 +35,20 @@
 PACKAGE_BEFORE_PN += "${FAN_PACKAGES}"
 PACKAGECONFIG ?= "presence control monitor"
 SYSTEMD_PACKAGES = "${FAN_PACKAGES}"
+PKG_DEFAULT_MACHINE ??= "${MACHINE}"
+PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 # The control, monitor, and presence apps can either be JSON or YAML driven.
 PACKAGECONFIG[json] = "--enable-json, --disable-json"
 
 # --------------------------------------
 # ${PN}-presence-tach specific configuration
-PACKAGECONFIG[presence] = " \
-        --enable-presence \
-        PRESENCE_CONFIG=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
-        --disable-presence, \
-        virtual/phosphor-fan-presence-config \
-        , \
+PACKAGECONFIG[presence] = "--enable-presence \
+    MACHINE=${PKG_DEFAULT_MACHINE} \
+    PRESENCE_CONFIG=${STAGING_DIR_HOST}${presence_datadir}/config.yaml, \
+    --disable-presence, \
+    virtual/phosphor-fan-presence-config \
+    , \
 "
 
 MULTI_USR_TGT = "multi-user.target"
@@ -64,6 +66,10 @@
 SYSTEMD_LINK_${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
         compose_list(d, 'FMT_TACH_MUSR', 'OBMC_CHASSIS_INSTANCES'), '', d)}"
 
+# Package the JSON config files installed from the repo
+FILES:${PN}-presence-tach += "${@bb.utils.contains('PACKAGECONFIG', 'json', \
+    '${datadir}/phosphor-fan-presence/presence/*', '', d)}"
+
 # --------------------------------------
 # ${PN}-control specific configuration
 PACKAGECONFIG[control] = "--enable-control \