[elbe-devel] [PATCH 2/3] init init-elbe.sh.mako: Handle initvm/finetuning tag

Olivier Dion dion at linutronix.de
Tue May 12 00:03:33 CEST 2020


This allows execution of shell commands in the target.

The heredoc allows for multi-line commands.  For example:
----------------------------------------------------------------------
<command>
	cat <<EOF >> /etc/hosts
	127.0.1.1	thishost.localdomain	thishost
	EOF
</command>
----------------------------------------------------------------------

All commands are cated to the file /buildenv/tmp/elbe-initvm using an
heredoc.  The special heredoc delimiter ELBE_INITVM_FINETUNING_EOF is
used to avoid conflict with user heredoc.  Commands are the executed
in target.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/init/init-elbe.sh.mako | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/elbepack/init/init-elbe.sh.mako b/elbepack/init/init-elbe.sh.mako
index c5d56d3f..5e4cadf8 100644
--- a/elbepack/init/init-elbe.sh.mako
+++ b/elbepack/init/init-elbe.sh.mako
@@ -77,4 +77,15 @@ in-target haveged
   in-target ${elbe_exe} fetch_initvm_pkgs ${buildrepo_opts} /var/cache/elbe/source.xml
 % endif
 
+% if prj.has("finetuning"):
+%   for node in prj.all("./finetuning/"):
+%     if "command" == node.tag:
+	cat <<ELBE_INITVM_FINETUNING_EOF > /buildenv/tmp/elbe-initvm
+${"\n".join(line.lstrip(" \t") for line in node.et.text.strip("\n").splitlines())}
+ELBE_INITVM_FINETUNING_EOF
+	in-target sh /tmp/elbe-initvm
+%     endif
+%   endfor
+% endif
+
 exit 0
-- 
2.26.2




More information about the elbe-devel mailing list