Block host power on when ActivationBlocksTransition exists

Add a dependency to the power on target so that it waits to
start until the ActivationBlocksTransition interface is not
present on any of the Software subtrees, which would indicate
that a code update is in progress.

Closes openbmc/openbmc#1344

Change-Id: I926d209ce4d3106e09e35a35c1e9cfde1ec2f613
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target
index bb7e797..55f6d91 100644
--- a/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target
+++ b/meta-phosphor/common/recipes-core/systemd/obmc-targets/obmc-chassis-poweron@.target
@@ -4,6 +4,8 @@
 After={SYSTEMD_DEFAULT_TARGET}
 Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
 After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
+Wants=mapper-subtree-remove@-xyz-openbmc\x5fproject-software\x3Axyz.openbmc_project.Software.ActivationBlocksTransition.service
+After=mapper-subtree-remove@-xyz-openbmc\x5fproject-software\x3Axyz.openbmc_project.Software.ActivationBlocksTransition.service
 Conflicts=obmc-chassis-poweroff@%i.target
 RefuseManualStop=yes
 OnFailure=obmc-chassis-poweroff@%i.target
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
index 6131bc3..b066604 100644
--- a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
+++ b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper.bb
@@ -14,7 +14,10 @@
 DEPENDS += "autoconf-archive-native"
 
 DBUS_SERVICE_${PN} += "xyz.openbmc_project.ObjectMapper.service"
-SYSTEMD_SERVICE_${PN} = "mapper-wait@.service mapper-wait-until-removed@.service"
+SYSTEMD_SERVICE_${PN} += " \
+        mapper-wait@.service \
+        mapper-subtree-remove@.service \
+        "
 RDEPENDS_libmapper += "libsystemd"
 RDEPENDS_${PN} += " \
         python-xml \
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
new file mode 100644
index 0000000..75dd9ab
--- /dev/null
+++ b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=mapper subtree-remove %I
+Wants=obmc-mapper.target
+After=obmc-mapper.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=no
+Restart=no
+ExecStart={sbindir}/mapper subtree-remove %I
diff --git a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait-until-removed@.service b/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait-until-removed@.service
deleted file mode 100644
index 1dd0124..0000000
--- a/meta-phosphor/common/recipes-phosphor/dbus/phosphor-mapper/mapper-wait-until-removed@.service
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=Wait for %I to be removed
-Wants=obmc-mapper.target
-After=obmc-mapper.target
-
-[Service]
-Type=oneshot
-RemainAfterExit=yes
-Restart=no
-ExecStart={sbindir}/mapper wait-until-removed %I