diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2020-04-19 08:35:32 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-04-26 14:00:50 +0100 |
commit | 19e778fe1b021a84d14af97141cb8373d89dd44c (patch) | |
tree | e5471db5855fdd64008f45f86d173b132392652a | |
parent | d19004da2fd40109322990061bb4fe48d91a6150 (diff) | |
download | poky-19e778fe1b021a84d14af97141cb8373d89dd44c.tar.gz |
wic: Continue if excluded_path does not exist
If an excuded path does not exist, continue without an error.
This allows to seamleasly reuse .wks among different projects.
Eg:
part / --source rootfs --fstype=ext4 --exclude-path=opt/private_keys
Where /opt/private_keys in only populated by some of the image.bb files.
Cc: Paul Barker <pbarker@konsulko.com>
(From OE-Core rev: 2dbd692b8e563cf991fb4ae1ef6129fda0d7e3c4)
Signed-off-by: Ricardo Ribalda Delgado <ricardo@ribalda.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/lib/wic/plugins/source/rootfs.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index 85c634f8a1..247f61ff7c 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py | |||
@@ -136,7 +136,6 @@ class RootfsPlugin(SourcePlugin): | |||
136 | sys.exit(1) | 136 | sys.exit(1) |
137 | 137 | ||
138 | full_path = os.path.realpath(os.path.join(new_rootfs, path)) | 138 | full_path = os.path.realpath(os.path.join(new_rootfs, path)) |
139 | |||
140 | # Disallow climbing outside of parent directory using '..', | 139 | # Disallow climbing outside of parent directory using '..', |
141 | # because doing so could be quite disastrous (we will delete the | 140 | # because doing so could be quite disastrous (we will delete the |
142 | # directory). | 141 | # directory). |
@@ -144,6 +143,9 @@ class RootfsPlugin(SourcePlugin): | |||
144 | logger.error("'%s' points to a path outside the rootfs" % orig_path) | 143 | logger.error("'%s' points to a path outside the rootfs" % orig_path) |
145 | sys.exit(1) | 144 | sys.exit(1) |
146 | 145 | ||
146 | if not os.path.lexists(full_path): | ||
147 | continue | ||
148 | |||
147 | if path.endswith(os.sep): | 149 | if path.endswith(os.sep): |
148 | # Delete content only. | 150 | # Delete content only. |
149 | for entry in os.listdir(full_path): | 151 | for entry in os.listdir(full_path): |