summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakub <jakub>2000-02-16 16:07:06 +0000
committerjakub <jakub>2000-02-16 16:07:06 +0000
commit339eacb1cd2e1bdfc8969bb358c903e24a59dc51 (patch)
treeb381b6e8561bf2483d83d8ae570584f1d1a99a69
parentb900bf48ec3442aaf6d13994e77a893d10c5b0b7 (diff)
downloadanaconda-339eacb1cd2e1bdfc8969bb358c903e24a59dc51.tar.gz
anaconda-339eacb1cd2e1bdfc8969bb358c903e24a59dc51.tar.xz
anaconda-339eacb1cd2e1bdfc8969bb358c903e24a59dc51.zip
MbrDevice is something different on SPARC than on Intel
Bootable RAID1 support for SILO
-rw-r--r--iw/silo.py136
-rw-r--r--silo.py172
-rw-r--r--textw/silo.py18
3 files changed, 205 insertions, 121 deletions
diff --git a/iw/silo.py b/iw/silo.py
index 3403058b9..88b0c5b7a 100644
--- a/iw/silo.py
+++ b/iw/silo.py
@@ -13,37 +13,37 @@ class SiloWindow (InstallWindow):
def __init__ (self, ics):
InstallWindow.__init__ (self, ics)
- ics.readHTML ("silo")
+ ics.readHTML ("silo")
- ics.setTitle (_("Silo Configuration"))
- ics.setNextEnabled (1)
- self.type = None
- self.bootdisk = None
- self.silo = None
+ ics.setTitle (_("Silo Configuration"))
+ ics.setNextEnabled (1)
+ self.type = None
+ self.bootdisk = None
+ self.silo = None
self.linuxAlias = None
self.linuxAliasLabel = None
self.bootDevice = None
def getNext (self):
- # XXX
- if not self.bootdisk:
+ # XXX
+ if not self.bootdisk:
if self.todo.silo.hasUsableFloppy() == 2:
self.todo.bootdisk = 1
else:
self.todo.bootdisk = 0
return None
- if self.bootdisk.get_active ():
- self.todo.bootdisk = 1
- else:
- self.todo.bootdisk = 0
+ if self.bootdisk.get_active ():
+ self.todo.bootdisk = 1
+ else:
+ self.todo.bootdisk = 0
- if self.silo.get_active ():
- self.todo.silo.setDevice(None)
- else:
- if self.mbr.get_active ():
+ if self.silo.get_active ():
+ self.todo.silo.setDevice(None)
+ elif self.silo.allowSiloLocationConfig(self.todo.fstab):
+ if self.mbr.get_active ():
self.todo.silo.setDevice("mbr")
- else:
+ else:
self.todo.silo.setDevice("partition")
self.todo.silo.setAppend(self.appendEntry.get_text())
@@ -67,13 +67,13 @@ class SiloWindow (InstallWindow):
return "Other"
def toggled (self, widget, *args):
- if widget.get_active ():
+ if widget.get_active ():
state = FALSE
- else:
+ else:
state = TRUE
- for n in [self.radioBox, self.editBox, self.imageList ]:
- n.set_sensitive (state)
+ for n in [ self.radioBox, self.editBox, self.imageList ]:
+ n.set_sensitive (state)
def mbr_toggled (self, widget, *args):
if widget.get_active ():
@@ -97,10 +97,10 @@ class SiloWindow (InstallWindow):
label = self.labelEntry.get_text()
self.imageList.set_text(index, 3, label)
- if label:
- self.defaultCheck.set_sensitive (TRUE)
- else:
- self.defaultCheck.set_sensitive (FALSE)
+ if label:
+ self.defaultCheck.set_sensitive (TRUE)
+ else:
+ self.defaultCheck.set_sensitive (FALSE)
def defaultUpdated(self, *args):
if self.ignoreSignals: return
@@ -130,31 +130,30 @@ class SiloWindow (InstallWindow):
self.typeLabel.set_text(_("Type") + ":" + self.typeName(type))
self.labelEntry.set_text(label)
- if not label:
- self.defaultCheck.set_sensitive (FALSE)
+ if not label:
+ self.defaultCheck.set_sensitive (FALSE)
- self.ignoreSignals = 1
+ self.ignoreSignals = 1
if index == self.default:
self.defaultCheck.set_active(1)
else:
self.defaultCheck.set_active(0)
- self.ignoreSignals = 0
+ self.ignoreSignals = 0
def getScreen (self):
(self.images, defaultLabel) = self.todo.silo.getSiloImages(self.todo.fstab)
- self.ignoreSignals = 0
+ self.ignoreSignals = 0
(mount, dev, fstype, format, size) = self.todo.fstab.mountList()[0]
if mount != '/': return None
self.bootpart = self.todo.fstab.getBootDevice()
- self.mbrpart = self.todo.fstab.getMbrDevice()
-
- format = "/dev/%s"
+ self.mbrpart = self.todo.silo.getMbrDevice(self.todo.fstab)
+ format = "/dev/%s"
- self.radioBox = GtkTable(2, 7)
- self.radioBox.set_border_width (5)
-
+ self.radioBox = GtkTable(2, 7)
+ self.radioBox.set_border_width (5)
+
spacer = GtkLabel("")
spacer.set_usize(10, 1)
self.radioBox.attach(spacer, 0, 1, 2, 4, FALSE)
@@ -163,15 +162,19 @@ class SiloWindow (InstallWindow):
label.set_alignment(0.0, 0.5)
self.radioBox.attach(label, 0, 2, 1, 2)
- self.mbr = GtkRadioButton(None,
- ("/dev/%s %s" % (self.mbrpart, _("Master Boot Record (MBR)"))))
- part = GtkRadioButton(self.mbr,
+ mbrpart = self.mbrpart
+ if self.bootpart[:2] == "md":
+ mbrpart = self.bootpart
+ # FIXME: Should be Master Boot Records (MBR) in the RAID1 case
+ self.mbr = GtkRadioButton(None,
+ ("/dev/%s %s" % (mbrpart, _("Master Boot Record (MBR)"))))
+ part = GtkRadioButton(self.mbr,
("/dev/%s %s" % (self.bootpart,
_("First sector of boot partition"))))
self.radioBox.attach(self.mbr, 1, 2, 2, 3)
self.radioBox.attach(part, 1, 2, 3, 4)
- self.linuxAlias = GtkCheckButton(
+ self.linuxAlias = GtkCheckButton(
_("Create PROM alias") + ":")
if (self.todo.silo.hasAliases()):
self.linuxAlias.set_active (TRUE)
@@ -182,16 +185,21 @@ class SiloWindow (InstallWindow):
tempBox = GtkHBox (FALSE, 5)
tempBox.pack_start(self.linuxAlias)
tempBox.pack_start(self.linuxAliasLabel)
- self.radioBox.attach(tempBox, 0, 2, 4, 5)
+ self.radioBox.attach(tempBox, 0, 2, 4, 5)
self.mbr.connect("toggled", self.mbr_toggled)
+ if self.bootpart[:2] == "md":
+ self.mbr.set_active (TRUE)
+ label.set_sensitive (FALSE)
+ self.mbr.set_sensitive (FALSE)
+ part.set_sensitive (FALSE)
if self.todo.silo.getSiloMbrDefault(self.todo.fstab) == 'mbr':
self.mbr.set_active (TRUE)
else:
part.set_active (TRUE);
- self.bootDevice = GtkCheckButton(_("Set default PROM boot device to linux"))
- self.radioBox.attach(self.bootDevice, 0, 2, 5, 6)
+ self.bootDevice = GtkCheckButton(_("Set default PROM boot device to linux"))
+ self.radioBox.attach(self.bootDevice, 0, 2, 5, 6)
self.bootDevice.set_active (TRUE)
label = GtkLabel(_("Kernel parameters") + ":")
@@ -207,12 +215,12 @@ class SiloWindow (InstallWindow):
alignment.add(box)
self.radioBox.attach(alignment, 0, 2, 6, 7)
- box = GtkVBox (FALSE, 0)
+ box = GtkVBox (FALSE, 0)
topBox = GtkHBox (FALSE, 2)
- optionBox = GtkVBox (FALSE, 5)
- optionBox.set_border_width (5)
- self.bootdisk = GtkCheckButton (_("Create boot disk"))
+ optionBox = GtkVBox (FALSE, 5)
+ optionBox.set_border_width (5)
+ self.bootdisk = GtkCheckButton (_("Create boot disk"))
floppy = self.todo.silo.hasUsableFloppy()
if floppy == 2:
self.bootdisk.set_active (TRUE)
@@ -220,12 +228,12 @@ class SiloWindow (InstallWindow):
self.bootdisk.set_active (FALSE)
if floppy == 0:
self.bootdisk.set_sensitive (FALSE)
- optionBox.pack_start (self.bootdisk)
+ optionBox.pack_start (self.bootdisk)
- self.silo = GtkCheckButton (_("Do not install SILO"))
- self.silo.set_active (FALSE)
- self.silo.connect ("toggled", self.toggled)
- optionBox.pack_start (self.silo, FALSE)
+ self.silo = GtkCheckButton (_("Do not install SILO"))
+ self.silo.set_active (FALSE)
+ self.silo.connect ("toggled", self.toggled)
+ optionBox.pack_start (self.silo, FALSE)
topBox.pack_start (optionBox)
im = self.ics.readPixmap ("silo.png")
@@ -237,19 +245,19 @@ class SiloWindow (InstallWindow):
a.set (1.0, 0.0, 0.0, 0.0)
topBox.pack_start (a, FALSE)
- box.pack_start (topBox, FALSE)
+ box.pack_start (topBox, FALSE)
- box.pack_start (GtkHSeparator (), FALSE)
- box.pack_start (self.radioBox, FALSE)
+ box.pack_start (GtkHSeparator (), FALSE)
+ box.pack_start (self.radioBox, FALSE)
self.imageList = GtkCList (4,
( _("Default"), _("Device"), _("Partition type"), _("Boot label")))
- self.imageList.set_selection_mode (SELECTION_BROWSE)
+ self.imageList.set_selection_mode (SELECTION_BROWSE)
sortedKeys = self.images.keys()
sortedKeys.sort()
- self.default = None
+ self.default = None
count = 0
for n in sortedKeys:
(label, type) = self.images[n]
@@ -260,9 +268,9 @@ class SiloWindow (InstallWindow):
self.imageList.set_pixmap(count, 0, self.checkMark)
count = count + 1
- self.imageList.columns_autosize ()
- self.imageList.column_title_passive (1)
- self.imageList.set_border_width (5)
+ self.imageList.columns_autosize ()
+ self.imageList.column_title_passive (1)
+ self.imageList.set_border_width (5)
self.imageList.connect("select_row", self.labelSelected)
self.imageList.set_column_justification(2, JUSTIFY_CENTER)
@@ -293,8 +301,8 @@ class SiloWindow (InstallWindow):
self.editBox.pack_start (tempBox2, FALSE)
self.editBox.set_border_width (5)
- box.pack_start (GtkHSeparator (), FALSE)
- box.pack_start (self.editBox, FALSE)
- box.pack_start (self.imageList, TRUE)
+ box.pack_start (GtkHSeparator (), FALSE)
+ box.pack_start (self.editBox, FALSE)
+ box.pack_start (self.imageList, TRUE)
- return box
+ return box
diff --git a/silo.py b/silo.py
index d32cb9923..a1ea1d255 100644
--- a/silo.py
+++ b/silo.py
@@ -6,6 +6,13 @@ import iutil
import isys
class SiloInstall:
+ def allowSiloLocationConfig(self, fstab):
+ bootDevice = fstab.getBootDevice()
+ if bootDevice[0:2] == "md":
+ self.setDevice(("raid", bootDevice))
+ return None
+ return 1
+
def checkUFS(self, dev):
f = open("/proc/mounts","r")
lines = f.readlines ()
@@ -71,7 +78,7 @@ class SiloInstall:
self.siloImages = images
def getSiloImages(self, fstab):
- (drives, raid) = fstab.raidList()
+ (drives, raid) = fstab.raidList()
# rearrange the fstab so it's indexed by device
mountsByDev = {}
@@ -79,6 +86,14 @@ class SiloInstall:
fstab.mountList():
mountsByDev[device] = mntpoint
+ for (mntpoint, device, fstype, raidType, start, size, makeup) in raid:
+ mountsByDev[device] = mntpoint
+ drives.append(device, "", 2, 0, 0)
+
+ for (device, mntpoint, fsystem, makeup) in fstab.existingRaidList():
+ mountsByDev[device] = mntpoint
+ drives.append(device, "", 2, 0, 0)
+
oldImages = {}
for dev in self.siloImages.keys():
oldImages[dev] = self.siloImages[dev]
@@ -87,13 +102,13 @@ class SiloInstall:
nSolaris = 0
nSunOS = 0
for (dev, devName, type, start, size) in drives:
- # ext2 partitions get listed if
+ # ext2 and raid partitions get listed if
# 1) they're /
# 2) they're not mounted
# and contain /boot of
# some Linux installation
# FIXME: For now only list / and UFS partitions,
- # for 6.2 write code which will read and parse silo.conf from other
+ # for 7.0 write code which will read and parse silo.conf from other
# Linux partitions and merge it in (after required device
# substitions etc.
@@ -129,6 +144,8 @@ class SiloInstall:
# Check partition at cylinder 0 on the boot disk
# is /, /boot or Linux swap
bootpart = fstab.getBootDevice()
+ if bootpart[:2] == "md":
+ return "mbr"
i = len (bootpart) - 1
while i > 0 and bootpart[i] in string.digits:
i = i - 1
@@ -180,16 +197,41 @@ class SiloInstall:
def makeInitrd (self, kernelTag, instRoot):
initrd = "/boot/initrd%s.img" % (kernelTag, )
if not self.initrdsMade.has_key(initrd):
- iutil.execWithRedirect("/sbin/mkinitrd",
- [ "/sbin/mkinitrd",
+ iutil.execWithRedirect("/sbin/mkinitrd",
+ [ "/sbin/mkinitrd",
"--ifneeded",
- initrd,
- kernelTag[1:] ],
- stdout = None, stderr = None, searchPath = 1,
- root = instRoot)
+ initrd,
+ kernelTag[1:] ],
+ stdout = None, stderr = None, searchPath = 1,
+ root = instRoot)
self.initrdsMade[kernelTag] = 1
return initrd
+ def getMbrDevices(self, fstab):
+ bootpart = fstab.getBootDevice()
+ mbrdevs = []
+ if bootpart[:2] == "md":
+ (devices, raid) = fstab.raidList()
+ for (raidMntPoint, raidDevice, fsType, raidType, raidStart, raidSize, raidDevs) in raid:
+ if raidDevice != bootpart: continue
+ for raidDev in raidDevs:
+ for (device, name, type, start, size) in devices:
+ if name == raidDev:
+ i = len(device) - 1
+ while i > 0 and device[i] in string.digits:
+ i = i - 1
+ mbrdevs.append(device[:i+1])
+ else:
+ # Do not use fstab.getMbrDevice() here
+ i = len (bootpart) - 1
+ while i > 0 and bootpart[i] in string.digits:
+ i = i - 1
+ mbrdevs.append(bootpart[:i+1])
+ return mbrdevs
+
+ def getMbrDevice(self, fstab):
+ return self.getMbrDevices(fstab)[0]
+
def install(self, fstab, instRoot, hdList, upgrade):
silo = LiloConfigFile ()
@@ -198,40 +240,30 @@ class SiloInstall:
self.setSiloImages(images)
bootpart = fstab.getBootDevice()
- boothd = fstab.getMbrDevice()
-
+ boothd = self.getMbrDevice(fstab)
smpInstalled = (hdList.has_key('kernel-smp') and
hdList['kernel-smp'].selected)
- rootDev = fstab.getRootDevice ()
- if rootDev:
+ rootDev = fstab.getRootDevice ()
+ if rootDev:
# strip off the filesystem; we don't need it
- rootDev = rootDev[0]
- else:
- raise RuntimeError, "Installing lilo, but there is no root device"
+ rootDev = rootDev[0]
+ else:
+ raise RuntimeError, "Installing silo, but there is no root device"
args = [ "silo" ]
- bootpart = fstab.getBootDevice()
- boothd = fstab.getMbrDevice()
-
- if self.siloDevice == "mbr":
- device = boothd
- try:
- num = _silo.zeroBasedPart(instRoot + "/dev/" + boothd)
- if num:
- device = boothd + "%d" % num
- except:
- pass
+ if bootpart[:2] == "md":
+ self.siloDevice = "mbr"
else:
- device = bootpart
- args.append("-t")
- bootDevice = self.disk2PromPath(device)
+ if self.siloDevice != "mbr":
+ args.append("-t")
+
+ i = len (bootpart) - 1
+ while i > 0 and bootpart[i] in string.digits:
+ i = i - 1
+ silo.addEntry("partition", bootpart[i+1:])
- i = len (bootpart) - 1
- while i > 0 and bootpart[i] in string.digits:
- i = i - 1
- silo.addEntry("partition", bootpart[i+1:])
silo.addEntry("timeout", "50")
silo.addEntry("root", '/dev/' + rootDev)
silo.addEntry("read-only")
@@ -249,7 +281,7 @@ class SiloInstall:
while i > 0 and drive[i] in string.digits:
i = i - 1
prompath = drive[:i+1]
- if prompath == boothd:
+ if bootpart[:2] != "md" and prompath == boothd:
prompath = drive[i+1:]
else:
prompath = self.disk2PromPath(prompath)
@@ -286,7 +318,7 @@ class SiloInstall:
if os.access (instRoot + initrd, os.R_OK):
sl.addEntry("initrd", initrdFile)
- if self.siloAppend:
+ if self.siloAppend:
sl.addEntry('append', '"%s"' % self.siloAppend)
silo.addImage ("image", kernelFile, sl)
@@ -328,22 +360,54 @@ class SiloInstall:
else:
silo.write(instRoot + "/etc/silo.conf")
- if self.serial:
- messages = "/tmp/silo.log"
- else:
- messages = "/dev/tty3"
- iutil.execWithRedirect('/sbin/silo',
- args,
- stdout = None,
- root = instRoot)
- linuxAlias = ""
- if self.linuxAlias and self.hasAliases():
- linuxAlias = bootDevice
- if not self.bootDevice:
- bootDevice = ""
- if not linuxAlias:
- linuxAlias = ""
- _silo.setPromVars(linuxAlias,bootDevice)
+ if self.serial:
+ messages = "/tmp/silo.log"
+ else:
+ messages = "/dev/tty3"
+ iutil.execWithRedirect('/sbin/silo',
+ args,
+ stdout = None,
+ root = instRoot)
+
+ if bootpart[:2] == "md":
+ mbrdevs = self.getMbrDevices(fstab)
+ linuxAliases = []
+ for mbrdev in mbrdevs:
+ device = mbrdev
+ try:
+ num = _silo.zeroBasedPart(instRoot + "/dev/" + mbrdev)
+ if num:
+ device = mbrdev + "%d" % num
+ except:
+ pass
+ linuxAliases.append(self.disk2PromPath(device))
+ bootDevice = linuxAliases[0]
+ linuxAlias = ""
+ for alias in linuxAliases:
+ if alias and alias != "":
+ linuxAlias = linuxAlias + ";" + alias
+ elif self.siloDevice == "mbr":
+ device = boothd
+ try:
+ num = _silo.zeroBasedPart(instRoot + "/dev/" + boothd)
+ if num:
+ device = boothd + "%d" % num
+ except:
+ pass
+ linuxAlias = self.disk2PromPath(device)
+ bootDevice = linuxAlias
+ else:
+ device = bootpart
+ linuxAlias = self.disk2PromPath(device)
+ bootDevice = linuxAlias
+
+ if not (self.linuxAlias and self.hasAliases()):
+ linuxAlias = ""
+ if not self.bootDevice:
+ bootDevice = ""
+ if not linuxAlias:
+ linuxAlias = ""
+ _silo.setPromVars(linuxAlias,bootDevice)
def setDevice(self, device):
if (type(device) == type((1,))):
@@ -378,4 +442,6 @@ class SiloInstall:
self.siloAppend = None
self.default = None
self.initrdsMade = {}
- self.serial = serial
+ self.serial = serial
+ self.linuxAlias = 1
+ self.bootDevice = 1
diff --git a/textw/silo.py b/textw/silo.py
index b2c84218d..2dab79807 100644
--- a/textw/silo.py
+++ b/textw/silo.py
@@ -56,9 +56,10 @@ class SiloWindow:
if todo.skipLilo: return INSTALL_NOOP
bootpart = todo.fstab.getBootDevice()
- boothd = todo.fstab.getMbrDevice()
+ boothd = todo.silo.getMbrDevice(todo.fstab)
format = "/dev/%-11s %s%*s"
+ # FIXME: Should be Master Boot Records (MBR) in RAID1 case
str1 = _("Master Boot Record (MBR)")
str2 = _("First sector of boot partition")
str3 = _("Create PROM alias `linux'")
@@ -72,10 +73,19 @@ class SiloWindow:
dflt = 1
else:
dflt = 0
- rc1 = SingleRadioButton (format % (boothd, str1, lenmax - len1, ""), None, dflt )
+ bootdisk = boothd
+ if bootpart[:2] == "md":
+ bootdisk = bootpart
+ rc1 = SingleRadioButton (format % (bootdisk, str1, lenmax - len1, ""), None, dflt )
rc2 = SingleRadioButton (format % (bootpart, str2, lenmax - len2, ""), rc1, 1 - dflt)
-
- prompath = todo.silo.disk2PromPath(bootpart)
+ if bootpart[:2] == "md":
+ rc1.setFlags (FLAG_DISABLED, FLAGS_SET)
+ rc2.setFlags (FLAG_DISABLED, FLAGS_SET)
+
+ bootdisk = bootpart
+ if bootpart[:2] == "md":
+ bootdisk = boothd
+ prompath = todo.silo.disk2PromPath(bootdisk)
if prompath and len(prompath) > 0 and todo.silo.hasAliases():
default = 1
else: