diff options
author | Erik Troan <ewt@redhat.com> | 1999-12-16 17:36:59 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-12-16 17:36:59 +0000 |
commit | ef9a674a458ac771272ab7b91c36ddfececd3098 (patch) | |
tree | 5b3de4fe48c764073b09289708fcd7cd1a91c092 | |
parent | 3c4a1f706279c4f7b3dfbd10486a87fb7072fd8d (diff) | |
download | anaconda-ef9a674a458ac771272ab7b91c36ddfececd3098.tar.gz anaconda-ef9a674a458ac771272ab7b91c36ddfececd3098.tar.xz anaconda-ef9a674a458ac771272ab7b91c36ddfececd3098.zip |
fdisk partitioning works with new fstab stuff
-rw-r--r-- | fstab.py | 67 | ||||
-rwxr-xr-x | gui.py | 1 | ||||
-rw-r--r-- | iw/fdisk.py | 35 | ||||
-rw-r--r-- | iw/installpath.py | 9 | ||||
-rw-r--r-- | iw/rootpartition.py | 13 | ||||
-rw-r--r-- | text.py | 2 | ||||
-rw-r--r-- | textw/partitioning.py | 23 | ||||
-rw-r--r-- | todo.py | 10 |
8 files changed, 83 insertions, 77 deletions
@@ -26,7 +26,24 @@ def _(str): class Fstab: def rescanPartitions(self): - pass + if self.ddruid: + self.closeDrives() + + fstab = [] + for (mntpoint, dev, fstype, reformat, size) in self.cachedFstab: + fstab.append ((dev, mntpoint)) + + self.ddruid = self.fsedit(0, self.driveList(), fstab, self.zeroMbr, + self.readOnly) + del self.cachedFstab + + def closeDrives(self): + # we expect a rescanPartitions() after this!!! + self.cachedFstab = self.mountList(skipExtra = 1) + self.ddruid = None + + def setReadonly(self, readOnly): + self.readOnly = readOnly def savePartitions(self): self.ddruid.save() @@ -52,6 +69,14 @@ class Fstab: def partitionList(self): return self.ddruid.partitionList() + def driveList(self): + drives = isys.hardDriveList().keys() + drives.sort (isys.compareDrives) + return drives + + def drivesByName(self): + return isys.hardDriveList() + def swapList(self): fstab = [] for (partition, mount, fsystem, size) in self.ddruid.getFstab(): @@ -117,7 +142,7 @@ class Fstab: rt.write("\n") rt.close() - def umountFilesystems(self, messageWindow): + def umountFilesystems(self): if (not self.setupFilesystems): return isys.umount(self.instPath + '/proc') @@ -129,7 +154,7 @@ class Fstab: self.log("unmounting " + mntPoint) isys.umount(mntPoint) except SystemError, (errno, msg): - messageWindow(_("Error"), + self.messageWindow(_("Error"), _("Error unmounting %s: %s") % (device, msg)) @@ -248,7 +273,8 @@ class Fstab: f.write (format % ("none", "/dev/pts", 'devpts', 'gid=5,mode=620', 0, 0)) for (partition, doFormat) in self.swapList(): - f.write (format % (partition, 'swap', 'swap', 'defaults', 0, 0)) + f.write (format % ("/dev" + partition, 'swap', 'swap', + 'defaults', 0, 0)) f.close () # touch mtab @@ -261,7 +287,7 @@ class Fstab: self.extraFilesystems.append(mount, partition, fsystem, doFormat, size) - def mountList(self): + def mountList(self, skipExtra = 0): def sortMounts(one, two): mountOne = one[0] mountTwo = two[0] @@ -280,8 +306,9 @@ class Fstab: (doFormat,) = self.fsCache[(partition, mount)] fstab.append((mount, partition, fsystem, doFormat, size )) - for n in self.extraFilesystems: - fstab.append(n) + if not skipExtra: + for n in self.extraFilesystems: + fstab.append(n) fstab.sort(sortMounts) @@ -298,15 +325,22 @@ class Fstab: def getBadBlockCheck(self): return self.badBlockCheck - def __init__(self, setupFilesystems, serial, waitWindow): + def __init__(self, fsedit, setupFilesystems, serial, zeroMbr, + readOnly, waitWindow, messageWindow): + self.fsedit = fsedit self.fsCache = {} self.swapOn = 0 self.beenSaved = 1 self.setupFilesystems = setupFilesystems self.serial = serial + self.zeroMbr = zeroMbr + self.readOnly = readOnly self.waitWindow = waitWindow + self.messageWindow = messageWindow self.badBlockCheck = 0 self.extraFilesystems = [] + self.ddruid = self.fsedit(0, self.driveList(), [], + zeroMbr, readOnly) class GuiFstab(Fstab): @@ -324,21 +358,22 @@ class GuiFstab(Fstab): # yikes! this needs to be smarter self.beenSaved = 0 - def __init__(self, setupFilesystems, serial, zeroMbr, readOnly, waitWindow): + def __init__(self, setupFilesystems, serial, zeroMbr, readOnly, waitWindow, + messageWindow): from gnomepyfsedit import fsedit from gtk import * - Fstab.__init__(self, setupFilesystems, serial, waitWindow) - self.ddruid = fsedit(0, isys.hardDriveList().keys(), [], - zeroMbr, readOnly) + Fstab.__init__(self, fsedit, setupFilesystems, serial, zeroMbr, + readOnly, waitWindow, messageWindow) + self.GtkFrame = GtkFrame self.SHADOW_NONE = SHADOW_NONE class NewtFstab(Fstab): - def __init__(self, setupFilesystems, serial, zeroMbr, readOnly, waitWindow): + def __init__(self, setupFilesystems, serial, zeroMbr, readOnly, waitWindow, + messageWindow): from newtpyfsedit import fsedit - Fstab.__init__(self, setupFilesystems, serial, waitWindow) - self.ddruid = fsedit(0, isys.hardDriveList().keys(), [], - zeroMbr, readOnly) + Fstab.__init__(self, fsedit, setupFilesystems, serial, zeroMbr, + readOnly, waitWindow, messageWindow) @@ -10,7 +10,6 @@ from gtk import * from gtk import _root_window import GdkImlib from GDK import * -from fstab import GuiFstab im = None splashwindow = None diff --git a/iw/fdisk.py b/iw/fdisk.py index 783b64ecd..ec7e5ea2f 100644 --- a/iw/fdisk.py +++ b/iw/fdisk.py @@ -24,22 +24,17 @@ class FDiskWindow (InstallWindow): self.ics.setNextEnabled (1) self.ics.setHelpEnabled (1) + def getPrev(self): + self.todo.fstab.rescanPartitions() + def getNext(self): - from gnomepyfsedit import fsedit from installpath import InstallPathWindow if ((not InstallPathWindow.fdisk) or (not InstallPathWindow.fdisk.get_active ())): return None - drives = self.todo.drives.available ().keys () - drives.sort (isys.compareDrives) - - fstab = [] - for mntpoint, (dev, fstype, reformat) in self.todo.mounts.items (): - fstab.append ((dev, mntpoint)) + self.todo.fstab.rescanPartitions() - self.todo.ddruid = fsedit(0, drives, fstab, self.todo.zeroMbr, - self.todo.ddruidReadOnly) return None def button_clicked (self, widget, drive): @@ -47,20 +42,17 @@ class FDiskWindow (InstallWindow): zvt.connect ("child_died", self.child_died, widget) self.drive = drive - # free the file descriptors - self.todo.ddruid = None - self.todo.ddruidReadOnly = 1 + # free our fd's to the hard drive -- we have to + # fstab.rescanDrives() after this or bad things happen! + self.todo.fstab.setReadonly(1) if os.access("/sbin/fdisk", os.X_OK): path = "/sbin/fdisk" else: path = "/usr/sbin/fdisk" - try: - isys.makeDevInode(drive, '/tmp/' + drive) - except: - # XXX FIXME - pass - print "running", path, '/tmp/' + drive + + isys.makeDevInode(drive, '/tmp/' + drive) + if zvt.forkpty() == 0: os.execv (path, (path, '/tmp/' + drive)) zvt.show () @@ -72,14 +64,13 @@ class FDiskWindow (InstallWindow): self.ics.setPrevEnabled (0) self.ics.setNextEnabled (0) - def getScreen (self): from installpath import InstallPathWindow if ((not InstallPathWindow.fdisk) or (not InstallPathWindow.fdisk.get_active ())): return None - self.ddruid = None + self.todo.fstab.closeDrives() self.windowContainer = GtkVBox (FALSE) self.buttonBox = GtkVBox (FALSE, 5) @@ -87,9 +78,7 @@ class FDiskWindow (InstallWindow): box = GtkVButtonBox () label = GtkLabel (_("Select drive to run fdisk on")) - drives = self.todo.drives.available ().keys () - drives.sort(isys.compareDrives) - for drive in drives: + for drive in self.todo.fstab.driveList(): button = GtkButton (drive) button.connect ("clicked", self.button_clicked, drive) box.add (button) diff --git a/iw/installpath.py b/iw/installpath.py index 4be55f634..26697d72a 100644 --- a/iw/installpath.py +++ b/iw/installpath.py @@ -94,6 +94,15 @@ class InstallPathWindow (InstallWindow): self.ics = ics def getNext(self): + # This makes the error message delivery come at a sane place + if not self.todo.fstab: + from fstab import GuiFstab + + self.todo.fstab = GuiFstab(self.todo.setupFilesystems, + self.todo.serial, 0, 0, + self.todo.intf.waitWindow, + self.todo.intf.messageWindow) + if not self.__dict__.has_key("upgradeButton"): return diff --git a/iw/rootpartition.py b/iw/rootpartition.py index 1660ee8ee..cc07a4eab 100644 --- a/iw/rootpartition.py +++ b/iw/rootpartition.py @@ -84,14 +84,7 @@ class PartitionWindow (InstallWindow): self.ics.setNextEnabled (value) def getScreen (self): - if not self.todo.fstab: - from fstab import GuiFstab - - self.todo.fstab = GuiFstab(self.todo.setupFilesystems, - self.todo.serial, 0, 0, - self.todo.intf.waitWindow) - - if self.todo.getSkipPartitioning(): + if 0 and self.todo.getSkipPartitioning(): self.skippedScreen = 1 fstab = self.todo.ddruid.getFstab () self.todo.resetMounts() @@ -123,10 +116,6 @@ class AutoPartitionWindow(InstallWindow): if (self.__dict__.has_key("manuallyPartition") and self.manuallyPartition.get_active()): - drives = self.todo.drives.available ().keys () - drives.sort (isys.compareDrives) - self.todo.ddruid = fsedit(0, drives, self.fstab, self.todo.zeroMbr, - self.todo.ddruidReadOnly) self.todo.manuallyPartition() return None @@ -927,7 +927,7 @@ class InstallInterface: if todo.serial: self.screen.suspendCallback(spawnShell, self.screen) todo.fstab = NewtFstab(todo.setupFilesystems, todo.serial, 0, 0, - self.waitWindow) + self.waitWindow, self.messageWindow) if todo.reconfigOnly: self.commonSteps = [ diff --git a/textw/partitioning.py b/textw/partitioning.py index 38700800f..b31c1d8c3 100644 --- a/textw/partitioning.py +++ b/textw/partitioning.py @@ -37,9 +37,8 @@ class ManualPartitionWindow: if todo.skipFdisk: return INSTALL_NOOP - drives = todo.drives.available () - driveNames = drives.keys() - driveNames.sort (isys.compareDrives) + driveNames = todo.fstab.driveList() + drives = todo.fstab.drivesByName() choices = [] haveEdited = 0 @@ -65,8 +64,11 @@ class ManualPartitionWindow: if button != "done" and button != "back": haveEdited = 1 - todo.ddruidReadOnly = 1 - todo.ddruid = None # free our fd's to the hard drive + # free our fd's to the hard drive -- we have to + # fstab.rescanDrives() after this or bad things happen! + if not haveEdited: + todo.fstab.closeDrives() + todo.fstab.setReadonly(1) device = driveNames[choice] screen.suspend () if os.access("/sbin/fdisk", os.X_OK): @@ -87,16 +89,7 @@ class ManualPartitionWindow: pass screen.resume () - if haveEdited: - drives = todo.drives.available ().keys () - drives.sort (isys.compareDrives) - - fstab = [] - for mntpoint, (dev, fstype, reformat) in todo.mounts.items (): - fstab.append ((dev, mntpoint)) - - todo.ddruid = fsedit(0, drives, fstab, todo.zeroMbr, - todo.ddruidReadOnly) + todo.fstab.rescanPartitions() if button == "back": return INSTALL_BACK @@ -331,13 +331,6 @@ class ToDo: # This absolutely, positively MUST BE LAST self.setClass(instClass) - if self.setupFilesystems: - try: - f = open("/dev/tty5") - f.close () - except: - pass - def setFdDevice(self): if self.fdDevice: return @@ -1318,8 +1311,7 @@ class ToDo: self.instLog.close() del syslog - if self.setupFilesystems: - self.umountFilesystems (self.intf.messageWindow) + self.fstab.umountFilesystems() return 1 |