Move service files into repo and clean up OVERLAYS

Upstream request is to have service files in repo now.
Also limit scope of OVERLAYS flag to allow exports to
still work.

Change-Id: I61c8621a648556d277d4faf3dfe38a61343053ce
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index a0fa904..cd14cc1 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -32,8 +32,8 @@
 #include <experimental/filesystem>
 
 constexpr const char *OUTPUT_DIR = "/var/configuration/";
-constexpr const char *configurationDirectory = "/usr/share/configurations";
-constexpr const char *schemaDirectory = "/usr/share/configurations/schemas";
+constexpr const char *configurationDirectory = PACKAGE_DIR "configurations";
+constexpr const char *schemaDirectory = PACKAGE_DIR "configurations/schemas";
 constexpr const char *globalSchema = "global.json";
 constexpr const char *TEMPLATE_CHAR = "$";
 constexpr const size_t PROPERTIES_CHANGED_UNTIL_FLUSH_COUNT = 20;
@@ -1428,12 +1428,8 @@
                 registerCallbacks(io, dbusMatches, systemConfiguration,
                                   objServer);
                 io.post([&, newConfiguration]() {
-
-#ifdef OVERLAYS
-                    // todo: for now, only add new configurations,
-                    // unload to come later unloadOverlays();
                     loadOverlays(newConfiguration);
-#endif
+
                     io.post([&]() {
                         if (!writeJsonFiles(systemConfiguration))
                         {
@@ -1512,7 +1508,9 @@
     inventoryIface->initialize();
 
     io.post([&]() {
+#if OVERLAYS
         unloadAllOverlays();
+#endif
         propertiesChangedCallback(io, dbusMatches, systemConfiguration,
                                   objServer);
     });
diff --git a/src/Overlay.cpp b/src/Overlay.cpp
index f937dbe..0f25eb5 100644
--- a/src/Overlay.cpp
+++ b/src/Overlay.cpp
@@ -30,7 +30,7 @@
 constexpr const char *DT_OVERLAY = "/usr/bin/dtoverlay";
 constexpr const char *DTC = "/usr/bin/dtc";
 constexpr const char *OUTPUT_DIR = "/tmp/overlays";
-constexpr const char *TEMPLATE_DIR = "/usr/share/overlay_templates";
+constexpr const char *TEMPLATE_DIR = PACKAGE_DIR "overlay_templates";
 constexpr const char *TEMPLATE_CHAR = "$";
 constexpr const char *HEX_FORMAT_STR = "0x";
 constexpr const char *PLATFORM = "aspeed,ast2500";
@@ -356,6 +356,8 @@
                 continue;
             }
             std::string type = findType.value().get<std::string>();
+#if OVERLAYS
+
             std::string typeFile = type + std::string(".template");
             for (const auto &path : paths)
             {
@@ -366,7 +368,7 @@
                 createOverlay(path.string(), configuration);
                 break;
             }
-
+#endif
             auto device = devices::exportTemplates.find(type.c_str());
             if (device != devices::exportTemplates.end())
             {