diff options
Diffstat (limited to 'scripts/lib/wic/engine.py')
| -rw-r--r-- | scripts/lib/wic/engine.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 2adef2f99f..4abea87273 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
| @@ -32,7 +32,6 @@ import os | |||
| 32 | import sys | 32 | import sys |
| 33 | 33 | ||
| 34 | from wic import msger, creator | 34 | from wic import msger, creator |
| 35 | from wic.utils import misc | ||
| 36 | from wic.plugin import pluginmgr | 35 | from wic.plugin import pluginmgr |
| 37 | from wic.utils.oe import misc | 36 | from wic.utils.oe import misc |
| 38 | 37 | ||
| @@ -226,3 +225,35 @@ def wic_list(args, scripts_path): | |||
| 226 | return True | 225 | return True |
| 227 | 226 | ||
| 228 | return False | 227 | return False |
| 228 | |||
| 229 | def find_canned(scripts_path, file_name): | ||
| 230 | """ | ||
| 231 | Find a file either by its path or by name in the canned files dir. | ||
| 232 | |||
| 233 | Return None if not found | ||
| 234 | """ | ||
| 235 | if os.path.exists(file_name): | ||
| 236 | return file_name | ||
| 237 | |||
| 238 | layers_canned_wks_dir = build_canned_image_list(scripts_path) | ||
| 239 | for canned_wks_dir in layers_canned_wks_dir: | ||
| 240 | for root, dirs, files in os.walk(canned_wks_dir): | ||
| 241 | for fname in files: | ||
| 242 | if fname == file_name: | ||
| 243 | fullpath = os.path.join(canned_wks_dir, fname) | ||
| 244 | return fullpath | ||
| 245 | |||
| 246 | def get_custom_config(boot_file): | ||
| 247 | """ | ||
| 248 | Get the custom configuration to be used for the bootloader. | ||
| 249 | |||
| 250 | Return None if the file can't be found. | ||
| 251 | """ | ||
| 252 | # Get the scripts path of poky | ||
| 253 | scripts_path = os.path.abspath("%s/../.." % os.path.dirname(__file__)) | ||
| 254 | |||
| 255 | cfg_file = find_canned(scripts_path, boot_file) | ||
| 256 | if cfg_file: | ||
| 257 | with open(cfg_file, "r") as f: | ||
| 258 | config = f.read() | ||
| 259 | return config | ||
