Delay return from updateUbootEnvVars() until service file finishes

This commit, as the title might suggest, delays the return from the
function updateUbootEnvVars() until the called service file completes
running. The reason for this change is because the service file runs
asynchronously, so activation seemingly finishes before the priorities
are actually changed.

This is accomplished by adding a generic function waitForServiceFile()
which waits until the completion of a supplied one-shot service file or
until a timeout is reached.

Resolves openbmc/openbmc#2857

Change-Id: I7c0333f510f8239a0b66cc5a20159c91aa2dbdee
Signed-off-by: Michael Tritz <mtritz@us.ibm.com>
Signed-off-by: Saqib Khan <khansa@us.ibm.com>
diff --git a/serialize.hpp b/serialize.hpp
index 03eea99..604aada 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -30,6 +30,13 @@
  **/
 void removeFile(std::string versionId);
 
+/** @brief Delays until the completion of the supplied service file or until
+ *  specified timeout is reached.
+ *  @param[in] serviceFile - Service file to wait for.
+ *  @param[in] timeout - Fallback timeout so we don't get stuck.
+ **/
+void waitForServiceFile(const std::string& serviceFile, int timeout);
+
 } // namespace phosphor
 } // namespace software
 } // namespace openpower