dockerfile-template: Install stdout-flush-wrapper.sh script into image

This script is to workaround an apparent LAVA race condition, when it
detects "EOF" (i.e. app termination) before it reads out all the stdout
from the app (FVP in this case). The wrapper explicitly runs a command
in line-buffered mode, that helps a little (LAVA reads more output),
but not completely, so we just give LAVA more time with some sleep after
command termination.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I16ec7349723ec040f12fd805b5ea372c0b6dc2a3
diff --git a/stdout-flush-wrapper.sh b/stdout-flush-wrapper.sh
new file mode 100755
index 0000000..c164d29
--- /dev/null
+++ b/stdout-flush-wrapper.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+# This script is to workaround an apparent LAVA race condition, when it
+# detects "EOF" (i.e. app termination) before it reads out all the stdout
+# from the app (FVP in this case). The wrapper explicitly runs a command
+# in line-buffered mode, that helps a little (LAVA reads more output),
+# but not completely, so we just give LAVA more time with some sleep after
+# command termination.
+
+cmd="$1"
+shift
+stdbuf -oL "$cmd" "$@"
+sleep 3