diff options
author | Paul Barker <pbarker@konsulko.com> | 2020-01-08 11:25:46 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-01-10 21:18:22 +0000 |
commit | 2c814462484e51d80f354fc3a28fdfb9aa396a5e (patch) | |
tree | 31b74368572c91731e8ad58e5f2b68e1c5bc5c59 /scripts | |
parent | ab6e8dae1e9e3c96cd003b21825df61f553ebdc8 (diff) | |
download | poky-2c814462484e51d80f354fc3a28fdfb9aa396a5e.tar.gz |
wic: Add --include-path argument
This option adds the contents of the given path to a partition built
with the rootfs source plugin. The path is relative to the directory in
which wic is running not the rootfs itself so use of an absolute path
is recommended. This option is most useful when multiple copies of the
rootfs are added to an image and it is required to add extra content to
only one of these copies. This option only has an effect with the
rootfs source plugin.
(From OE-Core rev: d4cd27a9837426e809190548a83c6c7c76505114)
Signed-off-by: Paul Barker <pbarker@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/wic/help.py | 10 | ||||
-rw-r--r-- | scripts/lib/wic/ksparser.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/partition.py | 1 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/rootfs.py | 7 |
4 files changed, 17 insertions, 2 deletions
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index 29c4e436d8..4d342fcf05 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
@@ -969,6 +969,16 @@ DESCRIPTION | |||
969 | is omitted, not the directory itself. This option only | 969 | is omitted, not the directory itself. This option only |
970 | has an effect with the rootfs source plugin. | 970 | has an effect with the rootfs source plugin. |
971 | 971 | ||
972 | --include-path: This option is specific to wic. It adds the contents | ||
973 | of the given path to the resulting image. The path is | ||
974 | relative to the directory in which wic is running not | ||
975 | the rootfs itself so use of an absolute path is | ||
976 | recommended. This option is most useful when multiple | ||
977 | copies of the rootfs are added to an image and it is | ||
978 | required to add extra content to only one of these | ||
979 | copies. This option only has an effect with the rootfs | ||
980 | source plugin. | ||
981 | |||
972 | --extra-space: This option is specific to wic. It adds extra | 982 | --extra-space: This option is specific to wic. It adds extra |
973 | space after the space filled by the content | 983 | space after the space filled by the content |
974 | of the partition. The final size can go | 984 | of the partition. The final size can go |
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py index 6a643ba3af..707a2e8019 100644 --- a/scripts/lib/wic/ksparser.py +++ b/scripts/lib/wic/ksparser.py | |||
@@ -137,6 +137,7 @@ class KickStart(): | |||
137 | part.add_argument('--active', action='store_true') | 137 | part.add_argument('--active', action='store_true') |
138 | part.add_argument('--align', type=int) | 138 | part.add_argument('--align', type=int) |
139 | part.add_argument('--exclude-path', nargs='+') | 139 | part.add_argument('--exclude-path', nargs='+') |
140 | part.add_argument('--include-path', nargs='+') | ||
140 | part.add_argument("--extra-space", type=sizetype) | 141 | part.add_argument("--extra-space", type=sizetype) |
141 | part.add_argument('--fsoptions', dest='fsopts') | 142 | part.add_argument('--fsoptions', dest='fsopts') |
142 | part.add_argument('--fstype', default='vfat', | 143 | part.add_argument('--fstype', default='vfat', |
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index d809408e1a..2d95f78439 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
@@ -30,6 +30,7 @@ class Partition(): | |||
30 | self.device = None | 30 | self.device = None |
31 | self.extra_space = args.extra_space | 31 | self.extra_space = args.extra_space |
32 | self.exclude_path = args.exclude_path | 32 | self.exclude_path = args.exclude_path |
33 | self.include_path = args.include_path | ||
33 | self.fsopts = args.fsopts | 34 | self.fsopts = args.fsopts |
34 | self.fstype = args.fstype | 35 | self.fstype = args.fstype |
35 | self.label = args.label | 36 | self.label = args.label |
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index e26e95b991..705aeb5563 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py | |||
@@ -71,7 +71,7 @@ class RootfsPlugin(SourcePlugin): | |||
71 | 71 | ||
72 | new_rootfs = None | 72 | new_rootfs = None |
73 | # Handle excluded paths. | 73 | # Handle excluded paths. |
74 | if part.exclude_path is not None: | 74 | if part.exclude_path or part.include_path: |
75 | # We need a new rootfs directory we can delete files from. Copy to | 75 | # We need a new rootfs directory we can delete files from. Copy to |
76 | # workdir. | 76 | # workdir. |
77 | new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno)) | 77 | new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno)) |
@@ -81,7 +81,10 @@ class RootfsPlugin(SourcePlugin): | |||
81 | 81 | ||
82 | copyhardlinktree(part.rootfs_dir, new_rootfs) | 82 | copyhardlinktree(part.rootfs_dir, new_rootfs) |
83 | 83 | ||
84 | for orig_path in part.exclude_path: | 84 | for path in part.include_path or []: |
85 | copyhardlinktree(path, new_rootfs) | ||
86 | |||
87 | for orig_path in part.exclude_path or []: | ||
85 | path = orig_path | 88 | path = orig_path |
86 | if os.path.isabs(path): | 89 | if os.path.isabs(path): |
87 | logger.error("Must be relative: --exclude-path=%s" % orig_path) | 90 | logger.error("Must be relative: --exclude-path=%s" % orig_path) |