[PATCH 7/7] Update ui screens to use new bootloader module.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Notable is the change in behavior when selecting a boot device. No
longer does this automatically also alter the bios boot order. That
is a separate operation.
---
 pyanaconda/iw/blpasswidget.py               |   19 +--
 pyanaconda/iw/bootloader_main_gui.py        |  103 +++++------------
 pyanaconda/iw/cleardisks_gui.py             |    7 +-
 pyanaconda/iw/osbootwidget.py               |  163 ++++++++++-----------------
 pyanaconda/iw/timezone_gui.py               |    3 +-
 pyanaconda/iw/upgrade_bootloader_gui.py     |   89 +++------------
 pyanaconda/iw/zipl_gui.py                   |   33 +-----
 pyanaconda/textw/partition_text.py          |    4 +-
 pyanaconda/textw/timezone_text.py           |    6 +-
 pyanaconda/textw/upgrade_bootloader_text.py |  102 +++--------------
 pyanaconda/textw/zipl_text.py               |   52 ++-------
 11 files changed, 148 insertions(+), 433 deletions(-)

diff --git a/pyanaconda/iw/blpasswidget.py b/pyanaconda/iw/blpasswidget.py
index 4b377b5..49316df 100644
--- a/pyanaconda/iw/blpasswidget.py
+++ b/pyanaconda/iw/blpasswidget.py
@@ -31,12 +31,11 @@ class BootloaderPasswordWidget:
         self.parent = parent
         self.intf = anaconda.intf
 
-        if anaconda.bootloader.getPassword():
-            usePass = 1
-            self.password = anaconda.bootloader.getPassword()
+        self.password = anaconda.platform.bootloader.password
+        if self.password:
+            usePass = True
         else:
-            usePass = 0
-            self.password = None
+            usePass = False
 
         vbox = gtk.VBox(False, 6)
 
@@ -44,12 +43,8 @@ class BootloaderPasswordWidget:
         self.usePassCb = gtk.CheckButton(_("_Use a boot loader password"))
         self.usePassCb.set_tooltip_text(_("A boot loader password prevents users from changing kernel options, increasing security."))
         self.passButton = gtk.Button("No password")
-        if usePass:
-            self.usePassCb.set_active(True)
-            self.passButton.set_sensitive(True)
-        else:
-            self.usePassCb.set_active(False)
-            self.passButton.set_sensitive(False)
+        self.usePassCb.set_active(usePass)
+        self.passButton.set_sensitive(usePass)
         self.usePassCb.connect("toggled", self.passCallback)
         self.passButton.connect("clicked", self.passButtonCallback)
         self.setPassLabel()
@@ -130,7 +125,7 @@ class BootloaderPasswordWidget:
 
         dialog.show_all()
 
-        while 1:
+        while True:
             rc = dialog.run()
             if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                 rc = False
diff --git a/pyanaconda/iw/bootloader_main_gui.py b/pyanaconda/iw/bootloader_main_gui.py
index 3512026..ed9c9ba 100644
--- a/pyanaconda/iw/bootloader_main_gui.py
+++ b/pyanaconda/iw/bootloader_main_gui.py
@@ -47,24 +47,19 @@ class MainBootloaderWindow(InstallWindow):
     def getNext(self):
         # go ahead and set the device even if we already knew it
         # since that won't change anything
-        self.bl.setDevice(self.bldev)
-
-        self.bl.drivelist = self.driveorder
+        self.bl.stage1_device = self.bldev
+        self.bl.drive_order = self.driveorder
 
         if not self.grubCB.get_active():
             # if we're not installing a boot loader, don't show the second
             # screen and don't worry about other options
             self.dispatch.skipStep("instbootloader", skip = 1)
-
-            # kind of a hack...
-            self.bl.defaultDevice = None
             return
         else:
             self.dispatch.skipStep("instbootloader", skip = 0)
-            self.bl.setUseGrub(1)
 
         # set the password
-        self.bl.setPassword(self.blpass.getPassword(), isCrypted = 0)
+        self.bl.password = self.blpass.getPassword()
 
         # set the bootloader images based on what's in our list
         self.oslist.setBootloaderImages()
@@ -76,23 +71,8 @@ class MainBootloaderWindow(InstallWindow):
             if widget:
                 widget.set_sensitive(active)
 
-
-    def _deviceChange(self, b, anaconda, *args):
-        def __driveChange(combo, dxml, choices):
-            if not choices.has_key("mbr"):
-                return
-
-            iter = combo.get_active_iter()
-            if not iter:
-                return
-
-            first = combo.get_model()[iter][1]
-            desc = choices["mbr"][1]
-            dxml.get_widget("mbrRadio").set_label("%s - /dev/%s" %(_(desc), first))
-            dxml.get_widget("mbrRadio").set_data("bootDevice", first)
-
         def __genStore(combo, disks, active):
-            model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_STRING)
+            model = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
             combo.set_model(model)
             cell = gtk.CellRendererText()
             combo.pack_start(cell, True)
@@ -102,7 +82,7 @@ class MainBootloaderWindow(InstallWindow):
                 i = model.append(None)
                 model[i] = ("%s %8.0f MB %s" %(disk.name, disk.size,
                                                disk.description),
-                            "%s" %(disk.name,))
+                            disk)
                 if disk.name == active:
                     combo.set_active_iter(i)
 
@@ -114,20 +94,32 @@ class MainBootloaderWindow(InstallWindow):
         dialog.set_transient_for(self.parent)
         dialog.show()
 
