Fix optional-images for static layout

Ensure that any optional-images specified by the meson build option are
actually copied to /run/initramfs, allowing the system to actually
flash the provided optional-images.

Tested on a modified static layout with an optional image.

Change-Id: Ic48983097e217039b895b70e0cdcad2f0168ad29
Signed-off-by: Ian Woloschin <ian.woloschin@hpe.com>
diff --git a/bmc/static/flash.cpp b/bmc/static/flash.cpp
index a478644..d574787 100644
--- a/bmc/static/flash.cpp
+++ b/bmc/static/flash.cpp
@@ -57,6 +57,13 @@
         fs::copy_file(uploadDir / versionId / bmcImage, toPath / bmcImage,
                       fs::copy_options::overwrite_existing, ec);
     }
+    for (const auto& optionalImaage : getOptionalImages())
+    {
+        std::error_code ec;
+        fs::copy_file(uploadDir / versionId / optionalImaage,
+                      toPath / optionalImaage,
+                      fs::copy_options::overwrite_existing, ec);
+    }
 }
 
 void Activation::onStateChanges([[maybe_unused]] sdbusplus::message_t& msg)