def __init__(self): Stage.__init__(self) from selpart_gui import SelTable, SelDevice self.devselect = SelDevice(self, [d[0] for d in install.devices]) self.addWidget(self.devselect, False) filesystems = ["ext3", "reiserfs", "ext2", "jfs", "xfs"] # List of mount-point suggestions mountpoints = ["/", "/home", "/boot", "/var", "/opt", "/usr"] self.table = SelTable(self, filesystems, mountpoints) self.addWidget(self.table) self.reinit()
def __init__(self): Stage.__init__(self, moduleDescription) self.device = None self.mounts = install.getmounts() # List of partitions already configured for use. # Each entry has the form [mount-point, device, format, # format-flags, mount-flags] global used_partitions used_partitions = [] parts = install.get_config("partitions", False) if parts: for p in parts.splitlines(): used_partitions.append(p.split(':')) self.table = SelTable() self.devselect = SelDevice([d[0] for d in install.listDevices()], self.setDevice) self.addWidget(self.devselect, False) self.addWidget(self.table)
class Widget(Stage): def getHelp(self): return _("The device partitions used for the Arch Linux installation" " can be manually selected here.\n" "There must be at least an adequately large root ('/')" " partition, but the system can be split over a number of" " partitions, for example it is often desirable to have a" " separate '/home' partition to keep user data separate" " from system data and programs. This can be" " helpful when updating or changing the operating system.\n\n" "Also fairly common are separate partitions for one or more" " of '/boot', '/opt', '/usr', '/var', but it is advisable to" " inform yourself of the pros and cons before" " considering these.") def __init__(self): Stage.__init__(self, moduleDescription) self.device = None self.mounts = install.getmounts() # List of partitions already configured for use. # Each entry has the form [mount-point, device, format, # format-flags, mount-flags] global used_partitions used_partitions = [] parts = install.get_config("partitions", False) if parts: for p in parts.splitlines(): used_partitions.append(p.split(':')) self.table = SelTable() self.devselect = SelDevice([d[0] for d in install.listDevices()], self.setDevice) self.addWidget(self.devselect, False) self.addWidget(self.table) def setDevice(self, dev): if self.device: self.tidy() self.device = dev dinfo = install.getDeviceInfo(self.device) pinfo = install.getParts(self.device) self.table.clear() for p in install.getlinuxparts(self.device): if not self.ismounted(p): partno = int(re.sub("/dev/[a-z]+", "", p)) for pi in pinfo: size = 0 fstype = "?" if (pi[0] == partno): size = pi[2] * dinfo[3] # bytes fstype = pi[1] break mountp = "" format = "" fflags = "" mflags = "" # If data for partition already set up, get hold of it pdata = None for pc in used_partitions: if (pc[1] == p): pdata = pc mountp = pc[0] format = pc[2] fflags = pc[3] mflags = pc[4] break if not pdata: pdata = [mountp, p, format, fflags, mflags] used_partitions.append(pdata) partobj = Partition(p, size, fstype, pdata) self.table.addrow(partobj) partobj.set_newformat(format) partobj.set_format_flags(fflags) partobj.set_mountpoint(mountp) partobj.set_mount_flags(mflags) self.table.showtable() def ismounted(self, part): return re.search(r'^%s ' % part, self.mounts, re.M) def tidy(self): """Update the information on the partitions in use as stored in the config file "partitions". """ config = "" for p in used_partitions: if (not p[0]) and (not p[2]): # if no mount-point and no format, this is not interesting continue if config: config += "\n" config += "%s:%s:%s:%s:%s" % tuple(p) install.set_config("partitions", config) def forward(self): self.tidy() for p in used_partitions: if (p[0] == '/'): return 0 popupError(_("You must specify a root ('/') partition")) return -1
class SelPart(Stage): def stageTitle(self): return _("Select installation partitions") def getHelp(self): return _( "The device partitions used for the Arch Linux installation" " can be manually selected here.\n" "There must be at least an adequately large root ('/')" " partition, but the system can be split over a number of" " partitions, for example it is often desirable to have a" " separate '/home' partition to keep user data separate" " from system data and programs. This can be" " helpful when updating or changing the operating system.\n\n" "Also fairly common are separate partitions for one or more" " of '/boot', '/opt', '/usr', '/var', but it is advisable to" " inform yourself of the pros and cons before" " considering these." ) def __init__(self): Stage.__init__(self) from selpart_gui import SelTable, SelDevice self.devselect = SelDevice(self, [d[0] for d in install.devices]) self.addWidget(self.devselect, False) filesystems = ["ext3", "reiserfs", "ext2", "jfs", "xfs"] # List of mount-point suggestions mountpoints = ["/", "/home", "/boot", "/var", "/opt", "/usr"] self.table = SelTable(self, filesystems, mountpoints) self.addWidget(self.table) self.reinit() def reinit(self): self.mounts = install.getmounts() self.devselect.setdevice(install.selectedDevice()) def setDevice(self, dev): self.device = dev install.getDeviceInfo(self.device) self.parts = [] for p in install.getlinuxparts(self.device): if not self.ismounted(p): pa = install.getPartition(p) if not pa: partno = int(re.sub("/dev/[a-z]+", "", p)) size, fstype = install.getPartInfo(partno) pa = install.newPartition(p, size, fstype) self.parts.append(pa) self.table.renew(self.parts) def ismounted(self, part): return re.search(r"^%s " % part, self.mounts, re.M) def forward(self): for p in install.parts.values(): if p.mountpoint == "/": mainWindow.goto("swaps") return popupError(_("You must specify a root ('/') partition"))