Check if BMC tarball has all required files during image verifcation

In this commit, the image verification process upon BMC image upload is
extended such that the existence of all four image files is verified.
Previously, only the "image-rofs" file was checked.

Resolves openbmc/openbmc#2143

Change-Id: Ieaf774ab12e41a46da53095609d00e007e01421a
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index 80568fe..8bd868b 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -20,7 +20,10 @@
 using namespace phosphor::logging;
 namespace fs = std::experimental::filesystem;
 
-constexpr auto bmcImage = "image-rofs";
+const std::vector<std::string> bmcImages = {"image-kernel",
+                                            "image-rofs",
+                                            "image-rwfs",
+                                            "image-u-boot"};
 
 void ItemUpdater::createActivation(sdbusplus::message::message& msg)
 {
@@ -196,20 +199,27 @@
 ItemUpdater::ActivationStatus ItemUpdater::validateSquashFSImage(
              const std::string& filePath)
 {
+    bool invalid = false;
 
-    fs::path file(filePath);
-    file /= bmcImage;
-    std::ifstream efile(file.c_str());
-
-    if (efile.good() == 1)
+    for (auto& bmcImage : bmcImages)
     {
-        return ItemUpdater::ActivationStatus::ready;
+        fs::path file(filePath);
+        file /= bmcImage;
+        std::ifstream efile(file.c_str());
+        if (efile.good() != 1)
+        {
+            log<level::ERR>("Failed to find the BMC image.",
+                    entry("IMAGE=%s", bmcImage.c_str()));
+            invalid = true;
+        }
     }
-    else
+
+    if (invalid)
     {
-        log<level::ERR>("Failed to find the BMC image.");
         return ItemUpdater::ActivationStatus::invalid;
     }
+
+    return ItemUpdater::ActivationStatus::ready;
 }
 
 void ItemUpdater::freePriority(uint8_t value)