diff options
author | Erik Troan <ewt@redhat.com> | 1999-09-01 00:24:43 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-09-01 00:24:43 +0000 |
commit | 3f92666dcb0171105dfc38eff8b31fec2c983e92 (patch) | |
tree | d4bb64bb41c7eeb3fa74c7e473fd22a93c4c788e | |
parent | ddb1c1454012411f2636c59d651be3bd98151692 (diff) | |
download | anaconda-3f92666dcb0171105dfc38eff8b31fec2c983e92.tar.gz anaconda-3f92666dcb0171105dfc38eff8b31fec2c983e92.tar.xz anaconda-3f92666dcb0171105dfc38eff8b31fec2c983e92.zip |
changes to make partitioning work in kickstart
-rwxr-xr-x | gui.py | 4 | ||||
-rw-r--r-- | installclass.py | 34 | ||||
-rw-r--r-- | iw/autopartition.py | 49 | ||||
-rw-r--r-- | iw/rootpartition.py | 33 | ||||
-rw-r--r-- | kickstart.py | 28 | ||||
-rw-r--r-- | text.py | 11 |
6 files changed, 90 insertions, 69 deletions
@@ -25,7 +25,6 @@ from iw.installpath import * import sys import GdkImlib -from gnomepyfsedit import fsedit import isys import sys @@ -90,9 +89,6 @@ class InstallInterface: print text return 1 - def getDDruid (self, drives): - return fsedit (1, drives) - def getBootdisk (): return None diff --git a/installclass.py b/installclass.py index 125b98cbe..089066ed1 100644 --- a/installclass.py +++ b/installclass.py @@ -6,6 +6,33 @@ class InstallClass: + # ummm, HACK + def finishPartitioning(self, ddruid): + if not self.partitions: return + + attempt = [] + swapCount = 0 + + for (mntpoint, size, maxsize, grow) in self.partitions: + type = 0x83 + if (mntpoint == "swap"): + mntpoint = "Swap%04d-auto" % swapCount + swapCount = swapCount + 1 + type = 0x82 + + attempt.append((mntpoint, size, type, grow, -1)) + + try: + ddruid.attempt (attempt, "Junk Argument", 0) + return 1 + except: + # life's a female dog <shrug> -- we should log something though + # <double-shrug> + self.skipPartitioning = 0 + pass + + return 0 + # look in mouse.py for a list of valid mouse names -- use the LONG names def setMouseType(self, name, device = None, emulateThreeButtons = 0): self.mouse = (name, device, emulateThreeButtons) @@ -31,7 +58,10 @@ class InstallClass: "package-selection", "bootdisk", "partition", "format", "timezone", "accounts", "dependencies", "language", "keyboard", "welcome", "installtype", "mouse" ].index(type) - self.skipSteps[type] = 1 + if type == "partition": + self.skipPartitioning = 1 + else: + self.skipSteps[type] = 1 def setHostname(self, hostname): self.hostname = hostname @@ -90,6 +120,8 @@ class InstallClass: self.netmask = "" self.gateway = "" self.nameserver = "" + self.partitions = [] + self.skipPartitioning = 0 # custom installs are easy :-) class CustomInstall(InstallClass): diff --git a/iw/autopartition.py b/iw/autopartition.py deleted file mode 100644 index aa600dc95..000000000 --- a/iw/autopartition.py +++ /dev/null @@ -1,49 +0,0 @@ -from gtk import * -from iw import * -from thread import * -from gui import _ - -FSEDIT_CLEAR_LINUX = (1 << 0) -FSEDIT_CLEAR_ALL = (1 << 2) -FSEDIT_USE_EXISTING = (1 << 3) - -class AutoPartitionWindow (InstallWindow): - - def __init__ (self, ics): - InstallWindow.__init__ (self, ics) - - self.todo = ics.getToDo () - ics.setTitle (_("Auto partition")) - ics.setNextEnabled (TRUE) - - def getNext (self): - attempt = [ - ( "/boot", 16, 0x83, 0, -1 ), - ( "/", 256, 0x83, 0, -1 ), - ( "/usr", 512, 0x83, 1, -1 ), - ( "/var", 256, 0x83, 0, -1 ), - ( "/home", 512, 0x83, 1, -1 ), - ( "Swap-auto", 64, 0x82, 0, -1 ), - ] - - ret = self.todo.ddruid.attempt (attempt, _("Workstation"), self.type) - return None - - def typeSelected (self, button, data): - self.type = data - - def getScreen (self): - box = GtkVBox (FALSE) - - group = GtkRadioButton (None, _("Remove all data")) - group.connect ("clicked", self.typeSelected, FSEDIT_CLEAR_ALL) - box.pack_start (group, FALSE) - item = GtkRadioButton (group, _("Remove Linux partitions")) - item.connect ("clicked", self.typeSelected, FSEDIT_CLEAR_LINUX) - box.pack_start (item, FALSE) - item = GtkRadioButton (group, _("Use existing free space")) - item.connect ("clicked", self.typeSelected, FSEDIT_USE_EXISTING) - box.pack_start (item, FALSE) - item.set_active (TRUE) - - return box diff --git a/iw/rootpartition.py b/iw/rootpartition.py index 72ccc9589..957ba308a 100644 --- a/iw/rootpartition.py +++ b/iw/rootpartition.py @@ -29,20 +29,21 @@ class PartitionWindow (InstallWindow): ics.setHTML ("<HTML><BODY>Select a root partition" "</BODY></HTML>") ics.setNextEnabled (TRUE) + self.skippedScreen = 0 def getNext (self): - print "calling self.ddruid.next ()" - self.todo.ddruid.next () - print "done calling self.ddruid.next ()" + self.todo.ddruid.next () - win = self.todo.ddruid.getConfirm () - if win: - print "confirm" - bin = GtkFrame (None, _obj = win) - bin.set_shadow_type (SHADOW_NONE) - window = ConfirmPartitionWindow - window.window = bin - return window + if not self.skippedScreen: + + win = self.todo.ddruid.getConfirm () + if win: + print "confirm" + bin = GtkFrame (None, _obj = win) + bin.set_shadow_type (SHADOW_NONE) + window = ConfirmPartitionWindow + window.window = bin + return window fstab = self.todo.ddruid.getFstab () for (partition, mount, fsystem, size) in fstab: @@ -56,13 +57,23 @@ class PartitionWindow (InstallWindow): def getScreen (self): from gnomepyfsedit import fsedit + if self.skippedScreen: + # if we skipped it once, skip it again + return None + if not self.todo.ddruid: drives = self.todo.drives.available ().keys () drives.sort () self.todo.ddruid = \ fsedit(1, drives, []) + self.todo.ddruid.next() self.todo.ddruid.setCallback (self.enableCallback, self) + self.todo.instClass.finishPartitioning(self.todo.ddruid) + if (self.todo.instClass.skipPartitioning): + self.skippedScreen = 1 + return None + self.bin = GtkFrame (None, _obj = self.todo.ddruid.getWindow ()) self.bin.set_shadow_type (SHADOW_NONE) self.todo.ddruid.edit () diff --git a/kickstart.py b/kickstart.py index bd3ca1842..7e5ea5907 100644 --- a/kickstart.py +++ b/kickstart.py @@ -126,6 +126,7 @@ class Kickstart(InstallClass): "lilo" : self.doLilo , "network" : None , "nfs" : None , + "partition" : self.definePartition , "rootpw" : self.doRootPw , "timezone" : self.doTimezone , "upgrade" : self.doUpgrade , @@ -140,11 +141,36 @@ class Kickstart(InstallClass): cmd = args[0] if handlers[cmd]: handlers[cmd](args[1:]) - + + def definePartition(self, args): + # we just set up the desired partitions -- magic in our base class + # does the actual partitioning (no, you don't want to know the + # details) + size = 0 + grow = 0 + maxSize = 0 + + (args, extra) = getopt.getopt(args, '', [ 'size=', 'maxsize=', + 'grow' ]) + + for n in args: + (str, arg) = n + if str == '--size': + size = int(arg) + elif str == '--maxsize': + maxSize = int(arg) + elif str == '--grow': + grow = 1 + + self.partitions.append((extra[0], size, maxSize, grow)) + + self.addToSkipList("partition") + def __init__(self, file): InstallClass.__init__(self) self.addToSkipList("bootdisk") self.addToSkipList("welcome") + self.partitions = [] self.installType = "install" self.readKickstart(file) @@ -685,9 +685,14 @@ class PartitionWindow: drives = todo.drives.available ().keys () drives.sort () todo.ddruid = fsedit(0, drives, fstab) - dir = todo.ddruid.edit () - for partition, mount, fstype, size in todo.ddruid.getFstab (): - todo.addMount(partition, mount, fstype) + + dir = INSTALL_NOOP + todo.instClass.finishPartitioning(todo.ddruid) + if not todo.instClass.skipPartitioning: + dir = todo.ddruid.edit () + + for partition, mount, fstype, size in todo.ddruid.getFstab (): + todo.addMount(partition, mount, fstype) return dir |