summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/kickstart
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/wic/kickstart')
-rw-r--r--scripts/lib/wic/kickstart/__init__.py129
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/__init__.py7
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py526
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/wicboot.py65
4 files changed, 0 insertions, 727 deletions
diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py
deleted file mode 100644
index 79b39fbf3f..0000000000
--- a/scripts/lib/wic/kickstart/__init__.py
+++ /dev/null
@@ -1,129 +0,0 @@
1#!/usr/bin/env python -tt
2#
3# Copyright (c) 2007 Red Hat, Inc.
4# Copyright (c) 2009, 2010, 2011 Intel, Inc.
5#
6# This program is free software; you can redistribute it and/or modify it
7# under the terms of the GNU General Public License as published by the Free
8# Software Foundation; version 2 of the License
9#
10# This program is distributed in the hope that it will be useful, but
11# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13# for more details.
14#
15# You should have received a copy of the GNU General Public License along
16# with this program; if not, write to the Free Software Foundation, Inc., 59
17# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19import os, sys, re
20import shutil
21import subprocess
22import string
23
24import pykickstart.sections as kssections
25import pykickstart.commands as kscommands
26import pykickstart.constants as ksconstants
27import pykickstart.errors as kserrors
28import pykickstart.parser as ksparser
29import pykickstart.version as ksversion
30from pykickstart.handlers.control import commandMap
31from pykickstart.handlers.control import dataMap
32
33from wic import msger
34from wic.utils import errors, misc, runner, fs_related as fs
35from custom_commands import wicboot, partition
36
37def read_kickstart(path):
38 """Parse a kickstart file and return a KickstartParser instance.
39
40 This is a simple utility function which takes a path to a kickstart file,
41 parses it and returns a pykickstart KickstartParser instance which can
42 be then passed to an ImageCreator constructor.
43
44 If an error occurs, a CreatorError exception is thrown.
45 """
46
47 #version = ksversion.makeVersion()
48 #ks = ksparser.KickstartParser(version)
49
50 using_version = ksversion.DEVEL
51 commandMap[using_version]["bootloader"] = wicboot.Wic_Bootloader
52 commandMap[using_version]["part"] = partition.Wic_Partition
53 commandMap[using_version]["partition"] = partition.Wic_Partition
54 dataMap[using_version]["PartData"] = partition.Wic_PartData
55 superclass = ksversion.returnClassForVersion(version=using_version)
56
57 class KSHandlers(superclass):
58 def __init__(self):
59 superclass.__init__(self, mapping=commandMap[using_version])
60
61 kickstart = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True)
62
63 try:
64 kickstart.readKickstart(path)
65 except (kserrors.KickstartParseError, kserrors.KickstartError), err:
66 msger.warning("Errors occurred when parsing kickstart file: %s\n" % path)
67 msger.error("%s" % err)
68
69 return kickstart
70
71def get_image_size(kickstart, default=None):
72 __size = 0
73 for part in kickstart.handler.partition.partitions:
74 if part.mountpoint == "/" and part.size:
75 __size = part.size
76 if __size > 0:
77 return int(__size) * 1024L
78 else:
79 return default
80
81def get_image_fstype(kickstart, default=None):
82 for part in kickstart.handler.partition.partitions:
83 if part.mountpoint == "/" and part.fstype:
84 return part.fstype
85 return default
86
87def get_image_fsopts(kickstart, default=None):
88 for part in kickstart.handler.partition.partitions:
89 if part.mountpoint == "/" and part.fsopts:
90 return part.fsopts
91 return default
92
93def get_timeout(kickstart, default=None):
94 if not hasattr(kickstart.handler.bootloader, "timeout"):
95 return default
96 if kickstart.handler.bootloader.timeout is None:
97 return default
98 return int(kickstart.handler.bootloader.timeout)
99
100def get_bootloader_file(kickstart, default=None):
101 if not hasattr(kickstart.handler.bootloader, "configfile"):
102 return default
103 if kickstart.handler.bootloader.configfile is None:
104 return default
105 return kickstart.handler.bootloader.configfile
106
107def get_kernel_args(kickstart, default="ro rd.live.image"):
108 if not hasattr(kickstart.handler.bootloader, "appendLine"):
109 return default
110 if kickstart.handler.bootloader.appendLine is None:
111 return default
112 return "%s %s" %(default, kickstart.handler.bootloader.appendLine)
113
114def get_menu_args(kickstart, default=""):
115 if not hasattr(kickstart.handler.bootloader, "menus"):
116 return default
117 if kickstart.handler.bootloader.menus in (None, ""):
118 return default
119 return "%s" % kickstart.handler.bootloader.menus
120
121def get_default_kernel(kickstart, default=None):
122 if not hasattr(kickstart.handler.bootloader, "default"):
123 return default
124 if not kickstart.handler.bootloader.default:
125 return default
126 return kickstart.handler.bootloader.default
127
128def get_partitions(kickstart):
129 return kickstart.handler.partition.partitions
diff --git a/scripts/lib/wic/kickstart/custom_commands/__init__.py b/scripts/lib/wic/kickstart/custom_commands/__init__.py
deleted file mode 100644
index e4ae40622c..0000000000
--- a/scripts/lib/wic/kickstart/custom_commands/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
1from partition import Wic_Partition
2from partition import Wic_PartData
3
4__all__ = (
5 "Wic_Partition",
6 "Wic_PartData",
7)
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
deleted file mode 100644
index babc006945..0000000000
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ /dev/null
@@ -1,526 +0,0 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# Copyright (c) 2013, Intel Corporation.
5# All rights reserved.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# DESCRIPTION
21# This module provides the OpenEmbedded partition object definitions.
22#
23# AUTHORS
24# Tom Zanussi <tom.zanussi (at] linux.intel.com>
25#
26
27import os
28import tempfile
29import uuid
30from optparse import OptionValueError
31
32from pykickstart.commands.partition import FC4_PartData, FC4_Partition
33from wic.utils.oe.misc import msger, parse_sourceparams
34from wic.utils.oe.misc import exec_cmd, exec_native_cmd
35from wic.plugin import pluginmgr
36
37partition_methods = {
38 "do_stage_partition":None,
39 "do_prepare_partition":None,
40 "do_configure_partition":None,
41}
42
43class Wic_PartData(FC4_PartData):
44 removedKeywords = FC4_PartData.removedKeywords
45 removedAttrs = FC4_PartData.removedAttrs
46
47 def __init__(self, *args, **kwargs):
48 FC4_PartData.__init__(self, *args, **kwargs)
49 self.deleteRemovedAttrs()
50 self.align = kwargs.get("align", None)
51 self.extopts = kwargs.get("extopts", None)
52 self.part_type = kwargs.get("part_type", None)
53 self.source = kwargs.get("source", None)
54 self.sourceparams = kwargs.get("sourceparams", None)
55 self.rootfs = kwargs.get("rootfs-dir", None)
56 self.no_table = kwargs.get("no-table", False)
57 self.extra_space = kwargs.get("extra-space", "10M")
58 self.overhead_factor = kwargs.get("overhead-factor", 1.3)
59 self._use_uuid = False
60 self.uuid = kwargs.get("uuid", None)
61 self.use_uuid = kwargs.get("use-uuid", False)
62 self.source_file = ""
63 self.size = 0
64
65 def _getArgsAsStr(self):
66 retval = FC4_PartData._getArgsAsStr(self)
67
68 if self.align:
69 retval += " --align=%d" % self.align
70 if self.extopts:
71 retval += " --extoptions=%s" % self.extopts
72 if self.part_type:
73 retval += " --part-type=%s" % self.part_type
74 if self.source:
75 retval += " --source=%s" % self.source
76 if self.sourceparams:
77 retval += " --sourceparams=%s" % self.sourceparams
78 if self.rootfs:
79 retval += " --rootfs-dir=%s" % self.rootfs
80 if self.no_table:
81 retval += " --no-table"
82 if self.use_uuid:
83 retval += " --use-uuid"
84 if self.uuid:
85 retval += " --uuid=%s" % self.uuid
86 retval += " --extra-space=%s" % self.extra_space
87 retval += " --overhead-factor=%f" % self.overhead_factor
88
89 return retval
90
91 @property
92 def use_uuid(self):
93 return self._use_uuid
94
95 @use_uuid.setter
96 def use_uuid(self, value):
97 self._use_uuid = value
98 if value and not self.uuid:
99 self.uuid = str(uuid.uuid4())
100
101 def get_rootfs(self):
102 """
103 Acessor for rootfs dir
104 """
105 return self.rootfs
106
107 def set_rootfs(self, rootfs):
108 """
109 Acessor for actual rootfs dir, which must be set by source
110 plugins.
111 """
112 self.rootfs = rootfs
113
114 def get_size(self):
115 """
116 Accessor for partition size, 0 or --size before set_size().
117 """
118 return self.size
119
120 def set_size(self, size):
121 """
122 Accessor for actual partition size, which must be set by source
123 plugins.
124 """
125 self.size = size
126
127 def set_source_file(self, source_file):
128 """
129 Accessor for source_file, the location of the generated partition
130 image, which must be set by source plugins.
131 """
132 self.source_file = source_file
133
134 def get_extra_block_count(self, current_blocks):
135 """
136 The --size param is reflected in self.size (in kB), and we already
137 have current_blocks (1k) blocks, calculate and return the
138 number of (1k) blocks we need to add to get to --size, 0 if
139 we're already there or beyond.
140 """
141 msger.debug("Requested partition size for %s: %d" % \
142 (self.mountpoint, self.size))
143
144 if not self.size:
145 return 0
146
147 requested_blocks = self.size
148
149 msger.debug("Requested blocks %d, current_blocks %d" % \
150 (requested_blocks, current_blocks))
151
152 if requested_blocks > current_blocks:
153 return requested_blocks - current_blocks
154 else:
155 return 0
156
157 def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
158 kernel_dir, native_sysroot):
159 """
160 Prepare content for individual partitions, depending on
161 partition command parameters.
162 """
163 self.sourceparams_dict = {}
164
165 if self.sourceparams:
166 self.sourceparams_dict = parse_sourceparams(self.sourceparams)
167
168 if not self.source:
169 if not self.size:
170 msger.error("The %s partition has a size of zero. Please "
171 "specify a non-zero --size for that partition." % \
172 self.mountpoint)
173 if self.fstype and self.fstype == "swap":
174 self.prepare_swap_partition(cr_workdir, oe_builddir,
175 native_sysroot)
176 elif self.fstype:
177 rootfs = "%s/fs_%s.%s.%s" % (cr_workdir, self.label,
178 self.lineno, self.fstype)
179 if os.path.isfile(rootfs):
180 os.remove(rootfs)
181 for prefix in ("ext", "btrfs", "vfat", "squashfs"):
182 if self.fstype.startswith(prefix):
183 method = getattr(self,
184 "prepare_empty_partition_" + prefix)
185 method(rootfs, oe_builddir, native_sysroot)
186 self.source_file = rootfs
187 break
188 return
189
190 plugins = pluginmgr.get_source_plugins()
191
192 if self.source not in plugins:
193 msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
194 "See 'wic list source-plugins' for a list of available"
195 " --sources.\n\tSee 'wic help source-plugins' for "
196 "details on adding a new source plugin." % \
197 (self.source, self.mountpoint))
198
199 self._source_methods = pluginmgr.get_source_plugin_methods(\
200 self.source, partition_methods)
201 self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
202 creator, cr_workdir,
203 oe_builddir,
204 bootimg_dir,
205 kernel_dir,
206 native_sysroot)
207 self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
208 creator, cr_workdir,
209 oe_builddir,
210 bootimg_dir, kernel_dir,
211 native_sysroot)
212 self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
213 creator, cr_workdir,
214 oe_builddir,
215 bootimg_dir, kernel_dir, rootfs_dir,
216 native_sysroot)
217
218 def prepare_rootfs_from_fs_image(self, cr_workdir, oe_builddir,
219 rootfs_dir):
220 """
221 Handle an already-created partition e.g. xxx.ext3
222 """
223 rootfs = oe_builddir
224 du_cmd = "du -Lbks %s" % rootfs
225 out = exec_cmd(du_cmd)
226 rootfs_size = out.split()[0]
227
228 self.size = rootfs_size
229 self.source_file = rootfs
230
231 def prepare_rootfs(self, cr_workdir, oe_builddir, rootfs_dir,
232 native_sysroot):
233 """
234 Prepare content for a rootfs partition i.e. create a partition
235 and fill it from a /rootfs dir.
236
237 Currently handles ext2/3/4, btrfs and vfat.
238 """
239 p_prefix = os.environ.get("PSEUDO_PREFIX", "%s/usr" % native_sysroot)
240 p_localstatedir = os.environ.get("PSEUDO_LOCALSTATEDIR",
241 "%s/../pseudo" % rootfs_dir)
242 p_passwd = os.environ.get("PSEUDO_PASSWD", rootfs_dir)
243 p_nosymlinkexp = os.environ.get("PSEUDO_NOSYMLINKEXP", "1")
244 pseudo = "export PSEUDO_PREFIX=%s;" % p_prefix
245 pseudo += "export PSEUDO_LOCALSTATEDIR=%s;" % p_localstatedir
246 pseudo += "export PSEUDO_PASSWD=%s;" % p_passwd
247 pseudo += "export PSEUDO_NOSYMLINKEXP=%s;" % p_nosymlinkexp
248 pseudo += "%s/usr/bin/pseudo " % native_sysroot
249
250 rootfs = "%s/rootfs_%s.%s.%s" % (cr_workdir, self.label,
251 self.lineno, self.fstype)
252 if os.path.isfile(rootfs):
253 os.remove(rootfs)
254
255 for prefix in ("ext", "btrfs", "vfat", "squashfs"):
256 if self.fstype.startswith(prefix):
257 method = getattr(self, "prepare_rootfs_" + prefix)
258 method(rootfs, oe_builddir, rootfs_dir, native_sysroot, pseudo)
259
260 self.source_file = rootfs
261
262 # get the rootfs size in the right units for kickstart (kB)
263 du_cmd = "du -Lbks %s" % rootfs
264 out = exec_cmd(du_cmd)
265 self.size = out.split()[0]
266
267 break
268
269 def prepare_rootfs_ext(self, rootfs, oe_builddir, rootfs_dir,
270 native_sysroot, pseudo):
271 """
272 Prepare content for an ext2/3/4 rootfs partition.
273 """
274 du_cmd = "du -ks %s" % rootfs_dir
275 out = exec_cmd(du_cmd)
276 actual_rootfs_size = int(out.split()[0])
277
278 extra_blocks = self.get_extra_block_count(actual_rootfs_size)
279 if extra_blocks < self.extra_space:
280 extra_blocks = self.extra_space
281
282 rootfs_size = actual_rootfs_size + extra_blocks
283 rootfs_size *= self.overhead_factor
284
285 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
286 (extra_blocks, self.mountpoint, rootfs_size))
287
288 dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
289 (rootfs, rootfs_size)
290 exec_cmd(dd_cmd)
291
292 extra_imagecmd = "-i 8192"
293
294 label_str = ""
295 if self.label:
296 label_str = "-L %s" % self.label
297
298 mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
299 (self.fstype, extra_imagecmd, rootfs, label_str, rootfs_dir)
300 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
301
302 def prepare_rootfs_btrfs(self, rootfs, oe_builddir, rootfs_dir,
303 native_sysroot, pseudo):
304 """
305 Prepare content for a btrfs rootfs partition.
306
307 Currently handles ext2/3/4 and btrfs.
308 """
309 du_cmd = "du -ks %s" % rootfs_dir
310 out = exec_cmd(du_cmd)
311 actual_rootfs_size = int(out.split()[0])
312
313 extra_blocks = self.get_extra_block_count(actual_rootfs_size)
314 if extra_blocks < self.extra_space:
315 extra_blocks = self.extra_space
316
317 rootfs_size = actual_rootfs_size + extra_blocks
318 rootfs_size *= self.overhead_factor
319
320 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
321 (extra_blocks, self.mountpoint, rootfs_size))
322
323 dd_cmd = "dd if=/dev/zero of=%s bs=1024 seek=%d count=0 bs=1k" % \
324 (rootfs, rootfs_size)
325 exec_cmd(dd_cmd)
326
327 label_str = ""
328 if self.label:
329 label_str = "-L %s" % self.label
330
331 mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
332 (self.fstype, rootfs_size * 1024, rootfs_dir, label_str, rootfs)
333 exec_native_cmd(mkfs_cmd, native_sysroot, pseudo=pseudo)
334
335 def prepare_rootfs_vfat(self, rootfs, oe_builddir, rootfs_dir,
336 native_sysroot, pseudo):
337 """
338 Prepare content for a vfat rootfs partition.
339 """
340 du_cmd = "du -bks %s" % rootfs_dir
341 out = exec_cmd(du_cmd)
342 blocks = int(out.split()[0])
343
344 extra_blocks = self.get_extra_block_count(blocks)
345 if extra_blocks < self.extra_space:
346 extra_blocks = self.extra_space
347
348 blocks += extra_blocks
349
350 msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \
351 (extra_blocks, self.mountpoint, blocks))
352
353 # Ensure total sectors is an integral number of sectors per
354 # track or mcopy will complain. Sectors are 512 bytes, and we
355 # generate images with 32 sectors per track. This calculation
356 # is done in blocks, thus the mod by 16 instead of 32. Apply
357 # sector count fix only when needed.
358 if blocks % 16 != 0:
359 blocks += (16 - (blocks % 16))
360
361 label_str = "-n boot"
362 if self.label:
363 label_str = "-n %s" % self.label
364
365 dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
366 exec_native_cmd(dosfs_cmd, native_sysroot)
367
368 mcopy_cmd = "mcopy -i %s -s %s/* ::/" % (rootfs, rootfs_dir)
369 exec_native_cmd(mcopy_cmd, native_sysroot)
370
371 chmod_cmd = "chmod 644 %s" % rootfs
372 exec_cmd(chmod_cmd)
373
374 def prepare_rootfs_squashfs(self, rootfs, oe_builddir, rootfs_dir,
375 native_sysroot, pseudo):
376 """
377 Prepare content for a squashfs rootfs partition.
378 """
379 squashfs_cmd = "mksquashfs %s %s -noappend" % \
380 (rootfs_dir, rootfs)
381 exec_native_cmd(squashfs_cmd, native_sysroot, pseudo=pseudo)
382
383 def prepare_empty_partition_ext(self, rootfs, oe_builddir,
384 native_sysroot):
385 """
386 Prepare an empty ext2/3/4 partition.
387 """
388 dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
389 (rootfs, self.size)
390 exec_cmd(dd_cmd)
391
392 extra_imagecmd = "-i 8192"
393
394 label_str = ""
395 if self.label:
396 label_str = "-L %s" % self.label
397
398 mkfs_cmd = "mkfs.%s -F %s %s %s" % \
399 (self.fstype, extra_imagecmd, label_str, rootfs)
400 exec_native_cmd(mkfs_cmd, native_sysroot)
401
402 def prepare_empty_partition_btrfs(self, rootfs, oe_builddir,
403 native_sysroot):
404 """
405 Prepare an empty btrfs partition.
406 """
407 dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
408 (rootfs, self.size)
409 exec_cmd(dd_cmd)
410
411 label_str = ""
412 if self.label:
413 label_str = "-L %s" % self.label
414
415 mkfs_cmd = "mkfs.%s -b %d %s %s" % \
416 (self.fstype, self.size * 1024, label_str, rootfs)
417 exec_native_cmd(mkfs_cmd, native_sysroot)
418
419 def prepare_empty_partition_vfat(self, rootfs, oe_builddir,
420 native_sysroot):
421 """
422 Prepare an empty vfat partition.
423 """
424 blocks = self.size
425
426 label_str = "-n boot"
427 if self.label:
428 label_str = "-n %s" % self.label
429
430 dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
431 exec_native_cmd(dosfs_cmd, native_sysroot)
432
433 chmod_cmd = "chmod 644 %s" % rootfs
434 exec_cmd(chmod_cmd)
435
436 def prepare_empty_partition_squashfs(self, cr_workdir, oe_builddir,
437 native_sysroot):
438 """
439 Prepare an empty squashfs partition.
440 """
441 msger.warning("Creating of an empty squashfs %s partition was attempted. " \
442 "Proceeding as requested." % self.mountpoint)
443
444 path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
445 os.path.isfile(path) and os.remove(path)
446
447 # it is not possible to create a squashfs without source data,
448 # thus prepare an empty temp dir that is used as source
449 tmpdir = tempfile.mkdtemp()
450
451 squashfs_cmd = "mksquashfs %s %s -noappend" % \
452 (tmpdir, path)
453 exec_native_cmd(squashfs_cmd, native_sysroot)
454
455 os.rmdir(tmpdir)
456
457 # get the rootfs size in the right units for kickstart (kB)
458 du_cmd = "du -Lbks %s" % path
459 out = exec_cmd(du_cmd)
460 fs_size = out.split()[0]
461
462 self.size = fs_size
463
464 def prepare_swap_partition(self, cr_workdir, oe_builddir, native_sysroot):
465 """
466 Prepare a swap partition.
467 """
468 path = "%s/fs.%s" % (cr_workdir, self.fstype)
469
470 dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
471 (path, self.size)
472 exec_cmd(dd_cmd)
473
474 import uuid
475 label_str = ""
476 if self.label:
477 label_str = "-L %s" % self.label
478 mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path)
479 exec_native_cmd(mkswap_cmd, native_sysroot)
480
481
482class Wic_Partition(FC4_Partition):
483 removedKeywords = FC4_Partition.removedKeywords
484 removedAttrs = FC4_Partition.removedAttrs
485
486 def _getParser(self):
487 def overhead_cb(option, opt_str, value, parser):
488 if value < 1:
489 raise OptionValueError("Option %s: invalid value: %r" % \
490 (option, value))
491 setattr(parser.values, option.dest, value)
492
493 parser = FC4_Partition._getParser(self)
494
495 # The alignment value is given in kBytes. e.g., value 8 means that
496 # the partition is aligned to start from 8096 byte boundary.
497 parser.add_option("--align", type="int", action="store", dest="align",
498 default=None)
499 parser.add_option("--extoptions", type="string", action="store", dest="extopts",
500 default=None)
501 parser.add_option("--part-type", type="string", action="store", dest="part_type",
502 default=None)
503 # use specified source file to fill the partition
504 # and calculate partition size
505 parser.add_option("--source", type="string", action="store",
506 dest="source", default=None)
507 # comma-separated list of param=value pairs
508 parser.add_option("--sourceparams", type="string", action="store",
509 dest="sourceparams", default=None)
510 # use specified rootfs path to fill the partition
511 parser.add_option("--rootfs-dir", type="string", action="store",
512 dest="rootfs", default=None)
513 # wether to add the partition in the partition table
514 parser.add_option("--no-table", dest="no_table", action="store_true",
515 default=False)
516 # extra space beyond the partition size
517 parser.add_option("--extra-space", dest="extra_space", action="store",
518 type="size", nargs=1, default="10M")
519 parser.add_option("--overhead-factor", dest="overhead_factor",
520 action="callback", callback=overhead_cb, type="float",
521 nargs=1, default=1.3)
522 parser.add_option("--use-uuid", dest="use_uuid", action="store_true",
523 default=False)
524 parser.add_option("--uuid")
525
526 return parser
diff --git a/scripts/lib/wic/kickstart/custom_commands/wicboot.py b/scripts/lib/wic/kickstart/custom_commands/wicboot.py
deleted file mode 100644
index eb17dab6e1..0000000000
--- a/scripts/lib/wic/kickstart/custom_commands/wicboot.py
+++ /dev/null
@@ -1,65 +0,0 @@
1# ex:ts=4:sw=4:sts=4:et
2# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
3#
4# Copyright (c) 2014, Intel Corporation.
5# All rights reserved.
6#
7# This program is free software; you can redistribute it and/or modify
8# it under the terms of the GNU General Public License version 2 as
9# published by the Free Software Foundation.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# DESCRIPTION
21# This module provides the OpenEmbedded bootloader object definitions.
22#
23# AUTHORS
24# Tom Zanussi <tom.zanussi (at] linux.intel.com>
25#
26from pykickstart.commands.bootloader import F8_Bootloader
27
28class Wic_Bootloader(F8_Bootloader):
29 def __init__(self, writePriority=10, appendLine="", driveorder=None,
30 forceLBA=False, location="", md5pass="", password="",
31 upgrade=False, menus=""):
32 F8_Bootloader.__init__(self, writePriority, appendLine, driveorder,
33 forceLBA, location, md5pass, password, upgrade)
34
35 self.menus = ""
36 self.ptable = "msdos"
37 self.source = ""
38 self.configfile = ""
39
40 def _getArgsAsStr(self):
41 retval = F8_Bootloader._getArgsAsStr(self)
42
43 if self.menus == "":
44 retval += " --menus=%s" %(self.menus,)
45 if self.ptable:
46 retval += " --ptable=\"%s\"" %(self.ptable,)
47 if self.source:
48 retval += " --source=%s" % self.source
49 if self.configfile:
50 retval += " --configfile=%s" % self.configfile
51
52 return retval
53
54 def _getParser(self):
55 parser = F8_Bootloader._getParser(self)
56 parser.add_option("--menus", dest="menus")
57 parser.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"),
58 default="msdos")
59 # use specified source plugin to implement bootloader-specific methods
60 parser.add_option("--source", type="string", action="store",
61 dest="source", default=None)
62 parser.add_option("--configfile", type="string", action="store",
63 dest="configfile", default=None)
64 return parser
65