本文整理匯總了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