Clear files in pnor-patch directory on host factory reset
This patch extends the functionality of the host factory reset by
clearing the pnor-patch directory at /usr/local/share/pnor.
Change-Id: I9d4e3838eee3e743bd954fad697ae84deda0518c
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index 03ff20b..becff46 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -327,6 +327,15 @@
void ItemUpdater::reset()
{
+ constexpr static auto patchDir = "/usr/local/share/pnor";
+ if (fs::is_directory(patchDir))
+ {
+ for (const auto& iter : fs::directory_iterator(patchDir))
+ {
+ fs::remove_all(iter);
+ }
+ }
+
for (const auto& it : activations)
{
auto serviceFile = "obmc-flash-bios-ubiclear@pnor-rw-" + it.first +