summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--installclass.py2
-rw-r--r--iw/lilo.py20
-rw-r--r--text.py38
-rw-r--r--todo.py69
4 files changed, 74 insertions, 55 deletions
diff --git a/installclass.py b/installclass.py
index 9513968da..2f99352e8 100644
--- a/installclass.py
+++ b/installclass.py
@@ -72,7 +72,7 @@ class Workstation(InstallClass):
self.setLiloInformation("mbr")
self.setHostname("localhost.localdomain")
self.setGroups(["Workstation"])
- self.addToSkipList("lilo")
+ #self.addToSkipList("lilo")
self.addToSkipList("hostname")
self.addToSkipList("network")
self.addToSkipList("package-selection")
diff --git a/iw/lilo.py b/iw/lilo.py
index 73701c8c5..1a0467f93 100644
--- a/iw/lilo.py
+++ b/iw/lilo.py
@@ -25,15 +25,17 @@ class LiloWindow (InstallWindow):
else:
self.type = self.list.selection[0]
if self.list.selection[0] == 0:
- self.todo.setLiloLocation (self.boothd)
+ self.todo.setLiloLocation ("mbr")
else:
- self.todo.setLiloLocation (self.bootpart)
+ self.todo.setLiloLocation ("partition")
if self.bootdisk.get_active ():
self.todo.bootdisk = 1
else:
self.todo.bootdisk = 0
+ self.todo.setLiloImages(self.images)
+
def typeName(self, type):
if (type == 2):
return "Linux extended"
@@ -100,24 +102,16 @@ class LiloWindow (InstallWindow):
self.ignoreSignals = 0
if '/' not in self.todo.mounts.keys (): return None
-
- if self.todo.mounts.has_key ('/boot'):
- self.bootpart = self.todo.mounts['/boot'][0]
- else:
- self.bootpart = self.todo.mounts['/'][0]
- i = len (self.bootpart) - 1
- while i < 0 and self.bootpart[i] in digits:
- i = i - 1
- self.boothd = self.bootpart[0:i]
+ (bootpart, boothd) = self.todo.getLiloOptions()
format = "/dev/%s"
self.radioBox = GtkVBox (FALSE, 10)
group = GtkRadioButton(None,
- ("/dev/%s %s" % (self.boothd, _("Master Boot Record (MBR)"))))
+ ("/dev/%s %s" % (boothd, _("Master Boot Record (MBR)"))))
self.radioBox.pack_start(group, FALSE)
group = GtkRadioButton(group,
- ("/dev/%s %s" % (self.bootpart,
+ ("/dev/%s %s" % (bootpart,
_("First sector of boot partition"))))
self.radioBox.pack_start(group, FALSE)
diff --git a/text.py b/text.py
index bb58efce9..2336c650c 100644
--- a/text.py
+++ b/text.py
@@ -857,14 +857,14 @@ class LiloWindow:
def __call__(self, screen, todo):
if '/' not in todo.mounts.keys (): return INSTALL_NOOP
- if todo.mounts.has_key ('/boot'):
- bootpart = todo.mounts['/boot'][0]
- else:
- bootpart = todo.mounts['/'][0]
- i = len (bootpart) - 1
- while i < 0 and bootpart[i] in digits:
- i = i - 1
- boothd = bootpart[0:i]
+ (bootpart, boothd) = todo.getLiloOptions()
+
+ if (todo.getLiloLocation == "mbr"):
+ default = boothd
+ elif (todo.getLiloLocation == "partition"):
+ default = bootpart
+ else:
+ default = None
format = "/dev/%-11s %s"
locations = []
@@ -874,13 +874,13 @@ class LiloWindow:
# XXX fixme restore state
(rc, sel) = ListboxChoiceWindow (screen, _("LILO Configuration"),
_("Where do you want to install the bootloader?"),
- locations,
+ locations, default = default,
buttons = [ _("OK"), _("Back") ])
if sel == 0:
- todo.setLiloLocation(boothd)
+ todo.setLiloLocation("mbr")
else:
- todo.setLiloLocation(bootpart)
+ todo.setLiloLocation("partition")
if rc == string.lower (_("Back")):
return INSTALL_BACK
@@ -938,7 +938,7 @@ class LiloImagesWindow:
return "%-10s %-25s %-7s %-10s" % ( "/dev/" + device, type, default, label)
def __call__(self, screen, todo):
- images = todo.liloImages
+ images = todo.getLiloImages()
if not images: return
sortedKeys = images.keys()
@@ -948,6 +948,8 @@ class LiloImagesWindow:
( _("Device"), _("Partition type"), _("Default"), _("Boot label")))
listbox = Listbox(5, scroll = 1, returnExit = 1)
+ default = ""
+
foundDos = 0
for n in sortedKeys:
(label, type) = images[n]
@@ -958,7 +960,8 @@ class LiloImagesWindow:
images[n] = (label, type)
listbox.append(self.formatDevice(type, label, n, default), n)
- buttons = ButtonBar(screen, [ _("Ok"), _("Edit"), _("Back") ] )
+ buttons = ButtonBar(screen, [ (_("Ok"), "ok"), (_("Edit"), "edit"),
+ (_("Back"), "back") ] )
text = TextboxReflowed(55, _("The boot manager Red Hat uses can boot other "
"operating systems as well. You need to tell me "
@@ -973,7 +976,7 @@ class LiloImagesWindow:
g.addHotKey("F2")
result = None
- while (result != string.lower(_("Ok")) and result != string.lower(_("Back"))):
+ while (result != "ok" and result != "back"):
result = g.run()
if (buttons.buttonPressed(result)):
result = buttons.buttonPressed(result)
@@ -1002,7 +1005,12 @@ class LiloImagesWindow:
screen.popWindow()
- return INSTALL_NOOP
+ if (result == "back"):
+ return INSTALL_BACK
+
+ todo.setLiloImages(images)
+
+ return INSTALL_OK
class BeginInstallWindow:
def __call__ (self, screen, todo):
diff --git a/todo.py b/todo.py
index f73f8d28a..c5085543d 100644
--- a/todo.py
+++ b/todo.py
@@ -6,7 +6,6 @@ import string
import socket
import crypt
import whrandom
-import _balkan
import pcmcia
from simpleconfig import SimpleConfigFile
from mouse import Mouse
@@ -289,11 +288,12 @@ class ToDo:
self.badBlockCheck = 0
self.log = LogFile ()
self.bootdisk = 0
+ self.liloImages = {}
self.liloDevice = None
self.upgrade = 0
self.lilo = LiloConfiguration()
self.initrdsMade = {}
- self.liloImages = {}
+ self.liloImages = []
if (not instClass):
raise TypeError, "installation class expected"
self.setClass(instClass)
@@ -313,40 +313,51 @@ class ToDo:
# XXX
pass
- def getLiloImages(self):
- if self.liloImages:
- return self.liloImages
+ def getLiloOptions(self):
+ if self.mounts.has_key ('/boot'):
+ bootpart = self.mounts['/boot'][0]
+ else:
+ bootpart = self.mounts['/'][0]
+ i = len (bootpart) - 1
+ while i < 0 and bootpart[i] in digits:
+ i = i - 1
+ drives = self.drives.available().keys()
+ drives.sort()
+ boothd = drives[0]
- drives = self.drives.available ().keys ()
- images = {}
- for drive in drives:
- try:
- table = _balkan.readTable ('/tmp/' + drive)
- except SystemError:
- pass
- else:
- for i in range (len (table)):
- (type, sector, size) = table[i]
- if size and (type == 1 or type == 2):
- dev = drive + str (i + 1)
- images[dev] = ("", type)
+ return (bootpart, boothd)
- if (not images): return None
+ def setLiloImages(self, images):
+ self.liloImages = images
+
+ def getLiloImages(self):
+ drives = self.ddruid.partitionList()
+ # rearrange the fstab so it's indexed by device
mountsByDev = {}
for loc in self.mounts.keys():
(device, fsystem, reformat) = self.mounts[loc]
mountsByDev[device] = loc
- for dev in images.keys():
+ oldImages = {}
+ for dev in self.liloImages.keys():
+ oldImages[dev] = self.liloImages[dev]
+
+ self.liloImages = {}
+ for dev in drives:
+ # ext2 partitions get listed if
+ # 1) they're /
+ # 2) they're not mounted
+
if (mountsByDev.has_key(dev)):
if mountsByDev[dev] == '/':
- default = dev
- images[dev] = ("linux", 2)
+ self.liloImages[dev] = ("linux", 2)
+ else:
+ if not oldImages.has_key(dev):
+ self.liloImages[dev] = ("", 2)
else:
- del images[dev]
+ self.liloImages[dev] = oldImages[dev]
- self.liloImages = images
return self.liloImages
def mountFilesystems(self):
@@ -500,6 +511,12 @@ class ToDo:
self.lilo.read (self.instPath + '/etc/lilo.conf')
elif not self.liloDevice: return
+ (bootpart, boothd) = todo.getLiloOptions()
+ if (self.liloDevice == "mbr")
+ self.liloDevice = boothd
+ else
+ self.liloDevice = bootpart
+
if self.liloDevice:
self.lilo.addEntry("boot", '/dev/' + self.liloDevice)
self.lilo.addEntry("map", "/boot/map")
@@ -570,8 +587,8 @@ class ToDo:
w.pop()
return self.hdList
- def setLiloLocation(self, device):
- self.liloDevice = device
+ def setLiloLocation(self, location):
+ self.liloDevice = location
def getLiloLocation (self):
return self.liloDevice