-        choices = anaconda.platform.bootloaderChoices(self.bl)
+        # XXX for md stage1, should we show md, first member disk, or first
+        #     disk?
+        stage1 = anaconda.platform.bootLoaderDevice
+        stage1_desc = anaconda.bootloader.device_description(stage1)
+        choices = {"mbr": (stage1, stage1_desc)}
+
+        stage2 = anaconda.platform.bootDevice
+        try:
+            stage2_desc = anaconda.bootloader.device_description(stage2)
+        except ValueError:
+            # stage2's type isn't valid as stage1, so don't offer "boot".
+            pass
+        else:
+            choices["boot"] = (stage2, stage2_desc)
+
         for t in ("mbr", "boot"):
             if not choices.has_key(t):
                 continue
             (device, desc) = choices[t]
             w = dxml.get_widget("%sRadio" %(t,))
-            w.set_label("%s - /dev/%s" %(_(desc), device))
+            w.set_label("%s - %s" %(desc, device.path))
             w.show()
-            if self.bldev == device:
-                w.set_active(True)
-            else:
-                w.set_active(False)
+            w.set_active(self.bldev == device)
             w.set_data("bootDevice", device)
 
+        bl_disks = anaconda.platform.bootloader.drives
         for i in range(1, 5):
             if len(self.driveorder) < i:
                 break
@@ -135,15 +127,9 @@ class MainBootloaderWindow(InstallWindow):
             lbl = dxml.get_widget("bd%dLabel" %(i,))
             combo.show()
             lbl.show()
-            partitioned = anaconda.storage.partitioned
-            disks = anaconda.storage.disks
-            bl_disks = [d for d in disks if d in partitioned]
             m = __genStore(combo, bl_disks, self.driveorder[i - 1])
 
-        dxml.get_widget("bd1Combo").connect("changed", __driveChange, dxml, choices)
-        __driveChange(dxml.get_widget("bd1Combo"), dxml, choices)
-
-        while 1:
+        while True:
             rc = dialog.run()
             if rc in [gtk.RESPONSE_CANCEL, gtk.RESPONSE_DELETE_EVENT]:
                 break
@@ -167,62 +153,35 @@ class MainBootloaderWindow(InstallWindow):
                 if not iter:
                     continue
 
-                act = combo.get_model()[iter][1]
+                act = combo.get_model()[iter][1].name
                 if act not in neworder:
                     neworder.append(act)
             for d in self.driveorder:
                 if d not in neworder:
                     neworder.append(d)
             self.driveorder = neworder
-
             break
 
         dialog.destroy()
-        self.grubCB.set_label(_("_Install boot loader on /dev/%s.") %
-                              (self.bldev,))
+        self.grubCB.set_label(_("_Install boot loader on %s.") %
+                              (self.bldev.path,))
         return rc
 
-    def _setBLCBText(self):
-        self.grubCB.set_label(_("_Install boot loader on /dev/%s.") %
-                              (self.bldev,))
-
-
     def getScreen(self, anaconda):
         self.dispatch = anaconda.dispatch
         self.bl = anaconda.bootloader
         self.intf = anaconda.intf
-
-        self.driveorder = self.bl.drivelist
-        if len(self.driveorder) == 0:
-            partitioned = anaconda.storage.partitioned
-            disks = anaconda.storage.disks
-            self.driveorder = [d.name for d in disks if d in partitioned]
-
-        if self.bl.getPassword():
-            self.usePass = 1
-            self.password = self.bl.getPassword()
-        else:
-            self.usePass = 0
-            self.password = None
+        self.driveorder = [d.name for d in self.bl.drives]
 
         thebox = gtk.VBox (False, 12)
         thebox.set_border_width(18)
 
         # make sure we get a valid device to say we're installing to
-        if self.bl.getDevice() is not None:
-            self.bldev = self.bl.getDevice()
-        else:
-            # we don't know what it is yet... if mbr is possible, we want
-            # it, else we want the boot dev
-            choices = anaconda.platform.bootloaderChoices(self.bl)
-            if choices.has_key('mbr'):
-                self.bldev = choices['mbr'][0]
-            else:
-                self.bldev = choices['boot'][0]
+        self.bldev = self.bl.stage1_device
 
         hb = gtk.HBox(False, 12)
-        self.grubCB = gtk.CheckButton(_("_Install boot loader on /dev/%s.") %
-                                      (self.bldev,))
+        self.grubCB = gtk.CheckButton(_("_Install boot loader on %s.") %
+                                      (self.bldev.path,))
         self.grubCB.set_active(not self.dispatch.stepInSkipList("instbootloader"))
         self.grubCB.connect("toggled", self.bootloaderChanged)
         hb.pack_start(self.grubCB, False)
diff --git a/pyanaconda/iw/cleardisks_gui.py b/pyanaconda/iw/cleardisks_gui.py
index a9bdaf0..cd685e8 100644
--- a/pyanaconda/iw/cleardisks_gui.py
+++ b/pyanaconda/iw/cleardisks_gui.py
@@ -57,12 +57,12 @@ class ClearDisksWindow (InstallWindow):
                                              custom_icon="error")
             raise gui.StayOnScreen
 
-        bootDisk = selected[0][OBJECT_COL].name
+        bootDisk = selected[0][OBJECT_COL]
 
         cleardisks.sort(self.anaconda.storage.compareDisks)
 
         self.anaconda.storage.config.clearPartDisks = cleardisks
