bmc: Create runtime directory for non-persistent configs

Change-Id: I32012e7e798bae5a1c5b02e39b32dc40ba3b580a
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/bmc/firmware-handler/Makefile.am b/bmc/firmware-handler/Makefile.am
index c12838d..1ec7aa3 100644
--- a/bmc/firmware-handler/Makefile.am
+++ b/bmc/firmware-handler/Makefile.am
@@ -25,6 +25,11 @@
 dist_pkgdata_DATA += config-bios.json
 endif
 
+if HAVE_TMPFILESDIR
+tmpfiles_DATA = \
+	phosphor-ipmi-flash.conf
+endif
+
 if HAVE_SYSTEMUNITDIR
 systemdsystemunit_DATA = \
 	phosphor-ipmi-flash-bmc-prepare.target \
diff --git a/bmc/firmware-handler/phosphor-ipmi-flash.conf b/bmc/firmware-handler/phosphor-ipmi-flash.conf
new file mode 100644
index 0000000..b34193f
--- /dev/null
+++ b/bmc/firmware-handler/phosphor-ipmi-flash.conf
@@ -0,0 +1 @@
+d /run/phosphor-ipmi-flash 0755 - - -
diff --git a/configure.ac b/configure.ac
index 1532977..7747b76 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,6 +113,24 @@
     AC_SUBST([systemdsystemunitdir], ["$with_systemdsystemunitdir"])
     AM_CONDITIONAL([HAVE_SYSTEMUNITDIR], [test "x$with_systemdsystemunitdir" != "x"])
 
+    PKG_PROG_PKG_CONFIG
+    AC_ARG_WITH([tmpfilesdir],
+        [AS_HELP_STRING([--with-tmpfiledir=DIR], [Directory for systemd tmpfile config])],
+        [],
+        [with_tmpfilesdir=auto]
+    )
+    AS_IF([test "x$with_tmpfilesdir" = "xyes" -o "x$with_tmpfilesdir" = "xauto"], [
+        PKG_CHECK_VAR([TMPFILESDIR], [systemd], [tmpfilesdir], [with_tmpfilesdir="$TMPFILESDIR"], [])
+    ])
+    AS_IF([test "x$with_tmpfilesdir" = "xyes"], [
+        AC_MSG_ERROR([tmpfilesdir requested but pkg-config unable to query systemd package])
+    ])
+    AS_IF([test "x$with_tmpfilesdir" = "xno" -o "x$with_tmpfilesdir" = "xauto"], [
+        with_tmpfilesdir=''
+    ])
+    AC_SUBST([tmpfilesdir], ["$with_tmpfilesdir"])
+    AM_CONDITIONAL([HAVE_TMPFILESDIR], [test "x$with_tmpfilesdir" != "x"])
+
     # Only set if build-bmc-blob-handler wasn't unset.
     AM_CONDITIONAL([ENABLE_HOST_BIOS], [test "x$enable_host_bios" = "xyes"])
     AS_IF([test "x$enable_host_bios" = "xyes"], [