obmc-flash-bmc: DeleteAll cleanup fixes for alt BMC

A DeleteAll request first deletes individual software D-Bus objects
and their corresponding rofs and kernel UBI volumes, then it calls
the cleanup service to remove UBI volumes that were not part of a
D-Bus object.

1. Only delete the rofs volume during a cleanup, this is the volume
used to create D-Bus objects. Don't delete the kernel volume because
if the system has an alt BMC chip, the backup kernel volume is
deleted as part of this step which is undesirable.

2. Call createenvbackup as part of the cleanup service, to update
the alt environment variables to point to the currently running
image, because DeleteAll will delete all other images so the alt
environment should be updated to point to the remaining image.

Change-Id: Ibde8f9ef275c0536573cf0625c8291096c6cdd6e
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
index 875a90f..d14bcef 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc
@@ -218,10 +218,10 @@
             grep /xyz/openbmc_project/software/ | tail -c 9)
 
     if [[ -z "$activeVersion" ]]; then
-        vols=$(ubinfo -a | grep -e "kernel-" -e "rofs-" | cut -c 14-)
+        vols=$(ubinfo -a | grep "rofs-" | cut -c 14-)
         vols=(${vols})
     else
-        vols=$(ubinfo -a | grep -e "kernel-" -e "rofs-" | \
+        vols=$(ubinfo -a | grep "rofs-" | \
                 grep -v "$activeVersion" | cut -c 14-)
         vols=(${vols})
     fi
diff --git a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-cleanup.service b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-cleanup.service
index 41769a4..f8c9135 100644
--- a/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-cleanup.service
+++ b/meta-phosphor/common/recipes-phosphor/flash/phosphor-software-manager/obmc-flash-bmc-cleanup.service
@@ -1,8 +1,9 @@
 [Unit]
-Description=Clean up UBI volumes unattached to a BMC version
+Description=Clean up UBI volumes unattached to a BMC version after DeleteAll
 
 [Service]
 Type=oneshot
 RemainAfterExit=no
+ExecStartPre=/usr/bin/env obmc-flash-bmc createenvbackup
 ExecStart=/usr/bin/env obmc-flash-bmc ubicleanup
 SyslogIdentifier=obmc-flash-bmc