-        self.anaconda.bootloader.updateDriveList([bootDisk])
+        self.anaconda.bootloader.stage1_device = bootDisk
 
     def getScreen (self, anaconda):
         # We can't just use exclusiveDisks here because of kickstart.  First,
@@ -76,7 +76,6 @@ class ClearDisksWindow (InstallWindow):
         # Skip this screen as well if there's only one disk to use.
         if len(disks) == 1:
             anaconda.storage.config.clearPartDisks = [disks[0].name]
-            anaconda.bootloader.drivelist = [disks[0].name]
             return None
 
         (xml, self.vbox) = gui.getGladeWidget("cleardisks.glade", "vbox")
@@ -160,7 +159,7 @@ class ClearDisksWindow (InstallWindow):
         for d in disks:
             rightVisible = d.name in self.anaconda.storage.config.clearPartDisks
             rightActive = rightVisible and \
-                          d.name in self.anaconda.bootloader.drivelist[:1]
+                          d == self.anaconda.bootloader.drives[0]
             leftVisible = not rightVisible
 
             if hasattr(d, "wwid"):
diff --git a/pyanaconda/iw/osbootwidget.py b/pyanaconda/iw/osbootwidget.py
index 1b18070..b95c303 100644
--- a/pyanaconda/iw/osbootwidget.py
+++ b/pyanaconda/iw/osbootwidget.py
@@ -27,6 +27,7 @@ from pyanaconda import gui
 import datacombo
 from pyanaconda.constants import *
 from pyanaconda.storage.devices import devicePathToName
+import copy
 
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
@@ -34,15 +35,12 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
 class OSBootWidget:
     """Widget to display OSes to boot and allow adding new ones."""
     
-    def __init__(self, anaconda, parent, blname = None):
-        self.bl = anaconda.bootloader
+    def __init__(self, anaconda, parent):
+        self.bl = anaconda.platform.bootloader
         self.storage = anaconda.storage
         self.parent = parent
         self.intf = anaconda.intf
-        if blname is not None:
-            self.blname = blname
-        else:
-            self.blname = "GRUB"
+        self.blname = self.bl.name
 
         self.setIllegalChars()
         
@@ -59,9 +57,8 @@ class OSBootWidget:
         sw.set_size_request(300, 100)
         box.pack_start(sw, True)
 
-
         self.osStore = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING,
-                                     gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)
+                                     gobject.TYPE_STRING, gobject.TYPE_PYOBJECT)
         self.osTreeView = gtk.TreeView(self.osStore)
         theColumns = [ _("Default"), _("Label"), _("Device") ]
 
@@ -86,8 +83,11 @@ class OSBootWidget:
         sw.add(self.osTreeView)
         self.osTreeView.connect('row-activated', self.osTreeActivateCb)
 
-        self.imagelist = self.bl.images.getImages()
-        self.defaultDev = self.bl.images.getDefault()
+        self.images = {}
+        for image in self.bl.images:
+            self.images[image.device.name] = copy.copy(image)
+
+        self.defaultDev = self.bl.default.device
         self.fillOSList()
 
         buttonbar = gtk.VButtonBox()
@@ -126,7 +126,7 @@ class OSBootWidget:
         self.fillOSList()
 
     # adds/edits a new "other" os to the boot loader config
-    def editOther(self, oldDevice, oldLabel, isDefault, isRoot = 0):
+    def editOther(self, image):
         dialog = gtk.Dialog(_("Image"), self.parent)
         dialog.add_button('gtk-cancel', gtk.RESPONSE_CANCEL)
         dialog.add_button('gtk-ok', 1)
@@ -152,7 +152,7 @@ class OSBootWidget:
 
         label = gui.MnemonicLabel(_("_Device"))
         table.attach(label, 0, 1, 2, 3, gtk.FILL, 0, 10)
-        if not isRoot:
+        if image.device != self.storage.rootDevice:
             parts = []
 
             for part in self.storage.partitions:
@@ -168,8 +168,8 @@ class OSBootWidget:
             defindex = 0
             i = 0
             for part in parts:
-                deviceCombo.append(part.path, part.name)
-                if oldDevice and oldDevice == part.name:
+                deviceCombo.append(part.path, part)
+                if image.device and image.device == part:
                     defindex = i
                 i = i + 1
 
@@ -179,22 +179,18 @@ class OSBootWidget:
             table.attach(deviceCombo, 1, 2, 2, 3, gtk.FILL, 0, 10)
             label.set_mnemonic_widget(deviceCombo)
         else:
-            table.attach(gtk.Label(oldDevice), 1, 2, 2, 3, gtk.FILL, 0, 10)
+            table.attach(gtk.Label(image.device.name), 1, 2, 2, 3, gtk.FILL, 0, 10)
 
         default = gtk.CheckButton(_("Default Boot _Target"))
         table.attach(default, 0, 2, 3, 4, gtk.FILL, 0, 10)
-        if isDefault != 0:
-            default.set_active(True)
-
-        if self.numentries == 1 and oldDevice != None:
+        default.set_active(image.device == self.defaultDev)
+        if len(self.images.keys()) == 1 and image.device:
             default.set_sensitive(False)
-        else:
-            default.set_sensitive(True)
 
         dialog.vbox.pack_start(table)
         dialog.show_all()
 
-        while 1:
+        while True:
             rc = dialog.run()
 
             # cancel
