def select_disk(disk): self.selected_disk = disk self.pardus_device = diskutils.parseLinuxDevice(disk[0]) self.other_devices = diskutils.getDeviceMap() self.selected_disk_info = "Selected Pardus disk : %s label: %s "\ % (self.selected_disk[0],self.selected_disk[1]) self.sop_screen()
def makeGrubEntry(title, os_type, root=None, kernel=None, initrd=None, options=None): if os_type not in CONF_SYSTEMS: fail(FAIL_NOSYSTEM) fields_req = CONF_SYSTEMS[os_type][1] fields_opt = CONF_SYSTEMS[os_type][2] fields_all = fields_req + fields_opt if "root" in fields_all: if "root" in fields_req and not root: fail(FAIL_NOROOT) uuid = None if not root.startswith("/dev/"): uuid = root else: try: linux_disk, linux_part, grub_disk, grub_part = parseLinuxDevice(root) except (ValueError, TypeError): fail(FAIL_NODEVICE % root) grub_device = "(%s,%s)" % (grub_disk, grub_part) if "kernel" in fields_req and not kernel: fail(FAIL_NOKERNEL) entry = grubEntry(title) if os_type == "windows": # If Windows is not on first disk... if grub_disk != "hd0": entry.setCommand("map", "(%s) (hd0)" % grub_disk) entry.setCommand("map", "(hd0) (%s)" % grub_disk, append=True) entry.setCommand("rootnoverify", grub_device) entry.setCommand("makeactive", "") entry.setCommand("chainloader", "+1") else: if uuid: entry.setCommand("uuid", uuid) elif root: entry.setCommand("root", grub_device) if os_type == "xen": entry.setCommand("kernel", "/boot/xen.gz") if kernel and "kernel" in fields_all: if options and "options" in fields_all: entry.setCommand("module", "%s %s" % (kernel, options)) else: entry.setCommand("module", kernel) if initrd and "initrd" in fields_all: entry.setCommand("module", initrd, append=True) elif os_type == "memtest": if uuid: entry.setCommand("uuid", uuid) elif root: entry.setCommand("root", grub_device) entry.setCommand("kernel", "/boot/memtest") else: # linux if kernel and "kernel" in fields_all: if options and "options" in fields_all: entry.setCommand("kernel", "%s %s" % (kernel, options)) else: entry.setCommand("kernel", kernel) if initrd and "initrd" in fields_all: entry.setCommand("initrd", initrd) return entry
def makeGrubEntry(title, os_type, root=None, kernel=None, initrd=None, options=None): if os_type not in CONF_SYSTEMS: fail(FAIL_NOSYSTEM) fields_req = CONF_SYSTEMS[os_type][1] fields_opt = CONF_SYSTEMS[os_type][2] fields_all = fields_req + fields_opt if "root" in fields_all: if "root" in fields_req and not root: fail(FAIL_NOROOT) uuid = None if not root.startswith("/dev/") and os_type not in ["windows", "memtest"]: uuid = root else: try: linux_disk, linux_part, grub_disk, grub_part = parseLinuxDevice(root) except (ValueError, TypeError): fail(FAIL_NODEVICE % root) grub_device = "(%s,%s)" % (grub_disk, grub_part) if "kernel" in fields_req and not kernel: fail(FAIL_NOKERNEL) entry = grubEntry(title) if os_type == "windows": # If Windows is not on first disk... if grub_disk != "hd0": entry.setCommand("map", "(%s) (hd0)" % grub_disk) entry.setCommand("map", "(hd0) (%s)" % grub_disk, append=True) entry.setCommand("rootnoverify", grub_device) entry.setCommand("makeactive", "") entry.setCommand("chainloader", "+1") else: if uuid: entry.setCommand("uuid", uuid) elif root: entry.setCommand("root", grub_device) if os_type == "xen": entry.setCommand("kernel", "/boot/xen.gz") if kernel and "kernel" in fields_all: if options and "options" in fields_all: entry.setCommand("module", "%s %s" % (kernel, options)) else: entry.setCommand("module", kernel) if initrd and "initrd" in fields_all: entry.setCommand("module", initrd, append=True) elif os_type == "memtest": if uuid: entry.setCommand("uuid", uuid) elif root: entry.setCommand("root", grub_device) entry.setCommand("kernel", "/boot/memtest") else: # linux if kernel and "kernel" in fields_all: if options and "options" in fields_all: entry.setCommand("kernel", "%s %s" % (kernel, options)) else: entry.setCommand("kernel", kernel) if initrd and "initrd" in fields_all: entry.setCommand("initrd", initrd) return entry