Only store images from IMG_DIR

New PSU images are uploaded/downloaded to IMG_DIR (normally
/tmp/images).  After all PSUs have been updated with the new image, the
image is copied to IMG_DIR_PERSIST (normally /var/lib/obmc/psu).  This
stores the image in a persistent location that will exist beyond a BMC
reboot.  If a PSU is replaced in the future, and the new PSU has old
code, the PSU image from IMG_DIR_PERSIST is used to update it.

The application currently also copies PSU images from IMG_DIR_BUILTIN
(normally /usr/share/obmc/psu) to IMG_DIR_PERSIST.  This is undesirable
for two reasons:
* Wastes flash space since IMG_DIR_BUILTIN is already persistent.
* IMG_DIR_PERSIST is located in a directory that is shared between both
  BMC images ("A" side and "B" side).  This means the PSU image will be
  found by both BMC images.  This may be undesirable behavior, such as
  if the other BMC image has not been tested with this PSU image.

Modify the storing logic so that only PSU images from IMG_DIR are copied
to IMG_DIR_PERSIST.

Tested:
* Verified that a PSU image in IMG_DIR is copied to IMG_DIR_PERSIST
* Verified that a PSU image in IMG_DIR_PERSIST is not copied to
  IMG_DIR_PERSIST
* Verified that a PSU image in IMG_DIR_BUILTIN is not copied to
  IMG_DIR_PERSIST

Change-Id: I69fbbefffb08374cffcb86b9037780b7a312c459
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/src/activation.cpp b/src/activation.cpp
index 226098c..bfc3b39 100644
--- a/src/activation.cpp
+++ b/src/activation.cpp
@@ -297,15 +297,17 @@
 
 void Activation::storeImage()
 {
-    // Store image in persistent dir separated by model
-    // and only store the latest one by removing old ones
+    // If image is not in IMG_DIR (temporary storage) then exit.  We don't want
+    // to copy from IMG_DIR_PERSIST or IMG_DIR_BUILTIN.
     auto src = path();
-    auto dst = fs::path(IMG_DIR_PERSIST) / model;
-    if (src == dst)
+    if (!src.starts_with(IMG_DIR))
     {
-        // This happens when updating an stored image, no need to store it again
         return;
     }
+
+    // Store image in persistent dir separated by model
+    // and only store the latest one by removing old ones
+    auto dst = fs::path(IMG_DIR_PERSIST) / model;
     try
     {
         fs::remove_all(dst);