summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/utils/misc.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/utils/misc.py')
-rw-r--r--scripts/lib/wic/utils/misc.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/scripts/lib/wic/utils/misc.py b/scripts/lib/wic/utils/misc.py
deleted file mode 100644
index 7d09f6fc26..0000000000
--- a/scripts/lib/wic/utils/misc.py
+++ /dev/null
@@ -1,56 +0,0 @@
1#!/usr/bin/env python -tt
2#
3# Copyright (c) 2010, 2011 Intel Inc.
4#
5# This program is free software; you can redistribute it and/or modify it
6# under the terms of the GNU General Public License as published by the Free
7# Software Foundation; version 2 of the License
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12# for more details.
13#
14# You should have received a copy of the GNU General Public License along
15# with this program; if not, write to the Free Software Foundation, Inc., 59
16# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18import os
19import time
20import wic.engine
21
22def find_canned(scripts_path, file_name):
23 """
24 Find a file either by its path or by name in the canned files dir.
25
26 Return None if not found
27 """
28 if os.path.exists(file_name):
29 return file_name
30
31 layers_canned_wks_dir = wic.engine.build_canned_image_list(scripts_path)
32 for canned_wks_dir in layers_canned_wks_dir:
33 for root, dirs, files in os.walk(canned_wks_dir):
34 for fname in files:
35 if fname == file_name:
36 fullpath = os.path.join(canned_wks_dir, fname)
37 return fullpath
38
39def get_custom_config(boot_file):
40 """
41 Get the custom configuration to be used for the bootloader.
42
43 Return None if the file can't be found.
44 """
45 scripts_path = os.path.abspath(os.path.dirname(__file__))
46 # Get the scripts path of poky
47 for x in range(0, 3):
48 scripts_path = os.path.dirname(scripts_path)
49
50 cfg_file = find_canned(scripts_path, boot_file)
51 if cfg_file:
52 with open(cfg_file, "r") as f:
53 config = f.read()
54 return config
55
56 return None