Add checking ApplyTime for static layout

Add a check for static BMC whether auto reboot to apply update or not.

Tested: Verified with setting ApplyTime to Immediate and using
        obmc-phosphor-image-<platorm>-<timestamp>.static.mtd.all.tar,
        and BMC code update works fine.

Change-Id: I13b77b783746b083e09d96757ad7868fe7660fe3
Signed-off-by: Bright Cheng <bright_cheng@wiwynn.com>
diff --git a/Makefile.am b/Makefile.am
index 293867e..fa74dc8 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -52,7 +52,10 @@
 	xyz.openbmc_project.Software.BMC.Updater.service \
 	xyz.openbmc_project.Software.Download.service \
 	xyz.openbmc_project.Software.Sync.service \
-	xyz.openbmc_project.Software.Version.service
+	xyz.openbmc_project.Software.Version.service \
+	reboot-guard-disable.service \
+	reboot-guard-enable.service \
+	force-reboot.service
 
 if HOST_BIOS_UPGRADE
 systemdsystemunit_DATA += obmc-flash-host-bios@.service
diff --git a/activation.cpp b/activation.cpp
index 382eae0..f891877 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -233,7 +233,17 @@
         // Create active association
         parent.createActiveAssociation(path);
 
-        log<level::INFO>("BMC image ready, need reboot to get activated.");
+        if (Activation::checkApplyTimeImmediate() == true)
+        {
+            log<level::INFO>("Image Active. ApplyTime is immediate, "
+                             "rebooting BMC.");
+            Activation::rebootBmc();
+        }
+        else
+        {
+            log<level::INFO>("BMC image ready, need reboot to get activated.");
+        }
+
         return softwareServer::Activation::activation(
             softwareServer::Activation::Activations::Active);
 #endif
diff --git a/ubi/force-reboot.service b/force-reboot.service
similarity index 100%
rename from ubi/force-reboot.service
rename to force-reboot.service
diff --git a/ubi/reboot-guard-disable.service b/reboot-guard-disable.service
similarity index 100%
rename from ubi/reboot-guard-disable.service
rename to reboot-guard-disable.service
diff --git a/ubi/reboot-guard-enable.service b/reboot-guard-enable.service
similarity index 100%
rename from ubi/reboot-guard-enable.service
rename to reboot-guard-enable.service
diff --git a/ubi/Makefile.am.include b/ubi/Makefile.am.include
index 51ebf57..173251c 100644
--- a/ubi/Makefile.am.include
+++ b/ubi/Makefile.am.include
@@ -11,8 +11,5 @@
 	%reldir%/obmc-flash-bmc-ubiro-remove@.service \
 	%reldir%/obmc-flash-bmc-ubirw.service \
 	%reldir%/obmc-flash-bmc-ubirw-remove.service \
-	%reldir%/obmc-flash-bmc-updateubootvars@.service \
-	%reldir%/reboot-guard-disable.service \
-	%reldir%/reboot-guard-enable.service \
-	%reldir%/force-reboot.service
+	%reldir%/obmc-flash-bmc-updateubootvars@.service
 endif