diff options
Diffstat (limited to 'scripts/lib/mic/conf.py')
-rw-r--r-- | scripts/lib/mic/conf.py | 54 |
1 files changed, 8 insertions, 46 deletions
diff --git a/scripts/lib/mic/conf.py b/scripts/lib/mic/conf.py index e37334cc7a..58fad51f89 100644 --- a/scripts/lib/mic/conf.py +++ b/scripts/lib/mic/conf.py | |||
@@ -23,29 +23,24 @@ from mic import kickstart | |||
23 | from mic.utils import misc, runner, proxy, errors | 23 | from mic.utils import misc, runner, proxy, errors |
24 | 24 | ||
25 | 25 | ||
26 | DEFAULT_GSITECONF = '/etc/mic/mic.conf' | ||
27 | |||
28 | |||
29 | def get_siteconf(): | 26 | def get_siteconf(): |
30 | mic_path = os.path.dirname(__file__) | 27 | mic_path = os.path.dirname(__file__) |
28 | eos = mic_path.find('scripts') + len('scripts') | ||
29 | scripts_path = mic_path[:eos] | ||
31 | 30 | ||
32 | m = re.match(r"(?P<prefix>.*)\/lib(64)?\/.*", mic_path) | 31 | return scripts_path + "/lib/image/config/wic.conf" |
33 | if m and m.group('prefix') != "/usr": | ||
34 | return os.path.join(m.group('prefix'), "etc/mic/mic.conf") | ||
35 | |||
36 | return DEFAULT_GSITECONF | ||
37 | 32 | ||
38 | class ConfigMgr(object): | 33 | class ConfigMgr(object): |
39 | prefer_backends = ["zypp", "yum"] | 34 | prefer_backends = ["zypp", "yum"] |
40 | 35 | ||
41 | DEFAULTS = {'common': { | 36 | DEFAULTS = {'common': { |
42 | "distro_name": "Default Distribution", | 37 | "distro_name": "Default Distribution", |
43 | "plugin_dir": "/usr/lib/mic/plugins", # TODO use prefix also? | 38 | "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also? |
44 | }, | 39 | }, |
45 | 'create': { | 40 | 'create': { |
46 | "tmpdir": '/var/tmp/mic', | 41 | "tmpdir": '/var/tmp/wic', |
47 | "cachedir": '/var/tmp/mic/cache', | 42 | "cachedir": '/var/tmp/wic/cache', |
48 | "outdir": './mic-output', | 43 | "outdir": './wic-output', |
49 | 44 | ||
50 | "arch": None, # None means auto-detect | 45 | "arch": None, # None means auto-detect |
51 | "pkgmgr": "auto", | 46 | "pkgmgr": "auto", |
@@ -75,7 +70,7 @@ class ConfigMgr(object): | |||
75 | "shell": False, | 70 | "shell": False, |
76 | }, | 71 | }, |
77 | 'bootstrap': { | 72 | 'bootstrap': { |
78 | "rootdir": '/var/tmp/mic-bootstrap', | 73 | "rootdir": '/var/tmp/wic-bootstrap', |
79 | "packages": [], | 74 | "packages": [], |
80 | }, | 75 | }, |
81 | } | 76 | } |
@@ -191,39 +186,6 @@ class ConfigMgr(object): | |||
191 | self.create['name_prefix'], | 186 | self.create['name_prefix'], |
192 | self.create['name_suffix']) | 187 | self.create['name_suffix']) |
193 | 188 | ||
194 | msger.info("Retrieving repo metadata:") | ||
195 | ksrepos = misc.get_repostrs_from_ks(ks) | ||
196 | if not ksrepos: | ||
197 | raise errors.KsError('no valid repos found in ks file') | ||
198 | |||
199 | for repo in ksrepos: | ||
200 | if 'baseurl' in repo and repo['baseurl'].startswith("file:"): | ||
201 | repourl = repo['baseurl'].replace('file:', '') | ||
202 | repourl = "/%s" % repourl.lstrip('/') | ||
203 | self.create['localrepos'].append(repourl) | ||
204 | |||
205 | self.create['repomd'] = misc.get_metadata_from_repos( | ||
206 | ksrepos, | ||
207 | self.create['cachedir']) | ||
208 | msger.raw(" DONE") | ||
209 | |||
210 | target_archlist, archlist = misc.get_arch(self.create['repomd']) | ||
211 | if self.create['arch']: | ||
212 | if self.create['arch'] not in archlist: | ||
213 | raise errors.ConfigError("Invalid arch %s for repository. " | ||
214 | "Valid arches: %s" \ | ||
215 | % (self.create['arch'], ', '.join(archlist))) | ||
216 | else: | ||
217 | if len(target_archlist) == 1: | ||
218 | self.create['arch'] = str(target_archlist[0]) | ||
219 | msger.info("\nUse detected arch %s." % target_archlist[0]) | ||
220 | else: | ||
221 | raise errors.ConfigError("Please specify a valid arch, " | ||
222 | "the choice can be: %s" \ | ||
223 | % ', '.join(archlist)) | ||
224 | |||
225 | kickstart.resolve_groups(self.create, self.create['repomd']) | ||
226 | |||
227 | # check selinux, it will block arm and btrfs image creation | 189 | # check selinux, it will block arm and btrfs image creation |
228 | misc.selinux_check(self.create['arch'], | 190 | misc.selinux_check(self.create['arch'], |
229 | [p.fstype for p in ks.handler.partition.partitions]) | 191 | [p.fstype for p in ks.handler.partition.partitions]) |