当前位置: 首页>>代码示例>>Python>>正文


Python PartedServer.write_part_entry方法代码示例

本文整理汇总了Python中ubiquity.parted_server.PartedServer.write_part_entry方法的典型用法代码示例。如果您正苦于以下问题:Python PartedServer.write_part_entry方法的具体用法?Python PartedServer.write_part_entry怎么用?Python PartedServer.write_part_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ubiquity.parted_server.PartedServer的用法示例。


在下文中一共展示了PartedServer.write_part_entry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: progress_stop

# 需要导入模块: from ubiquity.parted_server import PartedServer [as 别名]
# 或者: from ubiquity.parted_server.PartedServer import write_part_entry [as 别名]
    def progress_stop(self, progress_title):
        ret = super(PartmanCommit, self).progress_stop(progress_title)

        if (progress_title == 'partman/progress/init/title' and
            self.manual_input):
            partitions = {}
            parted = PartedServer()
            for disk in parted.disks():
                parted.select_disk(disk)
                for part in parted.partitions():
                    (p_num, p_id, p_size, p_type, p_fs, p_path, p_name) = part
                    partitions[p_path] = (disk, p_id)

            mountpoints = self.frontend.get_mountpoints()
            for device in partitions:
                (disk, p_id) = partitions[device]
                parted.select_disk(disk)
                if device in mountpoints:
                    (path, format, fstype, flags) = mountpoints[device]
                    if path == 'swap':
                        parted.write_part_entry(p_id, 'method', 'swap\n')
                        if format:
                            parted.write_part_entry(p_id, 'format', '')
                        else:
                            parted.remove_part_entry(p_id, 'format')
                        parted.remove_part_entry(p_id, 'use_filesystem')
                    else:
                        if (fstype == 'hfs' and
                            flags is not None and 'boot' in flags):
                            parted.write_part_entry(
                                p_id, 'method', 'newworld\n')
                            parted.write_part_entry(
                                p_id, 'filesystem', 'newworld')
                            parted.remove_part_entry(p_id, 'format')
                            path = None
                        elif format:
                            parted.write_part_entry(p_id, 'method', 'format\n')
                            parted.write_part_entry(p_id, 'format', '')
                            if fstype is None:
                                if parted.has_part_entry(
                                        p_id, 'detected_filesystem'):
                                    fstype = parted.readline_part_entry(
                                        p_id, 'detected_filesystem')
                                else:
                                    # TODO cjwatson 2006-09-27: Why don't we
                                    # know the filesystem type? Fortunately,
                                    # we have an explicit indication from
                                    # the user that it's OK to format this
                                    # filesystem.
                                    fstype = 'ext3'
                            parted.write_part_entry(p_id, 'filesystem', fstype)
                            parted.remove_part_entry(p_id, 'options')
                            parted.mkdir_part_entry(p_id, 'options')
                        else:
                            parted.write_part_entry(p_id, 'method', 'keep\n')
                            parted.remove_part_entry(p_id, 'format')
                            if fstype is not None:
                                parted.write_part_entry(
                                    p_id, 'detected_filesystem', fstype)
                        parted.write_part_entry(p_id, 'use_filesystem', '')
                        if path is not None:
                            parted.write_part_entry(p_id, 'mountpoint', path)
                        else:
                            parted.remove_part_entry(p_id, 'mountpoint')
                elif (parted.has_part_entry(p_id, 'method') and
                      parted.readline_part_entry(p_id, 'method') == 'newworld'):
                    # Leave existing newworld boot partitions alone.
                    pass
                else:
                    parted.remove_part_entry(p_id, 'method')
                    parted.remove_part_entry(p_id, 'format')
                    parted.remove_part_entry(p_id, 'use_filesystem')

        return ret
开发者ID:guadalinex-archive,项目名称:guadalinex-v4,代码行数:76,代码来源:partman_commit.py


注:本文中的ubiquity.parted_server.PartedServer.write_part_entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。