Allow specifying subdir for rootfs when using wic -e

Submitted by Volker Vogelhuber on Nov. 27, 2017, 4:20 p.m. | Patch ID: 146225

Details

Message ID 20171127162055.6612-2-v.vogelhuber@digitalendoscopy.de
State New
Headers show

Commit Message

Volker Vogelhuber Nov. 27, 2017, 4:20 p.m.
---
 scripts/lib/wic/ksparser.py              | 1 +
 scripts/lib/wic/partition.py             | 1 +
 scripts/lib/wic/plugins/source/rootfs.py | 7 ++++---
 3 files changed, 6 insertions(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 99b66eebc5..a9e07fcd2f 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -146,6 +146,7 @@  class KickStart():
         part.add_argument("--overhead-factor", type=overheadtype)
         part.add_argument('--part-type')
         part.add_argument('--rootfs-dir')
+        part.add_argument('--rootfs-subdir')
 
         # --size and --fixed-size cannot be specified together; options
         # ----extra-space and --overhead-factor should also raise a parser
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
index b623bb9e6d..b42529ce48 100644
--- a/scripts/lib/wic/partition.py
+++ b/scripts/lib/wic/partition.py
@@ -53,6 +53,7 @@  class Partition():
         self.overhead_factor = args.overhead_factor
         self.part_type = args.part_type
         self.rootfs_dir = args.rootfs_dir
+        self.rootfs_subdir = args.rootfs_subdir
         self.size = args.size
         self.fixed_size = args.fixed_size
         self.source = args.source
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
index aec720fb22..8dcf5a2872 100644
--- a/scripts/lib/wic/plugins/source/rootfs.py
+++ b/scripts/lib/wic/plugins/source/rootfs.py
@@ -83,7 +83,7 @@  class RootfsPlugin(SourcePlugin):
 
         part.rootfs_dir = cls.__get_rootfs_dir(rootfs_dir)
 
-        new_rootfs = None
+        new_rootfs = part.rootfs_dir
         # Handle excluded paths.
         if part.exclude_path is not None:
             # We need a new rootfs directory we can delete files from. Copy to
@@ -121,6 +121,7 @@  class RootfsPlugin(SourcePlugin):
                 else:
                     # Delete whole directory.
                     shutil.rmtree(full_path)
-
+        if not part.rootfs_subdir is None:
+            new_rootfs = os.path.join(new_rootfs, part.rootfs_subdir)
         part.prepare_rootfs(cr_workdir, oe_builddir,
-                            new_rootfs or part.rootfs_dir, native_sysroot)
+                            new_rootfs, native_sysroot)