本文整理汇总了Python中mic.utils.partitionedfs.PartitionedMount.install方法的典型用法代码示例。如果您正苦于以下问题:Python PartitionedMount.install方法的具体用法?Python PartitionedMount.install怎么用?Python PartitionedMount.install使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mic.utils.partitionedfs.PartitionedMount
的用法示例。
在下文中一共展示了PartitionedMount.install方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DirectImageCreator
# 需要导入模块: from mic.utils.partitionedfs import PartitionedMount [as 别名]
# 或者: from mic.utils.partitionedfs.PartitionedMount import install [as 别名]
#.........这里部分代码省略.........
"'%s' in the ks file")
self._disk_names.append(disk_name)
return self._disk_names
def _full_name(self, name, extention):
""" Construct full file name for a file we generate. """
return "%s-%s.%s" % (self.name, name, extention)
def _full_path(self, path, name, extention):
""" Construct full file path to a file we generate. """
return os.path.join(path, self._full_name(name, extention))
def get_default_source_plugin(self):
"""
The default source plugin i.e. the plugin that's consulted for
overall image generation tasks outside of any particular
partition. For convenience, we just hang it off the
bootloader handler since it's the one non-partition object in
any setup. By default the default plugin is set to the same
plugin as the /boot partition; since we hang it off the
bootloader object, the default can be explicitly set using the
--source bootloader param.
"""
return self.ks.handler.bootloader.source
#
# Actual implemention
#
def _mount_instroot(self, base_on = None):
"""
For 'wic', we already have our build artifacts and don't want
to loop mount anything to install into, we just create
filesystems from the artifacts directly and combine them into
a partitioned image.
We still want to reuse as much of the basic mic machinery
though; despite the fact that we don't actually do loop or any
other kind of mounting we still want to do many of the same
things to prepare images, so we basically just adapt to the
basic framework and reinterpret what 'mounting' means in our
context.
_instroot would normally be something like
/var/tmp/wic/build/imgcreate-s_9AKQ/install_root, for
installing packages, etc. We don't currently need to do that,
so we simplify life by just using /var/tmp/wic/build as our
workdir.
"""
parts = self._get_parts()
self.__instimage = PartitionedMount(self._instroot)
for p in parts:
# as a convenience, set source to the boot partition source
# instead of forcing it to be set via bootloader --source
if not self.ks.handler.bootloader.source and p.mountpoint == "/boot":
self.ks.handler.bootloader.source = p.source
for p in parts:
# need to create the filesystems in order to get their
# sizes before we can add them and do the layout.
# PartitionedMount.mount() actually calls __format_disks()
# to create the disk images and carve out the partitions,
# then self.install() calls PartitionedMount.install()
示例2: DirectImageCreator
# 需要导入模块: from mic.utils.partitionedfs import PartitionedMount [as 别名]
# 或者: from mic.utils.partitionedfs.PartitionedMount import install [as 别名]
#.........这里部分代码省略.........
self._disk_names.append(disk_name)
return self._disk_names
def _full_name(self, name, extention):
""" Construct full file name for a file we generate. """
return "%s-%s.%s" % (self.name, name, extention)
def _full_path(self, path, name, extention):
""" Construct full file path to a file we generate. """
return os.path.join(path, self._full_name(name, extention))
def get_boot_type(self):
""" Determine the boot type from fstype and mountpoint. """
parts = self._get_parts()
boot_type = ""
for p in parts:
if p.mountpoint == "/boot":
if p.fstype == "msdos":
boot_type = "pcbios"
else:
boot_type = p.fstype
return boot_type
#
# Actual implemention
#
def _mount_instroot(self, base_on = None):
"""
For 'wic', we already have our build artifacts and don't want
to loop mount anything to install into, we just create
filesystems from the artifacts directly and combine them into
a partitioned image.
We still want to reuse as much of the basic mic machinery
though; despite the fact that we don't actually do loop or any
other kind of mounting we still want to do many of the same
things to prepare images, so we basically just adapt to the
basic framework and reinterpret what 'mounting' means in our
context.
_instroot would normally be something like
/var/tmp/wic/build/imgcreate-s_9AKQ/install_root, for
installing packages, etc. We don't currently need to do that,
so we simplify life by just using /var/tmp/wic/build as our
workdir.
"""
parts = self._get_parts()
self.__instimage = PartitionedMount(self._instroot)
fstab = self.__write_fstab()
self.boot_type = self.get_boot_type()
if not self.bootimg_dir:
if self.boot_type == "pcbios":
self.bootimg_dir = self.staging_data_dir
elif self.boot_type == "efi":
self.bootimg_dir = self.hdddir
if self.boot_type == "pcbios":
self._create_syslinux_config()