[elbe-devel] [PATCH] hdimg: fixup copying files to loop partition

John Ogness john.ogness at linutronix.de
Thu Apr 5 10:59:33 CEST 2018


The current implementation uses '*' to copy files to the loop
partition. This has 2 problems:

    1. it will miss hidden files
    2. if the directory is empty, cp returns an error

Fix both of these issues by copying '.' instead of '*'.

Signed-off-by: John Ogness <john.ogness at linutronix.de>
---
 elbepack/hdimg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index e0aab938..3627c030 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -465,7 +465,7 @@ def create_label(outf, disk, part, ppart, fslabel, target, grub):
 
     outf.do('mount /dev/loop0 %s' % os.path.join(target, "imagemnt"))
     outf.do(
-        'cp -a "%s"/* "%s"' %
+        'cp -a "%s/." "%s/"' %
         (os.path.join(
             target, "filesystems", entry.id), os.path.join(
             target, "imagemnt")), allow_fail=True)
-- 
2.11.0




More information about the elbe-devel mailing list