diff options
-rw-r--r-- | dispatch.py | 7 | ||||
-rw-r--r-- | installclasses/upgradeclass.py | 1 | ||||
-rw-r--r-- | instdata.py | 1 | ||||
-rw-r--r-- | iw/upgrade_swap_gui.py | 13 | ||||
-rw-r--r-- | textw/upgrade_text.py | 23 | ||||
-rw-r--r-- | upgrade.py | 20 | ||||
-rw-r--r-- | upgradeclass.py | 1 |
7 files changed, 39 insertions, 27 deletions
diff --git a/dispatch.py b/dispatch.py index 06918a15b..295fc72ed 100644 --- a/dispatch.py +++ b/dispatch.py @@ -27,6 +27,7 @@ from bootloader import partitioningComplete, writeBootloader from bootloader import bootloaderSetupChoices from flags import flags from upgrade import upgradeFindPackages, upgradeMountFilesystems +from upgrade import upgradeSwapSuggestion # These are all of the install steps, in order. Note that upgrade and # install steps are the same thing! Upgrades skip install steps, while @@ -49,8 +50,6 @@ installSteps = [ ( "reconfigkeyboard", ("id.instLanguage", "id.keyboard" ) ), ( "installtype", ("dispatch", "id", "method", "intf") ), ( "findinstall", ("dispatch", "intf", "id", "instPath") ), - ( "upgradecontinue", queryUpgradeContinue, ("intf", "dir")), - ( "addswap", ("dispatch", "intf", "id.fsset", "instPath") ), ( "partitionmethod", ("id",) ), ( "partitionobjinit", partitionObjectsInitialize, ("id", "dir") ), ( "partitionmethodsetup", partitionMethodSetup, ("id", "dispatch") ), @@ -60,6 +59,10 @@ installSteps = [ ( "partition", ("id.fsset", "id.diskset", "id.partrequests", "intf")), ( "upgrademount", upgradeMountFilesystems, ("intf", "id.upgradeRoot", "id.fsset", "instPath")), + ( "upgradecontinue", queryUpgradeContinue, ("intf", "dir")), + ( "upgradeswapsuggestion", upgradeSwapSuggestion, ("dispatch", "id", + "instPath") ), + ( "addswap", ("intf", "id.fsset", "instPath", "id.upgradeSwapInfo") ), ( "partitiondone", partitioningComplete, ("dispatch", "id.bootloader", "id.fsset", "id.diskset", "id.partrequests") ), diff --git a/installclasses/upgradeclass.py b/installclasses/upgradeclass.py index 1319b0aaf..b0fadb152 100644 --- a/installclasses/upgradeclass.py +++ b/installclasses/upgradeclass.py @@ -24,6 +24,7 @@ class InstallClass(BaseInstallClass): "findinstall", "partitionobjinit", "upgrademount", + "upgradeswapsuggestion", "addswap", "upgradecontinue", "readcomps", diff --git a/instdata.py b/instdata.py index 81e8032ac..9df3f0e44 100644 --- a/instdata.py +++ b/instdata.py @@ -74,6 +74,7 @@ class InstallData: self.useFdisk = 0 self.useAutopartitioning = 1 self.upgradeRoot = None + self.upgradeSwapInfo = None def setInstallProgressClass(self, c): self.instProgress = c diff --git a/iw/upgrade_swap_gui.py b/iw/upgrade_swap_gui.py index 7adf075e9..ffbc3f80e 100644 --- a/iw/upgrade_swap_gui.py +++ b/iw/upgrade_swap_gui.py @@ -61,8 +61,10 @@ class UpgradeSwapWindow (InstallWindow): else: if flags.setupFilesystems: - upgrade.createSwapFile(instPath, fsset, mnt, val) - + # XXX fix me + # upgrade.createSwapFile(instPath, fsset, mnt, val) + pass + return None def toggle (self, data): @@ -71,16 +73,13 @@ class UpgradeSwapWindow (InstallWindow): def clist_cb(self, clist, row, col, data): self.row = row - def getScreen (self, dispatch, intf, fsset, instPath): + def getScreen (self, intf, fsset, instPath, swapInfo): self.neededSwap = 0 self.fsset = fsset - self.dispatch = dispatch self.instPath = instPath self.intf = intf - rc = upgrade.swapSuggestion(self.instPath, self.fsset) - if not rc: - return None + rc = swapInfo self.neededSwap = 1 self.row = 0 diff --git a/textw/upgrade_text.py b/textw/upgrade_text.py index 0d04cc7d7..45bb71992 100644 --- a/textw/upgrade_text.py +++ b/textw/upgrade_text.py @@ -8,10 +8,8 @@ from constants_text import * import upgrade class UpgradeSwapWindow: - def __call__ (self, screen, dispatch, intf, fsset, instPath): - rc = upgrade.swapSuggestion(instPath, fsset) - if not rc: - return INSTALL_OK + def __call__ (self, screen, intf, fsset, instPath, swapInfo): + rc = swapInfo (fsList, suggSize, suggMntPoint) = rc @@ -83,18 +81,21 @@ class UpgradeSwapWindow: try: val = int(val) except ValueError: - todo.intf.messageWindow(_("Error"), - _("The value you entered is not a valid number.")) + intf.messageWindow(_("Error"), + _("The value you entered is not a " + "valid number.")) if type(val) == type(1): (mnt, part, size) = fsList[listbox.current()] if size < (val + 16): - todo.intf.messageWindow(_("Error"), - _("There is not enough space on the device you " - "selected for the swap partition.")) + intf.messageWindow(_("Error"), + _("There is not enough space on the " + "device you selected for the swap " + "partition.")) elif val > 2000 or val < 1: - todo.intf.messageWindow(_("Warning"), - _("The swap file must be between 1 and 2000 MB in size.")) + intf.messageWindow(_("Warning"), + _("The swap file must be between 1 " + "and 2000 MB in size.")) else: screen.popWindow() if todo.setupFilesystems: diff --git a/upgrade.py b/upgrade.py index a1aff93ae..38689c6dc 100644 --- a/upgrade.py +++ b/upgrade.py @@ -23,6 +23,7 @@ import time import rpm import sys import os.path +import dispatch from flags import flags from partitioning import * from log import log @@ -79,7 +80,7 @@ def mountRootPartition(intf, rootInfo, oldfsset, instPath, allowDirty = 0, oldfsset.mountFilesystems (instPath) # returns None if no more swap is needed -def swapSuggestion(instPath, fsset): +def upgradeSwapSuggestion(dispatch, id, instPath): # mem is in kb -- round it up to the nearest 4Mb mem = iutil.memInstalled(corrected = 0) rem = mem % 16384 @@ -87,18 +88,23 @@ def swapSuggestion(instPath, fsset): mem = mem + (16384 - rem) mem = mem / 1024 + dispatch.skipStep("addswap", 0) + # don't do this if we have more then 512 MB - if mem > 510: return None - + if mem > 510: + dispatch.skipStep("addswap", 1) + return + swap = iutil.swapAmount() / 1024 # if we have twice as much swap as ram, we're safe if swap >= (mem * 2): - return None + dispatch.skipStep("addswap", 1) + return fsList = [] - if fsset.rootOnLoop(): + if id.fsset.rootOnLoop(): space = isys.pathSpaceAvailable("/mnt/loophost") for entry in fsset.entries: @@ -108,7 +114,7 @@ def swapSuggestion(instPath, fsset): info = (entry.mountpoint, entry.device.getDevice(), space) fsList.append(info) else: - for entry in fsset.entries: + for entry in id.fsset.entries: # XXX multifsify if (entry.fsystem.getName() == "ext2" or entry.fsystem.getName() == "ext3"): @@ -125,7 +131,7 @@ def swapSuggestion(instPath, fsset): if (size > suggSize) and (size > (suggestion + 100)): suggMnt = mnt - return (fsList, suggestion, suggMnt) + id.upgradeSwapInfo = (fsList, suggestion, suggMnt) def swapfileExists(swapname): try: diff --git a/upgradeclass.py b/upgradeclass.py index 1319b0aaf..b0fadb152 100644 --- a/upgradeclass.py +++ b/upgradeclass.py @@ -24,6 +24,7 @@ class InstallClass(BaseInstallClass): "findinstall", "partitionobjinit", "upgrademount", + "upgradeswapsuggestion", "addswap", "upgradecontinue", "readcomps", |