def fdisk(self, device, size, type): print 'partitioning device %s' % device if self.isMounted(device): print 'device is mounted... umount' if not self.umount(device): print 'umount failed!' return -1 if type == 0: flow = '0,\n;\n;\n;\ny\n' elif type == 1: psize = size / 1048576 / 2 flow = ',%d\n;\n;\n;\ny\n' % psize elif type == 2: psize = size / 1048576 / 4 * 3 flow = ',%d\n;\n;\n;\ny\n' % psize elif type == 3: psize = size / 1048576 / 3 flow = ',%d\n,%d\n;\n;\ny\n' % (psize, psize) elif type == 4: psize = size / 1048576 / 4 flow = ',%d\n,%d\n,%d\n;\ny\n' % (psize, psize, psize) boxinfo = BoxInfo() boxinfo.detectBox() cmd = '%s -f -uM /dev/%s' % (boxinfo.sfdiskBin, device) sfdisk = os.popen(cmd, 'w') sfdisk.write(flow) if sfdisk.close(): return -2 return 0
def fdisk(self, device, size, type): if self.isMounted(device): if not self.umount(device): return -1 if type == 0: flow = '0,\n;\n;\n;\ny\n' elif type == 1: psize = size / 1048576 / 2 flow = ',%d\n;\n;\n;\ny\n' % psize elif type == 2: psize = size / 1048576 / 4 * 3 flow = ',%d\n;\n;\n;\ny\n' % psize elif type == 3: psize = size / 1048576 / 3 flow = ',%d\n,%d\n;\n;\ny\n' % (psize, psize) elif type == 4: psize = size / 1048576 / 4 flow = ',%d\n,%d\n,%d\n;\ny\n' % (psize, psize, psize) boxinfo = BoxInfo() cmd = '%s -f -uM /dev/%s' % (boxinfo.sfdiskBin, device) sfdisk = os.popen(cmd, 'w') sfdisk.write(flow) if sfdisk.close(): return -2 return 0
def __init__(self): self.entries = [] boxinfo = BoxInfo() self.settingsMounts = boxinfo.settingsMounts
def __init__(self): self.entries = [] boxinfo = BoxInfo() boxinfo.detectBox() self.settingsMounts = boxinfo.settingsMounts