@@ -203,10 +199,10 @@ class OSBootWidget:
 
             label = labelEntry.get_text()
 
-            if not isRoot:
+            if not image.device == self.storage.rootDevice:
                 dev = deviceCombo.get_active_value()
             else:
-                dev = oldDevice
+                dev = image.device
 
             if not dev:
                 self.intf.messageWindow(_("Error"),
@@ -235,17 +231,15 @@ class OSBootWidget:
 
             # verify that the label hasn't been used
             foundBad = 0
-            for key in self.imagelist.keys():
-                if dev == key:
+            for key in self.images.keys():
+                if dev.name == key:
                     continue
-                if self.blname == "GRUB":
-                    thisLabel = self.imagelist[key][1]
-                else:
-                    thisLabel = self.imagelist[key][0]
+
+                thisLabel = self.bl.image_label(self.images[key])
 
                 # if the label is the same as it used to be, they must
                 # have changed the device which is fine
-                if thisLabel == oldLabel:
+                if thisLabel == image.label:
                     continue
 
                 if thisLabel == label:
@@ -259,32 +253,23 @@ class OSBootWidget:
                 continue
 
             # they could be duplicating a device, which we don't handle
-            if dev in self.imagelist.keys() and (not oldDevice or
-                                                 dev != oldDevice):
+            if dev.name in self.images.keys() and (not image.device or
+                                                 dev != image.device):
                 self.intf.messageWindow(_("Duplicate Device"),
                                         _("This device is already being "
                                           "used for another boot entry."),
                                         type="warning")
                 continue
 
-            # if we're editing a previous, get what the old info was for
-            # labels.  otherwise, make it something safe for grub and the
-            # device name for lilo for lack of any better ideas
-            if oldDevice:
-                (oldshort, oldlong, oldisroot) = self.imagelist[oldDevice]
-            else:
-                (oldshort, oldlong, oldisroot) = (dev, label, None)
-                
             # if we're editing and the device has changed, delete the old
-            if oldDevice and dev != oldDevice:
-                del self.imagelist[oldDevice]
+            if image.device and dev != image.device:
+                del self.images[image.device.name]
+                image.device = dev
+
+            image.label = label
                 
             # go ahead and add it
-            if self.blname == "GRUB":
-                self.imagelist[dev] = (oldshort, label, isRoot)
-            else:
-                self.imagelist[dev] = (label, oldlong, isRoot)
-
+            self.images[dev.name] = image
             if default.get_active():
                 self.defaultDev = dev
 
@@ -300,27 +285,22 @@ class OSBootWidget:
         if not iter:
             return None
 
-        dev = devicePathToName(model.get_value(iter, 2))
-        label = model.get_value(iter, 1)
-        isRoot = model.get_value(iter, 3)
-        isDefault = model.get_value(iter, 0)
-        return (dev, label, isDefault, isRoot)
-
+        return model.get_value(iter, 3)
 
     def addEntry(self, widget, *args):
-        self.editOther(None, None, 0)
+        image = bootloader.BootLoaderImage(device=None, label=None)
+        self.editOther(image)
 
     def deleteEntry(self, widget, *args):
         rc = self.getSelected()
         if not rc:
             return
-        (dev, label, isDefault, isRoot) = rc
-        if not isRoot:
-            del self.imagelist[dev]
-            if isDefault:
-                keys = self.imagelist.keys()
-                keys.sort()
-                self.defaultDev = keys[0]
+        if image.device != self.storage.rootDevice:
+            del self.images[image.device.name]
+            if image.device == self.defaultDev:
+                devs = [i.device for i in self.images]
+                devs.sort(key=lambda d: d.name)
+                self.defaultDev = devs[0]
                 
             self.fillOSList()
         else:
@@ -335,68 +315,45 @@ class OSBootWidget:
         rc = self.getSelected()
         if not rc:
             return
-        (dev, label, isDefault, isRoot) = rc
-        self.editOther(dev, label, isDefault, isRoot)
+        self.editOther(rc)
 
     # the default os was changed in the treeview
     def toggledDefault(self, data, row):
         iter = self.osStore.get_iter((int(row),))
-        dev = self.osStore.get_value(iter, 2)
-        self.defaultDev = devicePathToName(dev)
+        self.defaultDev = self.osStore.get_value(iter, 3).device
         self.fillOSList()
 
     # fill in the os list tree view
     def fillOSList(self):
         self.osStore.clear()
         
-        keys = self.imagelist.keys()
-        keys.sort()
-
-        for dev in keys:
-            (label, longlabel, fstype) = self.imagelist[dev]
-            device = self.storage.devicetree.getDeviceByName(dev)
-            if self.blname == "GRUB":
-                theLabel = longlabel
-            else:
-                theLabel = label
+        devs = sorted(self.images.keys())
+        for dev in devs:
+            image = self.images[dev]
 
             # if the label is empty, remove from the image list and don't
             # worry about it
-            if not theLabel:
-                del self.imagelist[dev]
+            if not image.label:
+                del self.images[dev]
                 continue
 
-	    isRoot = 0
-            rootDev = self.storage.rootDevice
-            if rootDev and rootDev.name == dev:
-		isRoot = 1
-
-            devPath = getattr(device, "path", "/dev/%s" % dev)
             iter = self.osStore.append()
-            self.osStore.set_value(iter, 1, theLabel)
-            self.osStore.set_value(iter, 2, devPath)
-            self.osStore.set_value(iter, 3, isRoot)
-            if self.defaultDev == dev:
-                self.osStore.set_value(iter, 0, True)
-            else:
-                self.osStore.set_value(iter, 0, False)
-
-        self.numentries = len(keys)
+            self.osStore.set_value(iter, 0, self.defaultDev == image.device)
+            self.osStore.set_value(iter, 1, self.bl.image_label(image))
+            self.osStore.set_value(iter, 2, dev)
+            self.osStore.set_value(iter, 3, image)
 
     def osTreeActivateCb(self, view, path, col):
         self.editEntry(view)
-        
-        
+
     def getWidget(self):
         return self.widget
 
-    # FIXME: I really shouldn't have such intimate knowledge of
-    # the bootloader object
     def setBootloaderImages(self):
-        "Apply the changes from our list into the self.bl object"
-        # make a copy of our image list to shove into the bl struct
-        self.bl.images.images = {}
-        for key in self.imagelist.keys():
-            self.bl.images.images[key] = self.imagelist[key]
-        self.bl.images.setDefault(self.defaultDev)
+        """Apply the changes from our list into the self.bl object."""
+        self.bl.clear_images()
+        for image in self.images.values():
+            self.bl.add_image(image)
+            if image.device == self.defaultDev:
+                self.bl.default = image
         
diff --git a/pyanaconda/iw/timezone_gui.py b/pyanaconda/iw/timezone_gui.py
index 39037ae..0d2313b 100644
--- a/pyanaconda/iw/timezone_gui.py
+++ b/pyanaconda/iw/timezone_gui.py
@@ -25,7 +25,6 @@ from scdate.core import zonetab
 
 from timezone_map_gui import TimezoneMap
 from iw_gui import *
-from pyanaconda.bootloader import hasWindows
 
 from pyanaconda.constants import *
 import gettext
@@ -93,7 +92,7 @@ class TimezoneWindow(InstallWindow):
         self.utcCheckbox.set_active(asUTC)
 
         if not anaconda.ksdata:
-            self.utcCheckbox.set_active(not hasWindows(anaconda.bootloader))
+            self.utcCheckbox.set_active(not anaconda.bootloader.has_windows)
 
         self.notebook.remove(self.vbox)
         return self.vbox
diff --git a/pyanaconda/iw/upgrade_bootloader_gui.py b/pyanaconda/iw/upgrade_bootloader_gui.py
index afbe62b..d9aa335 100644
--- a/pyanaconda/iw/upgrade_bootloader_gui.py
+++ b/pyanaconda/iw/upgrade_bootloader_gui.py
@@ -23,7 +23,6 @@
 from iw_gui import *
 
 import gtk
-from pyanaconda.booty import checkbootloader
 from pyanaconda.storage.devices import devicePathToName
 
 from pyanaconda.constants import *
@@ -41,96 +40,38 @@ class UpgradeBootloaderWindow (InstallWindow):
 
     def getNext(self):
         if self.nobl_radio.get_active():
-            self.dispatch.skipStep("bootloadersetup", skip = 1)
             self.dispatch.skipStep("bootloader", skip = 1)
             self.dispatch.skipStep("instbootloader", skip = 1)
         elif self.newbl_radio.get_active():
-            self.dispatch.skipStep("bootloadersetup", skip = 0)
             self.dispatch.skipStep("bootloader", skip = 0)
             self.dispatch.skipStep("instbootloader", skip = 0)
-            self.bl.doUpgradeOnly = 0
+            self.bl.update_only = False
         else:
-            self.dispatch.skipStep("bootloadersetup", skip = 0)
             self.dispatch.skipStep("bootloader", skip = 1)
             self.dispatch.skipStep("instbootloader", skip = 0)
-            self.bl.doUpgradeOnly = 1
-
-            if self.type == "GRUB":
-                self.bl.useGrubVal = 1
-            else:
-                self.bl.useGrubVal = 0
-            self.bl.setDevice(devicePathToName(self.bootDev))
-
-    def _newToLibata(self, rootPath):
-        # NOTE: any changes here need to be done in upgrade_bootloader_text too
-        try:
-            f = open("/proc/modules", "r")
-            buf = f.read()
-            if buf.find("libata") == -1:
-                return False
-        except:
-            log.debug("error reading /proc/modules")
-            pass
-
-        try:
-            f = open(rootPath + "/etc/modprobe.conf")
-        except:
-            log.debug("error reading /etc/modprobe.conf")
-            return False
-
-        modlines = f.readlines()
-        f.close()
-
-        try:
-            f = open("/tmp/scsidisks")
-        except:
-            log.debug("error reading /tmp/scsidisks")
-            return False
-        mods = []
-        for l in f.readlines():
-            (disk, mod) = l.split()
-            if mod.strip() not in mods:
-                mods.append(mod.strip())
-        f.close()
-
-        for l in modlines:
-            stripped = l.strip()
-
-            if stripped == "" or stripped[0] == "#":
-                continue
-
-            if stripped.find("scsi_hostadapter") != -1:
-                mod = stripped.split()[-1]
-                if mod in mods:
-                    mods.remove(mod)
-
-        if len(mods) > 0:
-            return True
-        return False
+            self.bl.update_only = self.bl.can_update
+
+            self.bl.stage1_device = self.bootDev
 
     def getScreen(self, anaconda):
         self.dispatch = anaconda.dispatch
         self.bl = anaconda.bootloader
 
-        newToLibata = self._newToLibata(anaconda.rootPath)
-
-        (self.type, self.bootDev) = \
-                    checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.storage)
+        # TODO: implement bootloader detection
+        self.type = None
+        self.bootDev = None
 
         self.update_radio = gtk.RadioButton(None, _("_Update boot loader configuration"))
         updatestr = _("This will update your current boot loader.")
 
