summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/utils/misc.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py
index d886d75b95..1415ae906c 100644
--- a/scripts/lib/wic/utils/misc.py
+++ b/scripts/lib/wic/utils/misc.py
@@ -58,25 +58,23 @@ def build_name(kscfg, release=None, prefix=None, suffix=None):
58 58
59 return ret 59 return ret
60 60
61def find_boot_config(scripts_path, boot_file): 61def find_canned(scripts_path, file_name):
62 """ 62 """
63 Find a config file with the given name in the canned files dir. 63 Find a file either by its path or by name in the canned files dir.
64 64
65 Return False if not found 65 Return None if not found
66 """ 66 """
67 if os.path.exists(boot_file): 67 if os.path.exists(file_name):
68 return boot_file 68 return file_name
69 69
70 layers_canned_wks_dir = wic.engine.build_canned_image_list(scripts_path) 70 layers_canned_wks_dir = wic.engine.build_canned_image_list(scripts_path)
71 for canned_wks_dir in layers_canned_wks_dir: 71 for canned_wks_dir in layers_canned_wks_dir:
72 for root, dirs, files in os.walk(canned_wks_dir): 72 for root, dirs, files in os.walk(canned_wks_dir):
73 for fname in files: 73 for fname in files:
74 if fname == boot_file: 74 if fname == file_name:
75 fullpath = os.path.join(canned_wks_dir, fname) 75 fullpath = os.path.join(canned_wks_dir, fname)
76 return fullpath 76 return fullpath
77 77
78 return None
79
80def get_custom_config(boot_file): 78def get_custom_config(boot_file):
81 """ 79 """
82 Get the custom configuration to be used for the bootloader. 80 Get the custom configuration to be used for the bootloader.
@@ -88,7 +86,7 @@ def get_custom_config(boot_file):
88 for x in range(0, 3): 86 for x in range(0, 3):
89 scripts_path = os.path.dirname(scripts_path) 87 scripts_path = os.path.dirname(scripts_path)
90 88
91 cfg_file = find_boot_config(scripts_path, boot_file) 89 cfg_file = find_canned(scripts_path, boot_file)
92 if cfg_file: 90 if cfg_file:
93 with open(cfg_file, "r") as f: 91 with open(cfg_file, "r") as f:
94 config = f.read() 92 config = f.read()