item_updater_helper: implement factoryReset
helper::factoryReset in the mmc item_updater_helper needs to set the
environment variable rwreset to true so that upon reboot, the mmc
initrd scripts can perform a factory reset by recreating all r/w
volumes.
Tested: Use busctl to call the Reset method. Verify with fw_printenv
that rwreset is set to true.
Signed-off-by: Isaac Kurth <isaac.kurth@ibm.com>
Change-Id: Iea8aa5c359e5f332105b915f58aef7472eae260b
diff --git a/mmc/item_updater_helper.cpp b/mmc/item_updater_helper.cpp
index 03036e9..d3279c0 100644
--- a/mmc/item_updater_helper.cpp
+++ b/mmc/item_updater_helper.cpp
@@ -2,6 +2,8 @@
#include "item_updater_helper.hpp"
+#include "utils.hpp"
+
#include <thread>
namespace phosphor
@@ -28,7 +30,8 @@
void Helper::factoryReset()
{
- // Empty
+ // Mark the read-write partition for recreation upon reboot.
+ utils::execute("/sbin/fw_setenv", "rwreset", "true");
}
void Helper::removeVersion(const std::string& versionId)