-        if newToLibata or (self.type is None or self.bootDev is None):
-            if newToLibata:
-                current = _("Due to system changes, your boot loader "
-                            "configuration can not be automatically updated.")
-            else:
-                current = _("The installer is unable to detect the boot loader "
-                            "currently in use on your system.")
+        if (not self.bl.can_update) or \
+           (self.type is None or self.bootDev is None):
+            current = _("The installer is unable to detect the boot loader "
+                        "currently in use on your system.")
             self.update_label = gtk.Label("%s" % (updatestr,))
             self.update_radio.set_sensitive(False)
             self.update_label.set_sensitive(False)
-            update = 0
+            update = False
         else:
             current = _("The installer has detected the %(type)s boot loader "
                         "currently installed on %(bootDev)s.") \
@@ -138,7 +79,7 @@ class UpgradeBootloaderWindow (InstallWindow):
             self.update_label = gtk.Label("%s  %s" % (updatestr,
                                          _("This is the recommended option.")))
             self.update_radio.set_active(False)
-            update = 1
+            update = True
 
         self.newbl_radio = gtk.RadioButton(self.update_radio,
                                           _("_Create new boot loader "
@@ -165,10 +106,8 @@ class UpgradeBootloaderWindow (InstallWindow):
         str = _("What would you like to do?")
         # if they have one, the default is to update, otherwise the
         # default is to not touch anything
-        if update == 1:
+        if update:
             default = self.update_radio
-        elif newToLibata:
-            default = self.newbl_radio
         else:
             default = self.nobl_radio
 
diff --git a/pyanaconda/iw/zipl_gui.py b/pyanaconda/iw/zipl_gui.py
index a4ea01d..81cd0a2 100644
--- a/pyanaconda/iw/zipl_gui.py
+++ b/pyanaconda/iw/zipl_gui.py
@@ -42,8 +42,7 @@ class ZiplWindow (InstallWindow):
 	pass
 
     def getNext (self):
-        self.bl.args.set(self.kernelEntry.get_text())
-
+        self.bl.boot_args.extend(self.kernelEntry.get_text().split())
 
     # ZiplWindow tag="zipl"
     def getScreen(self, anaconda):
@@ -51,10 +50,6 @@ class ZiplWindow (InstallWindow):
 	self.bl = anaconda.bootloader
         self.intf = anaconda.intf
 
-	imageList = self.bl.images.getImages()
-	defaultDevice = self.bl.images.getDefault()
-        self.ignoreSignals = 0
-
         box  = gtk.VBox(False, 5)
         box.set_border_width(5)
 
@@ -90,15 +85,9 @@ class ZiplWindow (InstallWindow):
         label = gtk.Label(_("Kernel Parameters") + ":")
         label.set_alignment(0.0, 0.5)
         self.kernelEntry = gtk.Entry()
-        clabel1 = gtk.Label(_("Chandev Parameters") + ":")
-        clabel1.set_alignment(0.0, 0.5)
-        self.chandeventry1 = gtk.Entry()
-        clabel2 = gtk.Label(_("Chandev Parameters") + ":")
-        clabel2.set_alignment(0.0, 0.5)
-        self.chandeventry2 = gtk.Entry()
 
-        if self.bl.args and self.bl.args.get():
-            kernelparms = self.bl.args.get()
+        if self.bl.args and self.bl.boot_args:
+            kernelparms = str(self.bl.args)
         else:
             kernelparms = ""
         if getDasdPorts() and (kernelparms.find("dasd=") == -1):
@@ -108,25 +97,9 @@ class ZiplWindow (InstallWindow):
                 kernelparms = "dasd=%s" %(getDasdPorts(),)
         self.kernelEntry.set_text(kernelparms)
         
-        if self.bl.args and self.bl.args.chandevget():
-            cdevs = self.bl.args.chandevget()
-            self.chandeventry1.set_text('')
-            self.chandeventry2.set_text('')
-            if len(cdevs) > 0:
-                self.chandeventry1.set_text(cdevs[0])
-            if len(cdevs) > 1:
-                self.chandeventry2.set_text(string.join(cdevs[1:],';'))
         hbox = gtk.HBox(False, 5)
         hbox.pack_start(label, False)
         hbox.pack_start(self.kernelEntry)
         box.pack_start(hbox, False)
-        hbox1 = gtk.HBox(False, 5)
-        hbox1.pack_start(clabel1, False)
-        hbox1.pack_start(self.chandeventry1)
-        box.pack_start(hbox1, False)
-        hbox2 = gtk.HBox(False, 5)
-        hbox2.pack_start(clabel2, False)
-        hbox2.pack_start(self.chandeventry2)
-        box.pack_start(hbox2, False)
 
         return box
diff --git a/pyanaconda/textw/partition_text.py b/pyanaconda/textw/partition_text.py
index 603592f..8a51e05 100644
--- a/pyanaconda/textw/partition_text.py
+++ b/pyanaconda/textw/partition_text.py
@@ -23,7 +23,6 @@
 
 import os, sys
 from pyanaconda import isys
-import string
 import copy
 from pyanaconda import network
 import parted
@@ -55,7 +54,7 @@ class PartitionTypeWindow:
     def __call__(self, screen, anaconda):
         self.anaconda = anaconda
 
-        while 1:
+        while True:
             g = GridFormHelp(screen, _("Partitioning Type"), "autopart", 1, 6)
 
             txt = TextboxReflowed(65, _("Installation requires partitioning of your hard drive.  The default layout is suitable for most users.  Select what space to use and which drives to use as the install target."))
@@ -132,7 +131,6 @@ class PartitionTypeWindow:
                 addDialog = addDriveDialog(anaconda)
                 if addDialog.addDriveDialog(screen) != INSTALL_BACK:
                     anaconda.storage.reset()
-                    anaconda.bootloader.updateDriveList()
                 continue
 
             if res == TEXT_BACK_CHECK:
diff --git a/pyanaconda/textw/timezone_text.py b/pyanaconda/textw/timezone_text.py
index d30ed41..efffc73 100644
--- a/pyanaconda/textw/timezone_text.py
+++ b/pyanaconda/textw/timezone_text.py
@@ -19,12 +19,10 @@
 #
 
 import sys
-import string
 from pyanaconda import iutil
 from time import *
 from snack import *
 from constants_text import *
-from pyanaconda.bootloader import hasWindows
 from scdate.core import zonetab
 
 from pyanaconda.constants import *
@@ -53,7 +51,7 @@ class TimezoneWindow:
 	t = TextboxReflowed(30, 
 			_("In which time zone are you located?"))
 
-        if not anaconda.ksdata and not hasWindows(anaconda.bootloader):
+        if not anaconda.ksdata and not anaconda.bootloader.has_windows:
             asUtc = True
 
 	self.l = Listbox(5, scroll = 1, returnExit = 0)
@@ -73,7 +71,7 @@ class TimezoneWindow:
 	self.g.add(bb, 0, 4, growx = 1)
 
         result = ""
-        while 1:
+        while True:
             result = self.g.run()
             rc = bb.buttonPressed (result)
             
diff --git a/pyanaconda/textw/upgrade_bootloader_text.py b/pyanaconda/textw/upgrade_bootloader_text.py
index 291c7f2..2c29a66 100644
--- a/pyanaconda/textw/upgrade_bootloader_text.py
+++ b/pyanaconda/textw/upgrade_bootloader_text.py
@@ -22,11 +22,8 @@
 from snack import *
 from constants_text import *
 from pyanaconda.flags import flags
-import string
-from pyanaconda.booty import checkbootloader
-from pyanaconda.storage.devices import devicePathToName
-
 from pyanaconda.constants import *
+
 import gettext
 _ = lambda x: gettext.ldgettext("anaconda", x)
 
@@ -34,79 +31,26 @@ import logging
 log = logging.getLogger("anaconda")
 
 class UpgradeBootloaderWindow:
-    def _ideToLibata(self, rootPath):
-        try:
-            f = open("/proc/modules", "r")
-            buf = f.read()
-            if buf.find("libata") == -1:
-                return False
-        except:
-            log.debug("error reading /proc/modules")
-            pass
-
-        try:
-            f = open(rootPath + "/etc/modprobe.conf")
-        except:
-            log.debug("error reading /etc/modprobe.conf")
-            return False
-
-        modlines = f.readlines()
-        f.close()
-
-        try:
-            f = open("/tmp/scsidisks")
-        except:
-            log.debug("error reading /tmp/scsidisks")
-            return False
-        mods = []
-        for l in f.readlines():
-            (disk, mod) = l.split()
-            if mod.strip() not in mods:
-                mods.append(mod.strip())
-        f.close()
-
-        for l in modlines:
-            stripped = l.strip()
-
-            if stripped == "" or stripped[0] == "#":
-                continue
-
-            if stripped.find("scsi_hostadapter") != -1:
-                mod = stripped.split()[-1]
-                if mod in mods:
-                    mods.remove(mod)
-
-        if len(mods) > 0:
-            return True
-        return False
-
     def __call__(self, screen, anaconda):
         self.screen = screen
-        self.dispatch = anaconda.dispatch
-        self.bl = anaconda.bootloader
 
-        newToLibata = self._ideToLibata(anaconda.rootPath)
-        (self.type, self.bootDev) = \
-                    checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath, storage=anaconda.storage)
+        self.type = None
+        self.bootDev = None
 
         blradio = RadioGroup()
 
-        (update, nobl) = (0, 0)
-        if self.dispatch.stepInSkipList("instbootloader"):
-            nobl = 1
-        elif not (newToLibata or self.type is None or self.bootDev is None):
-            update = 1
-
-        if newToLibata or self.type is None or self.bootDev is None:
-            if newToLibata:
-                t = TextboxReflowed(53,
-                    _("Due to system changes, your boot loader "
-                      "configuration can not be automatically updated."))
-            else:
-                t = TextboxReflowed(53,
-                  _("The installer is unable to detect the boot loader "
-                    "currently in use on your system."))
-            
+        update = False
+        nobl = False
+        if anaconda.dispatch.stepInSkipList("instbootloader"):
+            nobl = True
+        elif self.type and self.bootDev:
+            update = True
+
+        if (not anaconda.bootloader.can_update) or \
+           (self.type is None or self.bootDev is None):
+            t = TextboxReflowed(53,
+              _("The installer is unable to detect the boot loader "
+                "currently in use on your system."))
 
             self.update_radio = blradio.add(_("Update boot loader configuration"),
                                             "update", update)
@@ -134,8 +78,7 @@ class UpgradeBootloaderWindow:
         grid.add(self.nobl_radio, 0, 2, (0,0,0,0))
         grid.add(buttons, 0, 3, growx = 1)
 
-
-        while 1:
+        while True:
             result = grid.run()
 
             button = buttons.buttonPressed(result)
@@ -145,22 +88,13 @@ class UpgradeBootloaderWindow:
                 return INSTALL_BACK        
 
             if blradio.getSelection() == "nobl":                           
-                self.dispatch.skipStep("bootloadersetup", skip = 1)
                 self.dispatch.skipStep("bootloader", skip = 1)
                 self.dispatch.skipStep("instbootloader", skip = 1)
+               anaconda.bootloader.update_only = False
             else:
-                self.dispatch.skipStep("bootloadersetup", skip = 0)
                 self.dispatch.skipStep("bootloader", skip = 1)
                 self.dispatch.skipStep("instbootloader", skip = 0)
-                self.bl.doUpgradeOnly = 1
-
-                if self.type == "GRUB":
-                    self.bl.useGrubVal = 1
-                else:
-                    self.bl.useGrubVal = 0
-                self.bl.setDevice(devicePathToName(self.bootDev))
-
-
+                anaconda.bootloader.update_only = anaconda.bootloader.can_update
 
             screen.popWindow()
             return INSTALL_OK
diff --git a/pyanaconda/textw/zipl_text.py b/pyanaconda/textw/zipl_text.py
index 1a546e2..b50b890 100644
--- a/pyanaconda/textw/zipl_text.py
+++ b/pyanaconda/textw/zipl_text.py
@@ -18,7 +18,6 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
 
-import string
 from snack import *
 from constants_text import *
 
@@ -35,33 +34,16 @@ class ZiplWindow:
         t = TextboxReflowed(53,
                          _("The z/IPL Boot Loader will be installed "
                            "on your system after installation is complete. "
-                           "You can now enter any additional kernel and "
-                           "chandev parameters which your machine or your "
-                           "setup require."))
+                           "You can now enter any additional kernel parameters "
+                           "required by your machine or setup."))
 
