obmc-flash-bmc: Add new Manager service as default

For D-Bus calls that require the service name, use the new
Software.Manager service first since that'll be the default, and if the
call fails, try with the old code update service name:
busctl new || old

We could use the mapper API GetObject to figure out the service name,
but this would add a 2nd D-Bus call, and the new code update service
would be the default so there's no need to make additional calls. In
addition the output of GetObject would need to be parsed. And in some
instances like the call to busctl tree service, there's not a unique
interface under the software/ path to differentiate the service name
from other updaters such as the PSU update manager.

Tested: Code update with new and old service on a p10bmc system.

Change-Id: Ib5c8115006028d7d9341895afab46eb771f8cf33
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/obmc-flash-bmc b/obmc-flash-bmc
index 442bb7a..f9cc4e2 100644
--- a/obmc-flash-bmc
+++ b/obmc-flash-bmc
@@ -70,6 +70,10 @@
 # Set the version path property to the flash location where the image was
 # successfully flashed
 function set_flashid() {
+    busctl set-property xyz.openbmc_project.Software.Manager \
+        "/xyz/openbmc_project/software/${version}" \
+        xyz.openbmc_project.Common.FilePath \
+        Path s "$1" ||
     busctl set-property xyz.openbmc_project.Software.BMC.Updater \
         "/xyz/openbmc_project/software/${version}" \
         xyz.openbmc_project.Common.FilePath \
@@ -225,12 +229,21 @@
 function ubi_cleanup() {
     # When ubi_cleanup is run, it expects one or no active version.
     activeVersion=$(busctl --list --no-pager tree \
-            xyz.openbmc_project.Software.BMC.Updater | \
+            xyz.openbmc_project.Software.Manager | \
         grep /xyz/openbmc_project/software/ | tail -c 9)
 
     if [[ -z "$activeVersion" ]]; then
+        activeVersion=$(busctl --list --no-pager tree \
+                xyz.openbmc_project.Software.BMC.Updater | \
+            grep /xyz/openbmc_project/software/ | tail -c 9)
+    fi
+
+    if [[ -z "$activeVersion" ]]; then
         vols=$(ubinfo -a | grep "rofs-" | cut -c 14-)
     else
+        flashid=$(busctl get-property xyz.openbmc_project.Software.Manager \
+                "/xyz/openbmc_project/software/${activeVersion}" \
+            xyz.openbmc_project.Common.FilePath Path |  awk '{print $NF;}' | tr -d '"') ||
         flashid=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater \
                 "/xyz/openbmc_project/software/${activeVersion}" \
             xyz.openbmc_project.Common.FilePath Path |  awk '{print $NF;}' | tr -d '"')