bmc: json configuration: update: add mode parameter

Add the mode parameter as an optional configuration option for the
update systemd approach.  Previously this was hard-coded as "replace"
but now the user can specify something else.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I2bcb61bd9ac5733df6da70f901516d26bd31e2a9
diff --git a/bmc/buildjson.cpp b/bmc/buildjson.cpp
index aec9a09..d8a9ea1 100644
--- a/bmc/buildjson.cpp
+++ b/bmc/buildjson.cpp
@@ -112,8 +112,17 @@
             else if (updateType == "systemd")
             {
                 const auto& unit = update.at("unit");
+
+                /* the mode parameter is optional. */
+                std::string systemdMode = "replace";
+                const auto& mode = update.find("mode");
+                if (mode != update.end())
+                {
+                    systemdMode = update.at("mode").get<std::string>();
+                }
+
                 pack->update = SystemdUpdateMechanism::CreateSystemdUpdate(
-                    sdbusplus::bus::new_default(), unit, "replace");
+                    sdbusplus::bus::new_default(), unit, systemdMode);
             }
             else
             {