-        kernelparms = ""
         kernelentry = Entry(48, scroll = 1, returnExit = 1)
-        chandeventry1 = Entry(48, scroll = 1, returnExit = 1)
-        chandeventry2 = Entry(48, scroll = 1, returnExit = 1)
-
-        if self.bl.args and self.bl.args.get():
-            kernelparms = self.bl.args.get()
-        if getDasdPorts() and (kernelparms.find("dasd=") == -1):
-            if len(kernelparms) > 0:
-                kernelparms = "%s dasd=%s" %(kernelparms, getDasdPorts())
-            else:
-                kernelparms = "dasd=%s" %(getDasdPorts(),)
+        kernelparms = str(self.bl.boot_args)
+        dasd_ports = "dasd=%s" % getDasdPorts()
+        if dasd_ports and "dasd" not in self.bl.boot_args:
+            kernelparms += " dasd=%s" % getDasdPorts()
         kernelentry.set(kernelparms)
 
-        if self.bl.args and self.bl.args.chandevget():
-            cdevs = self.bl.args.chandevget()
-            chandeventry1.set('')
-            chandeventry2.set('')
-            if len(cdevs) > 0:
-                chandeventry1.set(cdevs[0])
-            if len(cdevs) > 1:
-                chandeventry2.set(string.join(cdevs[1:],';'))
-
         buttons = ButtonBar(screen, [TEXT_OK_BUTTON,
                             TEXT_BACK_BUTTON ] )
 
