[OE-core] [PATCH 2/2] wic/engine.py: Use printf instead of echo

William Bourque wbourque at gmail.com
Mon Feb 11 20:00:51 UTC 2019


Some distributions default shell (ex: /bin/dash)
does not support "-e" argument to echo.
Hence, using "printf" is safer as it, unlike echo,
always inteprets \n correctly.

Signed-off-by: William Bourque <wbourque at gmail.com>
---
 scripts/lib/wic/engine.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 880e464..189253a 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -336,7 +336,7 @@ class Disk:
     def copy(self, src, pnum, path):
         """Copy partition image into wic image."""
         if self.partitions[pnum].fstype.startswith('ext'):
-            cmd = "echo -e 'cd {}\nwrite {} {}' | {} -w {}".\
+            cmd = "printf 'cd {}\nwrite {} {}' | {} -w {}".\
                       format(path, src, os.path.basename(src),
                              self.debugfs, self._get_part_image(pnum))
         else: # fat
-- 
2.7.4


More information about the Openembedded-core mailing list