Enforce Dump directory creation prior to Dump manager starts

Create Dump file storage location before Dump Manager
application starts.

Change-Id: I583b8cdb853ac1ac18e50c05404f90a2fbb6d5e1
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/classes/phosphor-debug-collector.bbclass b/classes/phosphor-debug-collector.bbclass
new file mode 100644
index 0000000..030b404
--- /dev/null
+++ b/classes/phosphor-debug-collector.bbclass
@@ -0,0 +1 @@
+bmc_dump_path="/tmp/dumps"
diff --git a/common/recipes-phosphor/dump/phosphor-debug-collector.bb b/common/recipes-phosphor/dump/phosphor-debug-collector.bb
index 56e80ee..0f93529 100644
--- a/common/recipes-phosphor/dump/phosphor-debug-collector.bb
+++ b/common/recipes-phosphor/dump/phosphor-debug-collector.bb
@@ -22,7 +22,8 @@
 inherit autotools \
         pkgconfig \
         obmc-phosphor-dbus-service \
-        pythonnative
+        pythonnative \
+        phosphor-debug-collector
 
 require phosphor-debug-collector.inc
 
@@ -46,10 +47,15 @@
         phosphor-logging \
 "
 
+MGR_SVC ?= "xyz.openbmc_project.Dump.Manager.service"
+
+SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
+
 FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager"
 FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
 
-DBUS_SERVICE_${PN}-manager += "xyz.openbmc_project.Dump.Manager.service"
+DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
 SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
 
+
 S = "${WORKDIR}/git"
diff --git a/common/recipes-phosphor/dump/phosphor-debug-collector/xyz.openbmc_project.Dump.Manager.service b/common/recipes-phosphor/dump/phosphor-debug-collector/xyz.openbmc_project.Dump.Manager.service
index 9aeba93..84f8232 100644
--- a/common/recipes-phosphor/dump/phosphor-debug-collector/xyz.openbmc_project.Dump.Manager.service
+++ b/common/recipes-phosphor/dump/phosphor-debug-collector/xyz.openbmc_project.Dump.Manager.service
@@ -2,6 +2,7 @@
 Description=Phosphor Dump Manager
 
 [Service]
+ExecStartPre=/bin/sh -c 'mkdir -p {BMC_DUMP_PATH}'
 ExecStart={sbindir}/phosphor-dump-manager
 Restart=always
 Type=dbus