reset: Call execute() instead of systemd service
The obmc-flash-bmc-setenv@.service file calls a script that
runs the fw_setenv command. Call the fw_setenv command directly
as an effort to move away from systemd service calls which are
async calls and are harder to monitor for completion.
The only difference is that the script calls fw_setenv twice
because for certain variables such as field mode, the code
parses the actual environment file to get the value, and if
the system supports a redundant environment, then fw_setenv
is needed to be called twice so that the updated value is
reflected in both redundant copies and the code parses the
value correctly.
Factory reset is not a value that is parsed by this code,
so a single call is enough.
Tested: Verified in witherspoon that the rwreset environment
variable was set and factory reset occurred upon reboot.
Change-Id: I76691b1c8c78aa9232074d10d435a3e944b1cd9a
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/ubi/item_updater_helper.cpp b/ubi/item_updater_helper.cpp
index 4cc83c4..873bf17 100644
--- a/ubi/item_updater_helper.cpp
+++ b/ubi/item_updater_helper.cpp
@@ -2,6 +2,8 @@
#include "item_updater_helper.hpp"
+#include "utils.hpp"
+
#include <phosphor-logging/log.hpp>
#include <sdbusplus/exception.hpp>
@@ -47,10 +49,7 @@
void Helper::factoryReset()
{
// Mark the read-write partition for recreation upon reboot.
- auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
- SYSTEMD_INTERFACE, "StartUnit");
- method.append("obmc-flash-bmc-setenv@rwreset\\x3dtrue.service", "replace");
- bus.call_noreply(method);
+ utils::execute("/sbin/fw_setenv", "rwreset", "true");
}
void Helper::removeVersion(const std::string& versionId)