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__.py66
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py72
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/wicboot.py12
3 files changed, 75 insertions, 75 deletions
diff --git a/scripts/lib/wic/kickstart/__init__.py b/scripts/lib/wic/kickstart/__init__.py
index 111723b133..c9b0e51f3c 100644
--- a/scripts/lib/wic/kickstart/__init__.py
+++ b/scripts/lib/wic/kickstart/__init__.py
@@ -58,65 +58,65 @@ def read_kickstart(path):
def __init__(self):
superclass.__init__(self, mapping=commandMap[using_version])
- ks = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True)
+ kickstart = ksparser.KickstartParser(KSHandlers(), errorsAreFatal=True)
try:
- ks.readKickstart(path)
+ kickstart.readKickstart(path)
except (kserrors.KickstartParseError, kserrors.KickstartError), err:
msger.warning("Errors occurred when parsing kickstart file: %s\n" % path)
msger.error("%s" % err)
- return ks
+ return kickstart
-def get_image_size(ks, default=None):
+def get_image_size(kickstart, default=None):
__size = 0
- for p in ks.handler.partition.partitions:
- if p.mountpoint == "/" and p.size:
- __size = p.size
+ for part in kickstart.handler.partition.partitions:
+ if part.mountpoint == "/" and part.size:
+ __size = part.size
if __size > 0:
return int(__size) * 1024L
else:
return default
-def get_image_fstype(ks, default=None):
- for p in ks.handler.partition.partitions:
- if p.mountpoint == "/" and p.fstype:
- return p.fstype
+def get_image_fstype(kickstart, default=None):
+ for part in kickstart.handler.partition.partitions:
+ if part.mountpoint == "/" and part.fstype:
+ return part.fstype
return default
-def get_image_fsopts(ks, default=None):
- for p in ks.handler.partition.partitions:
- if p.mountpoint == "/" and p.fsopts:
- return p.fsopts
+def get_image_fsopts(kickstart, default=None):
+ for part in kickstart.handler.partition.partitions:
+ if part.mountpoint == "/" and part.fsopts:
+ return part.fsopts
return default
-def get_timeout(ks, default=None):
- if not hasattr(ks.handler.bootloader, "timeout"):
+def get_timeout(kickstart, default=None):
+ if not hasattr(kickstart.handler.bootloader, "timeout"):
return default
- if ks.handler.bootloader.timeout is None:
+ if kickstart.handler.bootloader.timeout is None:
return default
- return int(ks.handler.bootloader.timeout)
+ return int(kickstart.handler.bootloader.timeout)
-def get_kernel_args(ks, default="ro rd.live.image"):
- if not hasattr(ks.handler.bootloader, "appendLine"):
+def get_kernel_args(kickstart, default="ro rd.live.image"):
+ if not hasattr(kickstart.handler.bootloader, "appendLine"):
return default
- if ks.handler.bootloader.appendLine is None:
+ if kickstart.handler.bootloader.appendLine is None:
return default
- return "%s %s" %(default, ks.handler.bootloader.appendLine)
+ return "%s %s" %(default, kickstart.handler.bootloader.appendLine)
-def get_menu_args(ks, default=""):
- if not hasattr(ks.handler.bootloader, "menus"):
+def get_menu_args(kickstart, default=""):
+ if not hasattr(kickstart.handler.bootloader, "menus"):
return default
- if ks.handler.bootloader.menus in (None, ""):
+ if kickstart.handler.bootloader.menus in (None, ""):
return default
- return "%s" % ks.handler.bootloader.menus
+ return "%s" % kickstart.handler.bootloader.menus
-def get_default_kernel(ks, default=None):
- if not hasattr(ks.handler.bootloader, "default"):
+def get_default_kernel(kickstart, default=None):
+ if not hasattr(kickstart.handler.bootloader, "default"):
return default
- if not ks.handler.bootloader.default:
+ if not kickstart.handler.bootloader.default:
return default
- return ks.handler.bootloader.default
+ return kickstart.handler.bootloader.default
-def get_partitions(ks):
- return ks.handler.partition.partitions
+def get_partitions(kickstart):
+ return kickstart.handler.partition.partitions
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index bac2067a5a..eee25a493d 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -154,7 +154,7 @@ class Wic_PartData(FC4_PartData):
else:
return 0
- def prepare(self, cr, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
+ def prepare(self, creator, cr_workdir, oe_builddir, rootfs_dir, bootimg_dir,
kernel_dir, native_sysroot):
"""
Prepare content for individual partitions, depending on
@@ -199,18 +199,18 @@ class Wic_PartData(FC4_PartData):
self._source_methods = pluginmgr.get_source_plugin_methods(\
self.source, partition_methods)
self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
- cr, cr_workdir,
+ creator, cr_workdir,
oe_builddir,
bootimg_dir,
kernel_dir,
native_sysroot)
self._source_methods["do_stage_partition"](self, self.sourceparams_dict,
- cr, cr_workdir,
+ creator, cr_workdir,
oe_builddir,
bootimg_dir, kernel_dir,
native_sysroot)
self._source_methods["do_prepare_partition"](self, self.sourceparams_dict,
- cr, cr_workdir,
+ creator, cr_workdir,
oe_builddir,
bootimg_dir, kernel_dir, rootfs_dir,
native_sysroot)
@@ -441,21 +441,21 @@ class Wic_PartData(FC4_PartData):
msger.warning("Creating of an empty squashfs %s partition was attempted. " \
"Proceeding as requested." % self.mountpoint)
- fs = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
- os.path.isfile(fs) and os.remove(fs)
+ path = "%s/fs_%s.%s" % (cr_workdir, self.label, self.fstype)
+ os.path.isfile(path) and os.remove(path)
# it is not possible to create a squashfs without source data,
# thus prepare an empty temp dir that is used as source
tmpdir = tempfile.mkdtemp()
squashfs_cmd = "mksquashfs %s %s -noappend" % \
- (tmpdir, fs)
+ (tmpdir, path)
exec_native_cmd(squashfs_cmd, native_sysroot)
os.rmdir(tmpdir)
# get the rootfs size in the right units for kickstart (kB)
- du_cmd = "du -Lbks %s" % fs
+ du_cmd = "du -Lbks %s" % path
out = exec_cmd(du_cmd)
fs_size = out.split()[0]
@@ -465,17 +465,17 @@ class Wic_PartData(FC4_PartData):
"""
Prepare a swap partition.
"""
- fs = "%s/fs.%s" % (cr_workdir, self.fstype)
+ path = "%s/fs.%s" % (cr_workdir, self.fstype)
dd_cmd = "dd if=/dev/zero of=%s bs=1k seek=%d count=0" % \
- (fs, self.size)
+ (path, self.size)
exec_cmd(dd_cmd)
import uuid
label_str = ""
if self.label:
label_str = "-L %s" % self.label
- mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), fs)
+ mkswap_cmd = "mkswap %s -U %s %s" % (label_str, str(uuid.uuid1()), path)
exec_native_cmd(mkswap_cmd, native_sysroot)
@@ -490,37 +490,37 @@ class Wic_Partition(FC4_Partition):
(option, value))
setattr(parser.values, option.dest, value)
- op = FC4_Partition._getParser(self)
+ parser = FC4_Partition._getParser(self)
# The alignment value is given in kBytes. e.g., value 8 means that
# the partition is aligned to start from 8096 byte boundary.
- op.add_option("--align", type="int", action="store", dest="align",
- default=None)
- op.add_option("--extoptions", type="string", action="store", dest="extopts",
- default=None)
- op.add_option("--part-type", type="string", action="store", dest="part_type",
- default=None)
+ parser.add_option("--align", type="int", action="store", dest="align",
+ default=None)
+ parser.add_option("--extoptions", type="string", action="store", dest="extopts",
+ default=None)
+ parser.add_option("--part-type", type="string", action="store", dest="part_type",
+ default=None)
# use specified source file to fill the partition
# and calculate partition size
- op.add_option("--source", type="string", action="store",
- dest="source", default=None)
+ parser.add_option("--source", type="string", action="store",
+ dest="source", default=None)
# comma-separated list of param=value pairs
- op.add_option("--sourceparams", type="string", action="store",
- dest="sourceparams", default=None)
+ parser.add_option("--sourceparams", type="string", action="store",
+ dest="sourceparams", default=None)
# use specified rootfs path to fill the partition
- op.add_option("--rootfs-dir", type="string", action="store",
- dest="rootfs", default=None)
+ parser.add_option("--rootfs-dir", type="string", action="store",
+ dest="rootfs", default=None)
# wether to add the partition in the partition table
- op.add_option("--no-table", dest="no_table", action="store_true",
- default=False)
+ parser.add_option("--no-table", dest="no_table", action="store_true",
+ default=False)
# extra space beyond the partition size
- op.add_option("--extra-space", dest="extra_space", action="store",
- type="size", nargs=1, default="10M")
- op.add_option("--overhead-factor", dest="overhead_factor",
- action="callback", callback=overhead_cb, type="float",
- nargs=1, default=1.3)
- op.add_option("--use-uuid", dest="use_uuid", action="store_true",
- default=False)
- op.add_option("--uuid")
-
- return op
+ parser.add_option("--extra-space", dest="extra_space", action="store",
+ type="size", nargs=1, default="10M")
+ parser.add_option("--overhead-factor", dest="overhead_factor",
+ action="callback", callback=overhead_cb, type="float",
+ nargs=1, default=1.3)
+ parser.add_option("--use-uuid", dest="use_uuid", action="store_true",
+ default=False)
+ parser.add_option("--uuid")
+
+ return parser
diff --git a/scripts/lib/wic/kickstart/custom_commands/wicboot.py b/scripts/lib/wic/kickstart/custom_commands/wicboot.py
index 0230df2f4b..a3e1852be2 100644
--- a/scripts/lib/wic/kickstart/custom_commands/wicboot.py
+++ b/scripts/lib/wic/kickstart/custom_commands/wicboot.py
@@ -49,12 +49,12 @@ class Wic_Bootloader(F8_Bootloader):
return retval
def _getParser(self):
- op = F8_Bootloader._getParser(self)
- op.add_option("--menus", dest="menus")
- op.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"),
- default="msdos")
+ parser = F8_Bootloader._getParser(self)
+ parser.add_option("--menus", dest="menus")
+ parser.add_option("--ptable", dest="ptable", choices=("msdos", "gpt"),
+ default="msdos")
# use specified source plugin to implement bootloader-specific methods
- op.add_option("--source", type="string", action="store",
+ parser.add_option("--source", type="string", action="store",
dest="source", default=None)
- return op
+ return parser