From bd6e20f9d1a6d961c80fccaeef807193d71e8691 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Sun, 22 Jul 2001 03:21:33 +0000 Subject: check the installclass in doAutoPartition so that we don't raise dialogs during kickstart for warnings and exit if there's an error partitioning --- autopart.py | 21 ++++++++++++++++++--- dispatch.py | 3 ++- kickstart.py | 2 ++ 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/autopart.py b/autopart.py index 387fb491d..9df2df77c 100644 --- a/autopart.py +++ b/autopart.py @@ -803,7 +803,12 @@ def doClearPartAction(partitions, diskset): deletePart(diskset, delete) continue -def doAutoPartition(dir, diskset, partitions, intf): +def doAutoPartition(dir, diskset, partitions, intf, instClass): + if instClass.name and instClass.name == "kickstart": + isKickstart = 1 + else: + isKickstart = 0 + if dir == DISPATCH_BACK: diskset.refreshDevices() partitions.setFromDisk(diskset) @@ -845,15 +850,25 @@ def doAutoPartition(dir, diskset, partitions, intf): try: doPartitioning(diskset, partitions, doRefresh = 0) except PartitioningWarning, msg: - intf.messageWindow(_("Warnings During Automatic Partitioning"), + if not isKickstart: + intf.messageWindow(_("Warnings During Automatic Partitioning"), _("Following warnings occurred during automatic " "partitioning:\n\n%s") % (msg.value)) + else: + log("WARNING: %s" % (msg.value)) except PartitioningError, msg: # restore drives to original state diskset.refreshDevices() partitions.setFromDisk(diskset) + if not isKickstart: + extra = "" + else: + extra = "\n\nPress OK to reboot your system." intf.messageWindow(_("Error Partitioning"), - _("Could not allocate requested partitions: \n\n%s.") % (msg.value)) + _("Could not allocate requested partitions: \n\n%s.%s") % (msg.value, extra)) + + if isKickstart: + sys.exit(0) def queryAutoPartitionOK(intf, diskset, partitions): diff --git a/dispatch.py b/dispatch.py index fab61ac49..8cc5fcc4d 100644 --- a/dispatch.py +++ b/dispatch.py @@ -60,7 +60,8 @@ installSteps = [ "dispatch")), ("autopartition", ("id.diskset", "id.partitions", "intf", "dispatch")), ("autopartitionexecute", doAutoPartition, ("dir", "id.diskset", - "id.partitions", "intf")), + "id.partitions", "intf", + "id.instClass")), ("fdisk", ("id.diskset", "id.partitions")), ("partition", ("id.fsset", "id.diskset", "id.partitions", "intf")), ("upgrademount", upgradeMountFilesystems, ("intf", "id.upgradeRoot", diff --git a/kickstart.py b/kickstart.py index 1693f5bda..d5c56054f 100644 --- a/kickstart.py +++ b/kickstart.py @@ -43,6 +43,8 @@ class Script: os.unlink(path) class KickstartBase(BaseInstallClass): + name = "kickstart" + def postAction(self, rootPath, serial): for script in self.postScripts: script.run(rootPath, serial) -- cgit