Move function to enable field mode to common code
The only different between ubi and static layout for setting field mode
was masking the usr-local.mount service file. Now that the service file
is in the common code, it makes sense to move the function to the common
code.
Tested:
- Witherspoon: Verified setting field mode disabled the /usr/local mount
as it currently does.
- Romulus: Verified that after setting the field mode, the usr-local.mount
service file could not be started because it's masked.
Change-Id: I8afb755366053c38f72d682e874308c42e232d98
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index 21fb6e0..975c6e9 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -458,7 +458,23 @@
{
control::FieldMode::fieldModeEnabled(value);
- helper.enableFieldMode();
+ auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
+ SYSTEMD_INTERFACE, "StartUnit");
+ method.append("obmc-flash-bmc-setenv@fieldmode\\x3dtrue.service",
+ "replace");
+ bus.call_noreply(method);
+
+ method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
+ SYSTEMD_INTERFACE, "StopUnit");
+ method.append("usr-local.mount", "replace");
+ bus.call_noreply(method);
+
+ std::vector<std::string> usrLocal = {"usr-local.mount"};
+
+ method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
+ SYSTEMD_INTERFACE, "MaskUnitFiles");
+ method.append(usrLocal, false, true);
+ bus.call_noreply(method);
}
else if (!value && control::FieldMode::fieldModeEnabled())
{