From 368e9f053bc63a678b23460fa52f1e40093609ef Mon Sep 17 00:00:00 2001 From: Chris Lumens Date: Wed, 3 May 2006 22:06:13 +0000 Subject: Start to use the anaconda class instead of passing around references to lots of other objects. --- ChangeLog | 15 ++++++++ anaconda | 3 +- autopart.py | 56 +++++++++++++++--------------- dispatch.py | 57 +++++++++++++++---------------- iw/confirm_gui.py | 2 +- iw/upgrade_swap_gui.py | 1 - iw/zipl_gui.py | 20 ----------- packages.py | 24 +++---------- partitioning.py | 16 ++++----- upgrade.py | 92 +++++++++++++++++++++++++++++--------------------- 10 files changed, 138 insertions(+), 148 deletions(-) diff --git a/ChangeLog b/ChangeLog index cca9a6bbe..45a85c837 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,21 @@ * kickstart.py (AnacondaKSParser.handleCommand): Don't traceback if pykickstart gets support for a new command before anaconda. + * instdata.py (InstallData.writeKS): Fix root password traceback. + + * anaconda: Clean up dispatcher call mess. Get rid of instPath. + * dispatch.py: Start to make things use anaconda class. + * autopart.py (doAutoPartition): Use anaconda object. + * packages.py (betaNagScreen): Use anaconda object. + (queryUpgradeContinue): Moved back to upgrade.py. + * partitioning.py (partitionObjectsInitialize): Use anaconda object. + * upgrade.py (findRootParts, upgradeMountFilesystems, + upgradeSwapSuggestion): Use anaconda object. + (queryUpgradeContinue): Moved back from packages.py. + * iw/confirm_gui.py: Change import. + * iw/upgrade_swap_gui.py: Likewise. + * iw/zipl_gui.py: Remove unused code. + 2006-05-03 Jeremy Katz * isys/isys.c: Don't include kernel fs headers -- the e2fsprogs diff --git a/anaconda b/anaconda index 44cf3caa5..23fdc065e 100755 --- a/anaconda +++ b/anaconda @@ -546,12 +546,11 @@ class Anaconda: self.methodstr = None self.backend = None self.rootPath = None - self.instPath = None self.dispatch = None self.isKickstart = False def setDispatch(self): - self.dispatch = dispatch.Dispatcher(self.intf, self.id, self.method, self.rootPath, self.backend) + self.dispatch = dispatch.Dispatcher(self) def setMethod(self): if self.methodstr.startswith('cdrom://'): diff --git a/autopart.py b/autopart.py index 5d91ea50a..3f9a1fe75 100644 --- a/autopart.py +++ b/autopart.py @@ -1087,7 +1087,7 @@ def doPartitioning(diskset, requests, doRefresh = 1): # given clearpart specification execute it # probably want to reset diskset and partition request lists before calling # this the first time -def doClearPartAction(partitions, diskset): +def doClearPartAction(anaconda, partitions, diskset): type = partitions.autoClearPartType cleardrives = partitions.autoClearPartDrives @@ -1149,7 +1149,7 @@ def doClearPartAction(partitions, diskset): # /boot/efi as it could contain system utils. # doesn't apply on kickstart installs or if no boot flag if ((rhpl.getArch() == "ia64") and (linuxOnly == 1) - and (not partitions.isKickstart) and + and (not anaconda.isKickstart) and part.is_flag_available(parted.PARTITION_BOOT)): if part.fs_type and (part.fs_type.name == "FAT" or part.fs_type.name == "fat16" @@ -1170,7 +1170,7 @@ def doClearPartAction(partitions, diskset): elif (((iutil.getPPCMachine() == "pSeries") or (iutil.getPPCMachine() == "iSeries")) and (linuxOnly == 1) - and (not partitions.isKickstart) and + and (not anaconda.isKickstart) and part.is_flag_available(parted.PARTITION_BOOT) and (part.native_type == 0x41) and part.get_flag(parted.PARTITION_BOOT)): @@ -1205,18 +1205,18 @@ def doClearPartAction(partitions, diskset): deletePart(diskset, delete) continue -def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): - if instClass.name and instClass.name == "kickstart": - isKickstart = 1 - # XXX hack - partitions.setProtected(dispatch) - else: - isKickstart = 0 +def doAutoPartition(anaconda): + instClass = anaconda.id.instClass + diskset = anaconda.id.diskset + partitions = anaconda.id.partitions + + if anaconda.isKickstart: + partitions.setProtected(anaconda.dispatch) - if dir == DISPATCH_BACK: + if anaconda.dir == DISPATCH_BACK: diskset.refreshDevices() partitions.setFromDisk(diskset) - partitions.setProtected(dispatch) + partitions.setProtected(anaconda.dispatch) partitions.autoPartitionRequests = [] return @@ -1232,7 +1232,7 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # XXX only do this if we're dirty ## id.diskset.refreshDevices() ## id.partrequests = PartitionRequests(id.diskset) - doClearPartAction(partitions, diskset) + doClearPartAction(anaconda, partitions, diskset) # XXX clearpartdrives is overloaded as drives we want to use for linux drives = [] @@ -1265,7 +1265,7 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # get the preexisting partition they want to use req = partitions.getRequestByDeviceName(request.device) if not req or not req.type or req.type != REQUEST_PREEXIST: - intf.messageWindow(_("Requested Partition Does Not Exist"), + anaconda.intf.messageWindow(_("Requested Partition Does Not Exist"), _("Unable to locate partition %s to use " "for %s.\n\n" "Press 'OK' to reboot your system.") @@ -1293,7 +1293,7 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): request.preexist == 1): req = partitions.getRequestByDeviceName(request.device) if not req or req.preexist == 0: - intf.messageWindow(_("Requested Raid Device Does Not Exist"), + anaconda.intf.messageWindow(_("Requested Raid Device Does Not Exist"), _("Unable to locate raid device %s to use " "for %s.\n\n" "Press 'OK' to reboot your system.") @@ -1325,7 +1325,7 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # get the preexisting partition they want to use req = partitions.getRequestByVolumeGroupName(request.volumeGroupName) if not req or req.preexist == 0 or req.format == 1: - intf.messageWindow(_("Requested Volume Group Does Not Exist"), + anaconda.intf.messageWindow(_("Requested Volume Group Does Not Exist"), _("Unable to locate volume group %s to use " "for %s.\n\n" "Press 'OK' to reboot your system.") @@ -1363,7 +1363,7 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # get the preexisting partition they want to use req = partitions.getRequestByLogicalVolumeName(request.logicalVolumeName) if not req or req.preexist == 0: - intf.messageWindow(_("Requested Logical Volume Does Not Exist"), + anaconda.intf.messageWindow(_("Requested Logical Volume Does Not Exist"), _("Unable to locate logical volume %s to use " "for %s.\n\n" "Press 'OK' to reboot your system.") @@ -1478,7 +1478,7 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): for req in partitions.requests: errors = req.sanityCheckRequest(partitions) if errors: - intf.messageWindow(_("Automatic Partitioning Errors"), + anaconda.intf.messageWindow(_("Automatic Partitioning Errors"), _("The following errors occurred with your " "partitioning:\n\n%s\n\n" "Press 'OK' to reboot your system.") % @@ -1488,8 +1488,8 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): try: doPartitioning(diskset, partitions, doRefresh = 0) except PartitioningWarning, msg: - if not isKickstart: - intf.messageWindow(_("Warnings During Automatic Partitioning"), + if not anaconda.isKickstart: + anaconda.intf.messageWindow(_("Warnings During Automatic Partitioning"), _("Following warnings occurred during automatic " "partitioning:\n\n%s") % (msg.value,), custom_icon='warning') @@ -1499,17 +1499,17 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # restore drives to original state diskset.refreshDevices() partitions.setFromDisk(diskset) - if not isKickstart: + if not anaconda.isKickstart: extra = "" - dispatch.skipStep("partition", skip = 0) + anaconda.dispatch.skipStep("partition", skip = 0) else: extra = _("\n\nPress 'OK' to reboot your system.") - intf.messageWindow(_("Error Partitioning"), + anaconda.intf.messageWindow(_("Error Partitioning"), _("Could not allocate requested partitions: \n\n" "%s.%s") % (msg.value, extra), custom_icon='error') - if isKickstart: + if anaconda.isKickstart: sys.exit(0) # now do a full check of the requests @@ -1519,14 +1519,14 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): lvmLog.warning(warning) if errors: errortxt = string.join(errors, '\n') - if isKickstart: + if anaconda.isKickstart: extra = _("\n\nPress 'OK' to reboot your system.") else: extra = _("\n\nYou can choose a different automatic partitioning " "option, or click 'Back' to select manual partitioning." "\n\nPress 'OK' to continue.") - intf.messageWindow(_("Automatic Partitioning Errors"), + anaconda.intf.messageWindow(_("Automatic Partitioning Errors"), _("The following errors occurred with your " "partitioning:\n\n%s\n\n" "This can happen if there is not enough " @@ -1537,8 +1537,8 @@ def doAutoPartition(dir, diskset, partitions, intf, instClass, dispatch): # # XXX if in kickstart we reboot # - if isKickstart: - intf.messageWindow(_("Unrecoverable Error"), + if anaconda.isKickstart: + anaconda.intf.messageWindow(_("Unrecoverable Error"), _("Your system will now be rebooted.")) sys.exit(0) return DISPATCH_BACK diff --git a/dispatch.py b/dispatch.py index ef26355df..180f46e2b 100644 --- a/dispatch.py +++ b/dispatch.py @@ -19,7 +19,6 @@ from constants import * from packages import writeXConfiguration from packages import writeKSConfiguration, turnOnFilesystems from packages import doMigrateFilesystems -from packages import queryUpgradeContinue from packages import doPostAction from packages import copyAnacondaLogs from autopart import doAutoPartition @@ -33,7 +32,7 @@ from bootloader import writeBootloader, bootloaderSetupChoices from flags import flags from upgrade import upgradeMountFilesystems from upgrade import upgradeSwapSuggestion, upgradeMigrateFind -from upgrade import findRootParts +from upgrade import findRootParts, queryUpgradeContinue from network import networkDeviceCheck from installmethod import doMethodComplete @@ -58,28 +57,21 @@ log = logging.getLogger("anaconda") installSteps = [ ("welcome", ()), - ("betanag", betaNagScreen, ("intf", "dir")), + ("betanag", betaNagScreen, ("anaconda",)), ("language", ("intf", "id.instLanguage")), ("keyboard", ("id.instLanguage.getDefaultKeyboard()", "id.keyboard")), - ("findrootparts", findRootParts, ("intf", "id", "dispatch", "dir", "instPath")), + ("findrootparts", findRootParts, ("anaconda",)), ("findinstall", ("dispatch", "intf", "id", "instPath")), ("installtype", ("dispatch", "id", "method", "intf")), ("iscsi", ("id.iscsi", "intf")), ("zfcpconfig", ("id.zfcp", "id.diskset", "intf")), - ("partitionobjinit", partitionObjectsInitialize, ("id.diskset", - "id.partitions", - "dir", "intf", - "dispatch")), + ("partitionobjinit", partitionObjectsInitialize, ("anaconda",)), ("parttype", ("id.diskset", "id.partitions", "intf", "dispatch")), - ("autopartitionexecute", doAutoPartition, ("dir", "id.diskset", - "id.partitions", "intf", - "id.instClass", "dispatch")), + ("autopartitionexecute", doAutoPartition, ("anaconda",)), ("partition", ("id.fsset", "id.diskset", "id.partitions", "intf")), - ("upgrademount", upgradeMountFilesystems, ("intf", "id.upgradeRoot", - "id.fsset", "instPath")), - ("upgradecontinue", queryUpgradeContinue, ("intf", "dir")), - ("upgradeswapsuggestion", upgradeSwapSuggestion, ("dispatch", "id", - "instPath")), + ("upgrademount", upgradeMountFilesystems, ("anaconda",)), + ("upgradecontinue", queryUpgradeContinue, ("anaconda",)), + ("upgradeswapsuggestion", upgradeSwapSuggestion, ("anaconda",)), ("addswap", ("intf", "id.fsset", "instPath", "id.upgradeSwapInfo", "dispatch")), ("partitiondone", partitioningComplete, ("id.bootloader", "id.fsset", @@ -134,11 +126,11 @@ installSteps = [ class Dispatcher: def gotoPrev(self): - self.dir = -1 + self.dir = DISPATCH_BACK self.moveStep() def gotoNext(self): - self.dir = 1 + self.dir = DISPATCH_FORWARD self.moveStep() def canGoBack(self): @@ -211,10 +203,8 @@ class Dispatcher: log.info("moving (%d) to step %s" %(self.dir, info[0])) (func, args) = info[1:] rc = apply(func, self.bindArgs(args)) - if rc == DISPATCH_BACK: - self.dir = -1 - elif rc == DISPATCH_FORWARD: - self.dir = 1 + if rc in [DISPATCH_BACK, DISPATCH_FORWARD]: + self.dir = rc # if anything else, leave self.dir alone self.step = self.step + self.dir @@ -259,16 +249,25 @@ class Dispatcher: return (step, args) - def __init__(self, intf, id, method, instPath, backend): - self.dir = DISPATCH_FORWARD + def __init__(self, anaconda): + self.anaconda = anaconda + self.anaconda.dir = DISPATCH_FORWARD self.step = None self.skipSteps = {} - self.id = id + self.id = anaconda.id self.flags = flags - self.intf = intf - self.method = method + self.intf = anaconda.intf + self.method = anaconda.method self.dispatch = self - self.instPath = instPath - self.backend = backend + self.instPath = anaconda.rootPath + self.backend = anaconda.backend self.firstStep = 0 + + def _getDir(self): + return self.anaconda.dir + + def _setDir(self, dir): + self.anaconda.dir = dir + + dir = property(_getDir,_setDir) diff --git a/iw/confirm_gui.py b/iw/confirm_gui.py index a54ae8546..d128f8386 100644 --- a/iw/confirm_gui.py +++ b/iw/confirm_gui.py @@ -15,7 +15,7 @@ import gtk from iw_gui import * from rhpl.translate import _, N_ from constants import * -from packages import queryUpgradeContinue +from upgrade import queryUpgradeContinue from image import presentRequiredMediaMessage import gui import sys diff --git a/iw/upgrade_swap_gui.py b/iw/upgrade_swap_gui.py index 02fede247..87dc71ac0 100644 --- a/iw/upgrade_swap_gui.py +++ b/iw/upgrade_swap_gui.py @@ -21,7 +21,6 @@ import gui import gobject import gtk from iw_gui import * -from packages import queryUpgradeContinue from flags import flags from rhpl.translate import _, N_ diff --git a/iw/zipl_gui.py b/iw/zipl_gui.py index 0987c59c8..5e2336c23 100644 --- a/iw/zipl_gui.py +++ b/iw/zipl_gui.py @@ -19,7 +19,6 @@ import iutil import string from iw_gui import * from rhpl.translate import _, N_ -from packages import queryUpgradeContinue class ZiplWindow (InstallWindow): checkMark = None @@ -36,25 +35,6 @@ class ZiplWindow (InstallWindow): # to skip this screen pass - # XXX - # - # if doing an upgrade, offer choice of aborting upgrade. - # we can't allow them to go back in install, since we've - # started swap and mounted the systems filesystems - # if we've already started an upgrade, cannot back out - # - # if we are skipping indivual package selection, must stop it here - # very messy. - # - #if self.todo.upgrade and self.todo.instClass.skipStep("indivpackage"): - #rc = queryUpgradeContinue(self.todo.intf) - #if not rc: - #raise gui.StayOnScreen - #else: - #import sys - #print _("Aborting upgrade") - #sys.exit(0) - def getNext (self): self.bl.args.set(self.kernelEntry.get_text()) diff --git a/packages.py b/packages.py index f2a4ed549..6df2f7cc3 100644 --- a/packages.py +++ b/packages.py @@ -40,22 +40,6 @@ import rhpl.arch import logging log = logging.getLogger("anaconda") -def queryUpgradeContinue(intf, dir): - if dir == DISPATCH_FORWARD: - return - - rc = intf.messageWindow(_("Proceed with upgrade?"), - _("The file systems of the Linux installation " - "you have chosen to upgrade have already been " - "mounted. You cannot go back past this point. " - "\n\n") + - _("Would you like to continue with the upgrade?"), - type="custom", custom_icon=["error","error"], - custom_buttons=[_("Reboot"), _("Yes")]) - if rc == 0: - sys.exit(0) - return DISPATCH_FORWARD - def doPostAction(id, instPath, intf = None): id.instClass.postAction(instPath, flags.serial, intf) @@ -353,13 +337,13 @@ def recreateInitrd (kernelTag, instRoot): stdout = None, stderr = None, searchPath = 1, root = instRoot) -def betaNagScreen(intf, dir): +def betaNagScreen(anaconda): publicBetas = { "Red Hat Linux": "Red Hat Linux Public Beta", "Red Hat Enterprise Linux": "Red Hat Enterprise Linux Public Beta", "Fedora Core": "Fedora Core" } - if dir == DISPATCH_BACK: + if anaconda.dir == DISPATCH_BACK: return DISPATCH_NOOP fileagainst = None @@ -370,7 +354,7 @@ def betaNagScreen(intf, dir): fileagainst = "%s Beta" %(productName,) while 1: - rc = intf.messageWindow( _("Warning! This is pre-release software!"), + rc = anaconda.intf.messageWindow( _("Warning! This is pre-release software!"), _("Thank you for downloading this " "pre-release of %s.\n\n" "This is not a final " @@ -393,7 +377,7 @@ def betaNagScreen(intf, dir): else: msg = _("Your system will now be rebooted...") buttons = [_("_Back"), _("_Reboot")] - rc = intf.messageWindow( _("Rebooting System"), + rc = anaconda.intf.messageWindow( _("Rebooting System"), msg, type="custom", custom_icon="warning", custom_buttons=buttons) diff --git a/partitioning.py b/partitioning.py index 169313e07..9955f9179 100644 --- a/partitioning.py +++ b/partitioning.py @@ -37,20 +37,20 @@ import partRequests from rhpl.translate import _ -def partitionObjectsInitialize(diskset, partitions, dir, intf, dispatch): - if dir == DISPATCH_BACK: - diskset.closeDevices() +def partitionObjectsInitialize(anaconda): + if anaconda.dir == DISPATCH_BACK: + anaconda.id.diskset.closeDevices() isys.flushDriveDict() return # read in drive info - diskset.refreshDevices(intf, partitions.reinitializeDisks, - partitions.zeroMbr, partitions.autoClearPartDrives) + anaconda.id.diskset.refreshDevices(anaconda.intf, anaconda.id.partitions.reinitializeDisks, + anaconda.id.partitions.zeroMbr, anaconda.id.partitions.autoClearPartDrives) - diskset.checkNoDisks(intf) + anaconda.id.diskset.checkNoDisks(anaconda.intf) - partitions.setFromDisk(diskset) - partitions.setProtected(dispatch) + anaconda.id.partitions.setFromDisk(anaconda.id.diskset) + anaconda.id.partitions.setProtected(anaconda.dispatch) def partitioningComplete(bl, fsset, diskSet, partitions, intf, instPath, dir): if dir == DISPATCH_BACK and fsset.isActive(): diff --git a/upgrade.py b/upgrade.py index 738aec0a5..bbf246ef0 100644 --- a/upgrade.py +++ b/upgrade.py @@ -43,23 +43,39 @@ upgrade_remove_blacklist = [("system-config-mouse",), ("dev",)] if rhpl.getArch() == "x86_64": upgrade_remove_blacklist.extend( [("perl","i386"), ("e2fsprogs", "i386")] ) -def findRootParts(intf, id, dispatch, dir, chroot): - if dir == DISPATCH_BACK: +def queryUpgradeContinue(anaconda): + if anaconda.dir == DISPATCH_FORWARD: return - if id.rootParts is None: - id.rootParts = findExistingRoots(intf, id, chroot) - id.upgradeRoot = [] - for (dev, fs, meta) in id.rootParts: - id.upgradeRoot.append( (dev, fs) ) + rc = anaconda.intf.messageWindow(_("Proceed with upgrade?"), + _("The file systems of the Linux installation " + "you have chosen to upgrade have already been " + "mounted. You cannot go back past this point. " + "\n\n") + + _("Would you like to continue with the upgrade?"), + type="custom", custom_icon=["error","error"], + custom_buttons=[_("Reboot"), _("Yes")]) + if rc == 0: + sys.exit(0) + return DISPATCH_FORWARD + +def findRootParts(anaconda): + if anaconda.dir == DISPATCH_BACK: + return + if anaconda.id.rootParts is None: + anaconda.id.rootParts = findExistingRoots(anaconda.intf, anaconda.id, anaconda.rootPath) + + anaconda.id.upgradeRoot = [] + for (dev, fs, meta) in anaconda.id.rootParts: + anaconda.id.upgradeRoot.append( (dev, fs) ) - if id.rootParts is not None and len(id.rootParts) > 0: - dispatch.skipStep("findinstall", skip = 0) + if anaconda.id.rootParts is not None and len(anaconda.id.rootParts) > 0: + anaconda.dispatch.skipStep("findinstall", skip = 0) if productName.find("Red Hat Enterprise Linux") == -1: - dispatch.skipStep("installtype", skip = 1) + anaconda.dispatch.skipStep("installtype", skip = 1) else: - dispatch.skipStep("findinstall", skip = 1) - dispatch.skipStep("installtype", skip = 0) + anaconda.dispatch.skipStep("findinstall", skip = 1) + anaconda.dispatch.skipStep("installtype", skip = 0) def findExistingRoots(intf, id, chroot, upgradeany = 0): if not flags.setupFilesystems: @@ -165,7 +181,7 @@ def upgradeMigrateFind(dispatch, thefsset): # returns None if no more swap is needed -def upgradeSwapSuggestion(dispatch, id, instPath): +def upgradeSwapSuggestion(anaconda): # mem is in kb -- round it up to the nearest 4Mb mem = iutil.memInstalled() rem = mem % 16384 @@ -173,7 +189,7 @@ def upgradeSwapSuggestion(dispatch, id, instPath): mem = mem + (16384 - rem) mem = mem / 1024 - dispatch.skipStep("addswap", 0) + anaconda.dispatch.skipStep("addswap", 0) # don't do this if we have more then 250 MB if mem > 250: @@ -185,21 +201,21 @@ def upgradeSwapSuggestion(dispatch, id, instPath): # if we have twice as much swap as ram and at least 192 megs # total, we're safe if (swap >= (mem * 1.5)) and (swap + mem >= 192): - dispatch.skipStep("addswap", 1) + anaconda.dispatch.skipStep("addswap", 1) return # if our total is 512 megs or more, we should be safe if (swap + mem >= 512): - dispatch.skipStep("addswap", 1) + anaconda.dispatch.skipStep("addswap", 1) return fsList = [] - for entry in id.fsset.entries: + for entry in anaconda.id.fsset.entries: if entry.fsystem.getName() in fsset.getUsableLinuxFs(): if flags.setupFilesystems and not entry.isMounted(): continue - space = isys.pathSpaceAvailable(instPath + entry.mountpoint) + space = isys.pathSpaceAvailable(anaconda.rootPath + entry.mountpoint) if space > 16: info = (entry.mountpoint, entry.device.getDevice(), space) fsList.append(info) @@ -215,7 +231,7 @@ def upgradeSwapSuggestion(dispatch, id, instPath): if (size > suggSize) and (size > (suggestion + 100)): suggMnt = mnt - id.upgradeSwapInfo = (fsList, suggestion, suggMnt) + anaconda.id.upgradeSwapInfo = (fsList, suggestion, suggMnt) def swapfileExists(swapname): try: @@ -264,21 +280,21 @@ def createSwapFile(instPath, theFsset, mntPoint, size): f.close() # XXX handle going backwards -def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): +def upgradeMountFilesystems(anaconda): # mount everything and turn on swap if flags.setupFilesystems: try: - mountRootPartition(intf, rootInfo[0], oldfsset, instPath, - allowDirty = 0) + mountRootPartition(anaconda.intf, anaconda.id.upgradeRoot[0], anaconda.id.fsset, + anaconda.rootPath, allowDirty = 0) except SystemError, msg: - intf.messageWindow(_("Mount failed"), + anaconda.intf.messageWindow(_("Mount failed"), _("One or more of the file systems listed in the " "/etc/fstab on your Linux system cannot be mounted. " "Please fix this problem and try to upgrade again.")) sys.exit(0) except RuntimeError, msg: - intf.messageWindow(_("Mount failed"), + anaconda.intf.messageWindow(_("Mount failed"), _("One or more of the file systems listed in the " "/etc/fstab of your Linux system are inconsistent and " "cannot be mounted. Please fix this problem and try to " @@ -290,8 +306,8 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): '/bin/sh', '/usr/tmp') badLinks = [] for n in checkLinks: - if not os.path.islink(instPath + n): continue - l = os.readlink(instPath + n) + if not os.path.islink(anaconda.rootPath + n): continue + l = os.readlink(anaconda.rootPath + n) if l[0] == '/': badLinks.append(n) @@ -302,14 +318,14 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): "symbolic links and restart the upgrade.\n\n") for n in badLinks: message = message + '\t' + n + '\n' - intf.messageWindow(_("Absolute Symlinks"), message) + anaconda.intf.messageWindow(_("Absolute Symlinks"), message) sys.exit(0) # fix for 80446 badLinks = [] mustBeLinks = ( '/usr/tmp', ) for n in mustBeLinks: - if not os.path.islink(instPath + n): + if not os.path.islink(anaconda.rootPath + n): badLinks.append(n) if badLinks: @@ -319,24 +335,22 @@ def upgradeMountFilesystems(intf, rootInfo, oldfsset, instPath): "as symbolic links and restart the upgrade.\n\n") for n in badLinks: message = message + '\t' + n + '\n' - intf.messageWindow(_("Invalid Directories"), message) + anaconda.intf.messageWindow(_("Invalid Directories"), message) sys.exit(0) - bindMountDevDirectory(instPath) + bindMountDevDirectory(anaconda.rootPath) else: - if not os.access (instPath + "/etc/fstab", os.R_OK): - rc = intf.messageWindow(_("Warning"), + if not os.access (anaconda.rootPath + "/etc/fstab", os.R_OK): + rc = anaconda.intf.messageWindow(_("Warning"), _("%s not found") - % (instPath + "/etc/fstab",), + % (anaconda.rootPath + "/etc/fstab",), type="ok") return DISPATCH_BACK - newfsset = fsset.readFstab(instPath + '/etc/fstab', intf) + newfsset = fsset.readFstab(anaconda.rootPath + '/etc/fstab', anaconda.intf) for entry in newfsset.entries: - oldfsset.add(entry) + anaconda.id.fsset.add(entry) if flags.setupFilesystems: - oldfsset.turnOnSwap(instPath, upgrading=True) - oldfsset.mkDevRoot(instPath) - - + anaconda.id.fsset.turnOnSwap(anaconda.rootPath, upgrading=True) + anaconda.id.fsset.mkDevRoot(anaconda.rootPath) -- cgit