@@ -72,15 +54,7 @@ class ZiplWindow:
         sg.setField(Label(_("Kernel Parameters") + ": "), 0, 0, anchorLeft=1)
         sg.setField(kernelentry, 1, 0, anchorLeft=1)
         grid.add(sg, 0, 1, padding = (0, 1, 0, 1))
-        sg = Grid(2, 1)
-        sg.setField(Label(_("Chandev line ") + "1: "), 0, 0, anchorLeft=1)
-        sg.setField(chandeventry1, 1, 0, anchorLeft=1)
-        grid.add(sg, 0, 2, padding = (0, 1, 0, 1))
-        sg = Grid(2, 1)
-        sg.setField(Label(_("Chandev line ") + "2: "), 0, 0, anchorLeft=1)
-        sg.setField(chandeventry2, 1, 0, anchorLeft=1)
-        grid.add(sg, 0, 3, padding = (0, 1, 0, 1))
-        grid.add(buttons, 0, 4, growx = 1)
+        grid.add(buttons, 0, 2, growx = 1)
 
         result = grid.runOnce ()
         button = buttons.buttonPressed(result)
@@ -88,15 +62,5 @@ class ZiplWindow:
         if button == TEXT_BACK_CHECK:
             return INSTALL_BACK
 
-        if kernelentry.value():
-            self.bl.args.set(string.strip(kernelentry.value()))
-        else:
-            self.bl.args.set("")
-
-        cdevs = []
-        if chandeventry1.value():
-            cdevs.append(string.strip(chandeventry1.value()))
-        if chandeventry2.value():
-            cdevs.append(string.strip(chandeventry2.value()))
-        self.bl.args.chandevset(cdevs)
+        self.bl.kernel_args.extend(kernelentry.value().split())
         return INSTALL_OK
-- 
1.7.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux