diff options
author | Chris Lumens <clumens@redhat.com> | 2006-05-04 15:27:30 +0000 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2006-05-04 15:27:30 +0000 |
commit | b15bb5d63e411f94476c7f064fec70e7c4209803 (patch) | |
tree | 39e58df2a3b9fe742b1843e9830254fa4f2a57f2 | |
parent | 4599e0880fa17eedb9f733ec3531395bb2910990 (diff) | |
download | anaconda-b15bb5d63e411f94476c7f064fec70e7c4209803.tar.gz anaconda-b15bb5d63e411f94476c7f064fec70e7c4209803.tar.xz anaconda-b15bb5d63e411f94476c7f064fec70e7c4209803.zip |
Finish making non-UI steps pass around the anaconda object.
-rw-r--r-- | ChangeLog | 17 | ||||
-rwxr-xr-x | anaconda | 2 | ||||
-rw-r--r-- | backend.py | 65 | ||||
-rw-r--r-- | bootloader.py | 79 | ||||
-rw-r--r-- | dispatch.py | 55 | ||||
-rw-r--r-- | installclass.py | 12 | ||||
-rw-r--r-- | installclasses/custom.py | 6 | ||||
-rw-r--r-- | installclasses/fedora.py | 12 | ||||
-rw-r--r-- | installclasses/personal_desktop.py | 18 | ||||
-rw-r--r-- | installclasses/rhel_as.py | 20 | ||||
-rw-r--r-- | installclasses/rhel_desktop.py | 18 | ||||
-rw-r--r-- | installclasses/rhel_es.py | 20 | ||||
-rw-r--r-- | installclasses/rhel_ws.py | 22 | ||||
-rw-r--r-- | installclasses/server.py | 16 | ||||
-rw-r--r-- | installclasses/workstation.py | 16 | ||||
-rw-r--r-- | installmethod.py | 8 | ||||
-rw-r--r-- | kickstart.py | 50 | ||||
-rw-r--r-- | network.py | 6 | ||||
-rw-r--r-- | packages.py | 104 | ||||
-rw-r--r-- | partitioning.py | 36 | ||||
-rw-r--r-- | upgrade.py | 8 | ||||
-rw-r--r-- | upgradeclass.py | 6 | ||||
-rw-r--r-- | yuminstall.py | 134 |
23 files changed, 365 insertions, 365 deletions
@@ -1,3 +1,20 @@ +2006-05-04 Chris Lumens <clumens@redhat.com> + + * anaconda: Pass anaconda object to setInstallData. + * dispatch.py: Finish making non-UI steps use anaconda class. + * backend.py: Use anaconda object. + * bootloader.py: Likewise. + * installclass.py: Likewise. + * installmethod.py: Likewise. + * kickstart.py: Likewise. + * network.py: Likewise. + * packages.py: Likewise. + * partitioning.py: Likewise. + * upgrade.py: Likewise. + * upgradeclass.py: Likewise. + * yuminstall.py: Likewise. + * installclasses/*.py: Likewise. + 2006-05-03 Chris Lumens <clumens@redhat.com> * backend.py (AnacondaBackend.doPostInstall): Enable/disable services @@ -895,7 +895,7 @@ if __name__ == "__main__": anaconda.id.setKeyboard(kbd) anaconda.id.setDisplayMode(opts.display_mode) - instClass.setInstallData(anaconda.id, anaconda.intf) + instClass.setInstallData(anaconda) # We need to copy the VNC-related kickstart stuff into the new ksdata if opts.ksfile is not None: diff --git a/backend.py b/backend.py index 912e21409..d2f95bdf7 100644 --- a/backend.py +++ b/backend.py @@ -40,38 +40,37 @@ class AnacondaBackend: def doPreSelection(self, intf, id, instPath): pass - def doPostSelection(self, intf, id, instPath, dir): + def doPostSelection(self, anaconda): pass - def doPreInstall(self, intf, id, instPath, dir): + def doPreInstall(self, anaconda): pass - def doPostInstall(self, intf, id, instPath): + def doPostInstall(self, anaconda): sys.stdout.flush() if flags.setupFilesystems: syslog.stop() - if id.partitions.isKickstart: - for svc in id.ksdata.services["disabled"]: + if anaconda.isKickstart: + for svc in anaconda.id.ksdata.services["disabled"]: iutil.execWithRedirect("/sbin/chkconfig", ["/sbin/chkconfig", svc, "off"], stdout="/dev/tty5", stderr="/dev/tty5", root="/mnt/sysimage") - for svc in id.ksdata.services["enabled"]: + for svc in anaconda.id.ksdata.services["enabled"]: iutil.execWithRedirect("/sbin/chkconfig", ["/sbin/chkconfig", svc, "on"], stdout="/dev/tty5", stderr="/dev/tty5", root="/mnt/sysimage") - for ud in id.ksdata.userList: - if id.users.createUser(ud.name, ud.password, ud.isCrypted, - ud.groups, ud.homedir, ud.shell, - ud.uid) == None: + for ud in anaconda.id.ksdata.userList: + if anaconda.id.users.createUser(ud.name, ud.password, ud.isCrypted, + ud.groups, ud.homedir, ud.shell, + ud.uid) == None: log.error("User %s already exists, not creating." % ud.name) - - def doInstall(self, intf, id, instPath): + def doInstall(self, anaconda): pass def initLog(self, id, instPath): @@ -121,10 +120,10 @@ class AnacondaBackend: def kernelVersionList(self): pass - def doInitialSetup(self, id, instPath): + def doInitialSetup(self, anaconda): pass - def doRepoSetup(self, intf, instPath): + def doRepoSetup(anaconda): log.warning("doRepoSetup not implemented for backend!") pass @@ -164,32 +163,32 @@ class AnacondaBackend: log.warning("writeConfig not implemented for backend!") pass -def doRepoSetup(backend, intf, id, instPath): - backend.doInitialSetup(id, instPath) - backend.doRepoSetup(intf, instPath) - if id.upgrade: - backend.checkSupportedUpgrade(intf, instPath) +def doRepoSetup(anaconda): + anaconda.backend.doInitialSetup(anaconda) + anaconda.backend.doRepoSetup(anaconda) + if anaconda.id.upgrade: + anaconda.backend.checkSupportedUpgrade(anaconda) -def doPostSelection(backend, intf, id, instPath, dir): - return backend.doPostSelection(intf, id, instPath, dir) +def doPostSelection(anaconda): + return anaconda.backend.doPostSelection(anaconda) -def doPreInstall(backend, intf, id, instPath, dir): - backend.doPreInstall(intf, id, instPath, dir) +def doPreInstall(anaconda): + anaconda.backend.doPreInstall(anaconda) -def doPostInstall(backend, intf, id, instPath): - backend.doPostInstall(intf, id, instPath) +def doPostInstall(anaconda): + anaconda.backend.doPostInstall(anaconda) -def doInstall(backend, intf, id, instPath): - backend.doInstall(intf, id, instPath) +def doInstall(anaconda): + anaconda.backend.doInstall(anaconda) # does this need to be per-backend? we'll just leave here until it does :) -def doBasePackageSelect(backend, instClass, intf): - instClass.setPackageSelection(backend, intf) - instClass.setGroupSelection(backend, intf) +def doBasePackageSelect(anaconda): + anaconda.id.instClass.setPackageSelection(anaconda) + anaconda.id.instClass.setGroupSelection(anaconda) -def writeConfiguration(backend, id, instPath): +def writeConfiguration(anaconda): log.info("Writing main configuration") if not flags.test: - backend.writeConfiguration() - id.write(instPath) + anaconda.backend.writeConfiguration() + anaconda.id.write(anaconda.rootPath) diff --git a/bootloader.py b/bootloader.py index 88bee4fe9..993c9a5eb 100644 --- a/bootloader.py +++ b/bootloader.py @@ -35,19 +35,19 @@ import booty import bootloaderInfo from fsset import * -def bootloaderSetupChoices(dispatch, bl, fsset, diskSet, dir): - if dir == DISPATCH_BACK: +def bootloaderSetupChoices(anaconda): + if anaconda.dir == DISPATCH_BACK: return - bl.updateDriveList() + anaconda.id.bootloader.updateDriveList() # iSeries bootloader on upgrades - if iutil.getPPCMachine() == "iSeries" and not bl.device: - drives = diskSet.disks.keys() + if iutil.getPPCMachine() == "iSeries" and not anaconda.id.bootloader.device: + drives = anaconda.id.diskset.disks.keys() drives.sort() bootPart = None for drive in drives: - disk = diskSet.disks[drive] + disk = anaconda.id.diskset.disks[drive] part = disk.next_partition() while part: if part.is_active() and part.native_type == 0x41: @@ -57,45 +57,45 @@ def bootloaderSetupChoices(dispatch, bl, fsset, diskSet, dir): if bootPart: break if bootPart: - bl.setDevice(bootPart) + anaconda.id.bootloader.setDevice(bootPart) dev = Device() dev.device = bootPart - fsset.add(FileSystemSetEntry(dev, None, fileSystemTypeGet("PPC PReP Boot"))) + anaconda.id.fsset.add(FileSystemSetEntry(dev, None, fileSystemTypeGet("PPC PReP Boot"))) - choices = fsset.bootloaderChoices(diskSet, bl) + choices = anaconda.id.fsset.bootloaderChoices(anaconda.id.diskset, anaconda.id.bootloader) if not choices and iutil.getPPCMachine() != "iSeries": - dispatch.skipStep("instbootloader") + anaconda.dispatch.skipStep("instbootloader") else: - dispatch.skipStep("instbootloader", skip = 0) + anaconda.dispatch.skipStep("instbootloader", skip = 0) - bl.images.setup(diskSet, fsset) + anaconda.id.bootloader.images.setup(anaconda.id.diskset, anaconda.id.fsset) - if bl.defaultDevice != None and choices: + if anaconda.id.bootloader.defaultDevice != None and choices: keys = choices.keys() # there are only two possible things that can be in the keys # mbr and boot. boot is ALWAYS present. so if the dev isn't # listed, it was mbr and we should nicely fall back to boot - if bl.defaultDevice not in keys: + if anaconda.id.bootloader.defaultDevice not in keys: log.warning("MBR not suitable as boot device; installing to partition") - bl.defaultDevice = "boot" - bl.setDevice(choices[bl.defaultDevice][0]) + anaconda.id.bootloader.defaultDevice = "boot" + anaconda.id.bootloader.setDevice(choices[anaconda.id.bootloader.defaultDevice][0]) elif choices and choices.has_key("mbr"): - bl.setDevice(choices["mbr"][0]) + anaconda.id.bootloader.setDevice(choices["mbr"][0]) elif choices and choices.has_key("boot"): - bl.setDevice(choices["boot"][0]) + anaconda.id.bootloader.setDevice(choices["boot"][0]) - bootDev = fsset.getEntryByMountPoint("/") + bootDev = anaconda.id.fsset.getEntryByMountPoint("/") if not bootDev: - bootDev = fsset.getEntryByMountPoint("/boot") - part = partedUtils.get_partition_by_name(diskSet.disks, + bootDev = anaconda.id.fsset.getEntryByMountPoint("/boot") + part = partedUtils.get_partition_by_name(anaconda.id.diskset.disks, bootDev.device.getDevice()) if part and partedUtils.end_sector_to_cyl(part.geom.dev, part.geom.end) >= 1024: - bl.above1024 = 1 + anaconda.id.bootloader.above1024 = 1 -def writeBootloader(intf, instRoot, fsset, bl, langs, backend): +def writeBootloader(anaconda): def dosync(): isys.sync() isys.sync() @@ -103,38 +103,38 @@ def writeBootloader(intf, instRoot, fsset, bl, langs, backend): justConfigFile = not flags.setupFilesystems - if bl.defaultDevice == -1: + if anaconda.id.bootloader.defaultDevice == -1: return # now make the upgrade stuff work for kickstart too. ick. - if bl.kickstart == 1 and bl.doUpgradeOnly == 1: + if anaconda.isKickstart and anaconda.id.bootloader.doUpgradeOnly: import checkbootloader - (bootType, theDev) = checkbootloader.getBootloaderTypeAndBoot(instRoot) + (bootType, theDev) = checkbootloader.getBootloaderTypeAndBoot(anaconda.rootPath) - bl.doUpgradeonly = 1 + anaconda.id.bootloader.doUpgradeonly = 1 if bootType == "GRUB": - bl.useGrubVal = 1 - bl.setDevice(theDev) + anaconda.id.bootloader.useGrubVal = 1 + anaconda.id.bootloader.setDevice(theDev) else: - bl.doUpgradeOnly = 0 + anaconda.id.bootloader.doUpgradeOnly = 0 # We don't need to let the user know if we're just doing the bootloader. if not justConfigFile: - w = intf.waitWindow(_("Bootloader"), _("Installing bootloader...")) + w = anaconda.intf.waitWindow(_("Bootloader"), _("Installing bootloader...")) kernelList = [] otherList = [] - root = fsset.getEntryByMountPoint('/') + root = anaconda.id.fsset.getEntryByMountPoint('/') if root: rootDev = root.device.getDevice() else: rootDev = None - defaultDev = bl.images.getDefault() + defaultDev = anaconda.id.bootloader.images.getDefault() kernelLabel = None kernelLongLabel = None - for (dev, (label, longlabel, type)) in bl.images.getImages().items(): + for (dev, (label, longlabel, type)) in anaconda.id.bootloader.images.getImages().items(): if (dev == rootDev) or (rootDev is None and kernelLabel is None): kernelLabel = label kernelLongLabel = longlabel @@ -151,7 +151,7 @@ def writeBootloader(intf, instRoot, fsset, bl, langs, backend): plainLabelUsed = 0 defkern = "kernel" - for (version, nick) in backend.kernelVersionList(): + for (version, nick) in anaconda.backend.kernelVersionList(): if plainLabelUsed: kernelList.append(("%s-%s" %(kernelLabel, nick), "%s-%s" %(kernelLongLabel, nick), @@ -164,7 +164,7 @@ def writeBootloader(intf, instRoot, fsset, bl, langs, backend): defkern = "kernel-%s" %(nick,) plainLabelUsed = 1 - f = open(instRoot + "/etc/sysconfig/kernel", "w+") + f = open(anaconda.rootPath + "/etc/sysconfig/kernel", "w+") f.write("# UPDATEDEFAULT specifies if new-kernel-pkg should make\n" "# new kernels the default\n") # only update the default if we're setting the default to linux (#156678) @@ -179,15 +179,16 @@ def writeBootloader(intf, instRoot, fsset, bl, langs, backend): dosync() try: - bl.write(instRoot, fsset, bl, langs, kernelList, otherList, defaultDev, - justConfigFile, intf) + anaconda.id.bootloader.write(anaconda.rootPath, anaconda.id.fsset, anaconda.id.bootloader, + anaconda.id.instLanguage, kernelList, otherList, defaultDev, + justConfigFile, anaconda.intf) if not justConfigFile: w.pop() except bootloaderInfo.BootyNoKernelWarning: if not justConfigFile: w.pop() if intf: - intf.messageWindow(_("Warning"), + anaconda.intf.messageWindow(_("Warning"), _("No kernel packages were installed on your " "system. Your boot loader configuration " "will not be changed.")) diff --git a/dispatch.py b/dispatch.py index 180f46e2b..ce278c059 100644 --- a/dispatch.py +++ b/dispatch.py @@ -74,52 +74,41 @@ installSteps = [ ("upgradeswapsuggestion", upgradeSwapSuggestion, ("anaconda",)), ("addswap", ("intf", "id.fsset", "instPath", "id.upgradeSwapInfo", "dispatch")), - ("partitiondone", partitioningComplete, ("id.bootloader", "id.fsset", - "id.diskset", "id.partitions", - "intf", "instPath", "dir")), - ("upgrademigfind", upgradeMigrateFind, ("dispatch", "id.fsset")), + ("partitiondone", partitioningComplete, ("anaconda",)), + ("upgrademigfind", upgradeMigrateFind, ("anaconda",)), ("upgrademigratefs", ("id.fsset",)), ("upgbootloader", ("dispatch", "id.bootloader")), - ("bootloadersetup", bootloaderSetupChoices, ("dispatch", "id.bootloader", - "id.fsset", "id.diskset", - "dir")), + ("bootloadersetup", bootloaderSetupChoices, ("anaconda",)), ("bootloader", ("dispatch", "id.bootloader", "id.fsset", "id.diskset")), ("bootloaderadvanced", ("dispatch", "id.bootloader", "id.fsset", "id.diskset")), - ("networkdevicecheck", networkDeviceCheck, ("id.network", "dispatch")), + ("networkdevicecheck", networkDeviceCheck, ("anaconda",)), ("network", ("id.network", "dir", "intf", "id")), ("timezone", ("id.instLanguage", "id.timezone")), ("accounts", ("intf", "id.rootPassword")), - ("reposetup", doRepoSetup, ("backend","intf", "id", "instPath")), - ("basepkgsel", doBasePackageSelect, ("backend","id.instClass", "intf")), + ("reposetup", doRepoSetup, ("anaconda",)), + ("basepkgsel", doBasePackageSelect, ("anaconda",)), ("tasksel", ("intf", "backend", "dispatch", "id.instClass")), ("group-selection", ("backend", "intf")), - ("postselection", doPostSelection, ("backend", "intf", "id", "instPath", "dir")), + ("postselection", doPostSelection, ("anaconda",)), ("confirminstall", ("intf", "id",)), ("confirmupgrade", ("intf", "id",)), ("install", ("dir", "intf", "id")), - ("enablefilesystems", turnOnFilesystems, ("dir", "id.fsset", - "id.diskset", "id.partitions", - "id.upgrade", "instPath")), - ("migratefilesystems", doMigrateFilesystems, ("dir", "id.fsset", - "id.diskset", "id.upgrade", - "instPath")), - ("setuptime", setupTimezone, ("id.timezone", "id.upgrade", "instPath", - "dir")), - ("preinstallconfig", doPreInstall, ("backend", "intf", "id", "instPath", "dir")), - ("installpackages", doInstall, ("backend", "intf", "id", "instPath")), - ("postinstallconfig", doPostInstall, ("backend", "intf", "id", "instPath")), - ("writeconfig", writeConfiguration, ("backend", "id", "instPath")), - ("firstboot", firstbootConfiguration, ("id", "instPath")), - ("instbootloader", writeBootloader, ("intf", "instPath", "id.fsset", - "id.bootloader", "id.instLanguage", - "backend")), - ("writexconfig", writeXConfiguration, ("id", "instPath")), - ("writeksconfig", writeKSConfiguration, ("id", "instPath")), - ("setfilecon", setFileCons, ("instPath","id.partitions")), - ("copylogs", copyAnacondaLogs, ("instPath",)), - ("dopostaction", doPostAction, ("id", "instPath", "intf")), - ("methodcomplete", doMethodComplete, ("method", "id.fsset")), + ("enablefilesystems", turnOnFilesystems, ("anaconda",)), + ("migratefilesystems", doMigrateFilesystems, ("anaconda",)), + ("setuptime", setupTimezone, ("anaconda",)), + ("preinstallconfig", doPreInstall, ("anaconda",)), + ("installpackages", doInstall, ("anaconda",)), + ("postinstallconfig", doPostInstall, ("anaconda",)), + ("writeconfig", writeConfiguration, ("anaconda",)), + ("firstboot", firstbootConfiguration, ("anaconda",)), + ("instbootloader", writeBootloader, ("anaconda",)), + ("writexconfig", writeXConfiguration, ("anaconda",)), + ("writeksconfig", writeKSConfiguration, ("anaconda",)), + ("setfilecon", setFileCons, ("anaconda",)), + ("copylogs", copyAnacondaLogs, ("anaconda",)), + ("dopostaction", doPostAction, ("anaconda",)), + ("methodcomplete", doMethodComplete, ("anaconda",)), ("complete", ()), ] diff --git a/installclass.py b/installclass.py index 3c6a6930f..8bf9ea6ae 100644 --- a/installclass.py +++ b/installclass.py @@ -59,7 +59,7 @@ class BaseInstallClass: # we can use a different install data class installDataClass = InstallData - def postAction(self, rootPath, serial, intf = None): + def postAction(self, anaconda, serial): pass def setBootloader(self, id, location=None, forceLBA=0, password=None, @@ -202,10 +202,10 @@ class BaseInstallClass: dispatch.skipStep("handleX11pkgs", permanent = 1) dispatch.skipStep("writexconfig", permanent = 1) - def setPackageSelection(self, backend, intf=None): + def setPackageSelection(self, anaconda): pass - def setGroupSelection(self, backend, intf=None): + def setGroupSelection(self, anaconda): pass def setZFCP(self, id, devnum, scsiid, wwpn, scsilun, fcplun): @@ -448,9 +448,9 @@ class BaseInstallClass: partitions.autoPartitionRequests = autoCreateLVMPartitionRequests(autorequests) - def setInstallData(self, id, intf = None): - id.reset() - id.instClass = self + def setInstallData(self, anaconda): + anaconda.id.reset() + anaconda.id.instClass = self # Classes should call these on __init__ to set up install data #id.setKeyboard() diff --git a/installclasses/custom.py b/installclasses/custom.py index 7b49cdef2..a177f4710 100644 --- a/installclasses/custom.py +++ b/installclasses/custom.py @@ -18,9 +18,9 @@ class InstallClass(BaseInstallClass): showMinimal = 1 hidden = 1 - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_LINUX) def __init__(self, expert): diff --git a/installclasses/fedora.py b/installclasses/fedora.py index 0c7c7fea1..afd9d21c1 100644 --- a/installclasses/fedora.py +++ b/installclasses/fedora.py @@ -21,14 +21,14 @@ class InstallClass(BaseInstallClass): (N_("Software Development"), ["development-libs", "development-tools", "gnome-software-development", "x-software-development"],), (N_("Web server"), ["web-server"])] - def setInstallData(self, id, intf = None): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_LINUX) - def setGroupSelection(self, backend, intf): - grps = backend.getDefaultGroups() - map(lambda x: backend.selectGroup(x), grps) + def setGroupSelection(self, anaconda): + grps = anaconda.backend.getDefaultGroups() + map(lambda x: anaconda.backend.selectGroup(x), grps) def setSteps(self, dispatch): BaseInstallClass.setSteps(self, dispatch); diff --git a/installclasses/personal_desktop.py b/installclasses/personal_desktop.py index b5be75563..9ec88257b 100644 --- a/installclasses/personal_desktop.py +++ b/installclasses/personal_desktop.py @@ -34,18 +34,18 @@ class InstallClass(BaseInstallClass): dispatch.skipStep("desktopchoice", skip = 0) dispatch.skipStep("package-selection", skip = 1) - def setGroupSelection(self, grpset, intf): - BaseInstallClass.__init__(self, grpset) + def setGroupSelection(self, anaconda): + BaseInstallClass.__init__(self, anaconda.backend) - grpset.unselectAll() + anaconda.backend.unselectAll() - grpset.selectGroup("workstation-common", asMeta = 1) - grpset.selectGroup("gnome-desktop") - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.backend.selectGroup("workstation-common", asMeta = 1) + anaconda.backend.selectGroup("gnome-desktop") + anaconda.backend.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_LINUX) def __init__(self, expert): diff --git a/installclasses/rhel_as.py b/installclasses/rhel_as.py index 7ecf3446e..39b36e47b 100644 --- a/installclasses/rhel_as.py +++ b/installclasses/rhel_as.py @@ -24,18 +24,18 @@ class InstallClass(BaseInstallClass): dispatch.skipStep("desktopchoice", skip = 0) dispatch.skipStep("package-selection", skip = 1) - def setGroupSelection(self, grpset, intf): - BaseInstallClass.__init__(self, grpset) + def setGroupSelection(self, anaconda): + BaseInstallClass.__init__(self, anaconda.backend) - grpset.unselectAll() - grpset.selectGroup("server", asMeta = 1) - grpset.selectGroup("base-x") - grpset.selectGroup("gnome-desktop") - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.backend.unselectAll() + anaconda.backend.selectGroup("server", asMeta = 1) + anaconda.backend.selectGroup("base-x") + anaconda.backend.selectGroup("gnome-desktop") + anaconda.backend.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_ALL) def __init__(self, expert): diff --git a/installclasses/rhel_desktop.py b/installclasses/rhel_desktop.py index 0a110dbba..09dcabd02 100644 --- a/installclasses/rhel_desktop.py +++ b/installclasses/rhel_desktop.py @@ -26,17 +26,17 @@ class InstallClass(BaseInstallClass): dispatch.skipStep("desktopchoice", skip = 0) dispatch.skipStep("package-selection", skip = 1) - def setGroupSelection(self, grpset, intf): - BaseInstallClass.__init__(self, grpset) + def setGroupSelection(self, anaconda): + BaseInstallClass.__init__(self, anaconda) - grpset.unselectAll() - grpset.selectGroup("workstation-common", asMeta = 1) - grpset.selectGroup("gnome-desktop") - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.unselectAll() + anaconda.selectGroup("workstation-common", asMeta = 1) + anaconda.selectGroup("gnome-desktop") + anaconda.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_LINUX) def __init__(self, expert): diff --git a/installclasses/rhel_es.py b/installclasses/rhel_es.py index d5ae444e2..07ffe1d7d 100644 --- a/installclasses/rhel_es.py +++ b/installclasses/rhel_es.py @@ -24,18 +24,18 @@ class InstallClass(BaseInstallClass): dispatch.skipStep("desktopchoice", skip = 0) dispatch.skipStep("package-selection", skip = 1) - def setGroupSelection(self, grpset, intf): - BaseInstallClass.__init__(self, grpset) + def setGroupSelection(self, anaconda): + BaseInstallClass.__init__(self, anaconda.backend) - grpset.unselectAll() - grpset.selectGroup("server", asMeta = 1) - grpset.selectGroup("base-x") - grpset.selectGroup("gnome-desktop") - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.backend.unselectAll() + anaconda.backend.selectGroup("server", asMeta = 1) + anaconda.backend.selectGroup("base-x") + anaconda.backend.selectGroup("gnome-desktop") + anaconda.backend.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_ALL) def __init__(self, expert): diff --git a/installclasses/rhel_ws.py b/installclasses/rhel_ws.py index c981181d5..a160714ed 100644 --- a/installclasses/rhel_ws.py +++ b/installclasses/rhel_ws.py @@ -28,19 +28,19 @@ class InstallClass(BaseInstallClass): dispatch.skipStep("desktopchoice", skip = 0) dispatch.skipStep("package-selection", skip = 1) - def setGroupSelection(self, grpset, intf): - BaseInstallClass.__init__(self, grpset) + def setGroupSelection(self, anaconda): + BaseInstallClass.__init__(self, anaconda.backend) - grpset.unselectAll() - grpset.selectGroup("workstation-common", asMeta = 1) - grpset.selectGroup("gnome-desktop") - grpset.selectGroup("development-tools") - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - grpset.selectGroup("compat-arch-development", asMeta = 1, missingOk = 1) + anaconda.backend.unselectAll() + anaconda.backend.selectGroup("workstation-common", asMeta = 1) + anaconda.backend.selectGroup("gnome-desktop") + anaconda.backend.selectGroup("development-tools") + anaconda.backend.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.backend.selectGroup("compat-arch-development", asMeta = 1, missingOk = 1) - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_LINUX) def __init__(self, expert): diff --git a/installclasses/server.py b/installclasses/server.py index 1ca9b73db..819357a59 100644 --- a/installclasses/server.py +++ b/installclasses/server.py @@ -23,16 +23,16 @@ class InstallClass(BaseInstallClass): def setSteps(self, dispatch): BaseInstallClass.setSteps(self, dispatch); - def setGroupSelection(self, grpset, intf): - BaseInstallClass.__init__(self, grpset) + def setGroupSelection(self, anaconda): + BaseInstallClass.__init__(self, anaconda.backend) - grpset.unselectAll() - grpset.selectGroup("server", asMeta = 1) - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.backend.unselectAll() + anaconda.backend.selectGroup("server", asMeta = 1) + anaconda.backend.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - BaseInstallClass.setDefaultPartitioning(self, id.partitions, + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + BaseInstallClass.setDefaultPartitioning(self, anaconda.id.partitions, CLEARPART_TYPE_ALL) def __init__(self, expert): diff --git a/installclasses/workstation.py b/installclasses/workstation.py index dcc848b12..6fa8ef6a8 100644 --- a/installclasses/workstation.py +++ b/installclasses/workstation.py @@ -26,14 +26,14 @@ class InstallClass(personal_desktop.InstallClass): showLoginChoice = 0 hidden = 1 - def setGroupSelection(self, grpset, intf): - personal_desktop.InstallClass.setGroupSelection(self, grpset, intf) - grpset.selectGroup("emacs") - grpset.selectGroup("gnome-software-development") - grpset.selectGroup("x-software-development") - grpset.selectGroup("development-tools") - grpset.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) - grpset.selectGroup("compat-arch-development", asMeta = 1, missingOk = 1) + def setGroupSelection(self, anaconda): + personal_desktop.InstallClass.setGroupSelection(self, anaconda.backend, intf) + anaconda.backend.selectGroup("emacs") + anaconda.backend.selectGroup("gnome-software-development") + anaconda.backend.selectGroup("x-software-development") + anaconda.backend.selectGroup("development-tools") + anaconda.backend.selectGroup("compat-arch-support", asMeta = 1, missingOk = 1) + anaconda.backend.selectGroup("compat-arch-development", asMeta = 1, missingOk = 1) def __init__(self, expert): personal_desktop.InstallClass.__init__(self, expert) diff --git a/installmethod.py b/installmethod.py index 7ba5ad577..a0eb8aaf9 100644 --- a/installmethod.py +++ b/installmethod.py @@ -102,14 +102,14 @@ class InstallMethod: # this handles any cleanup needed for the method. it occurs *very* late # (ie immediately before the congratulations screen). main use right now # is ejecting the cdrom -def doMethodComplete(method, fsset): - method.ejectCD() +def doMethodComplete(anaconda): + anaconda.method.ejectCD() mtab = "/dev/root / ext3 ro 0 0\n" - for ent in fsset.entries: + for ent in anaconda.id.fsset.entries: if ent.mountpoint == "/": mtab = "/dev/root / %s ro 0 0\n" %(ent.fsystem.name,) - f = open(method.rootPath + "/etc/mtab", "w+") + f = open(anaconda.rootPath + "/etc/mtab", "w+") f.write(mtab) f.close() diff --git a/kickstart.py b/kickstart.py index f1fee655a..01dcd3b76 100644 --- a/kickstart.py +++ b/kickstart.py @@ -739,7 +739,7 @@ class Kickstart(BaseInstallClass): break partitions.autoPartitionRequests.append(request) - def runPreScripts(self, intf = None): + def runPreScripts(self, anaconda): preScripts = filter (lambda s: s.type == KS_SCRIPT_PRE, self.ksdata.scripts) @@ -747,17 +747,17 @@ class Kickstart(BaseInstallClass): return log.info("Running kickstart %%pre script(s)") - if intf is not None: - w = intf.waitWindow(_("Running..."), + if anaconda.intf is not None: + w = anaconda.intf.waitWindow(_("Running..."), _("Running pre-install scripts")) - map (lambda s: s.run("/", self.serial, intf), preScripts) + map (lambda s: s.run("/", self.serial, anaconda.intf), preScripts) log.info("All kickstart %%pre script(s) have been run") - if intf is not None: + if anaconda.intf is not None: w.pop() - def postAction(self, rootPath, serial, intf = None): + def postAction(self, anaconda, serial): postScripts = filter (lambda s: s.type == KS_SCRIPT_POST, self.ksdata.scripts) @@ -765,14 +765,14 @@ class Kickstart(BaseInstallClass): return log.info("Running kickstart %%post script(s)") - if intf is not None: - w = intf.waitWindow(_("Running..."), + if anaconda.intf is not None: + w = anaconda.intf.waitWindow(_("Running..."), _("Running post-install scripts")) - map (lambda s: s.run(rootPath, serial, intf), postScripts) + map (lambda s: s.run(anaconda.rootPath, serial, anaconda.intf), postScripts) log.info("All kickstart %%post script(s) have been run") - if intf is not None: + if anaconda.intf is not None: w.pop() def runTracebackScripts(self): @@ -782,10 +782,10 @@ class Kickstart(BaseInstallClass): script.run("/", self.serial) log.info("All kickstart %%traceback script(s) have been run") - def setInstallData (self, id, intf = None): - BaseInstallClass.setInstallData(self, id) + def setInstallData (self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) self.setEarlySwapOn(1) - self.id = id + self.id = anaconda.id self.id.firstboot = FIRSTBOOT_SKIP # make sure our disks are alive @@ -800,14 +800,14 @@ class Kickstart(BaseInstallClass): try: self.ksparser.readKickstart(self.file) except KickstartError, e: - if intf: - intf.kickstartErrorWindow(e.__str__()) + if anaconda.intf: + anaconda.intf.kickstartErrorWindow(e.__str__()) sys.exit(0) else: raise KickstartError, e # run %pre scripts - self.runPreScripts(intf) + self.runPreScripts(anaconda) # now read the kickstart file for real self.ksdata = KickstartData() @@ -899,14 +899,14 @@ class Kickstart(BaseInstallClass): for n in self.handlers.showSteps: dispatch.skipStep(n, skip = 0) - def setPackageSelection(self, backend, intf=None, *args): + def setPackageSelection(self, anaconda, *args): for pkg in self.ksdata.packageList: - num = backend.selectPackage(pkg) + num = anaconda.backend.selectPackage(pkg) if self.ksdata.handleMissing == KS_MISSING_IGNORE: continue if num > 0: continue - rc = intf.messageWindow(_("Missing Package"), + rc = anaconda.intf.messageWindow(_("Missing Package"), _("You have specified that the " "package '%s' should be installed. " "This package does not exist. " @@ -920,21 +920,21 @@ class Kickstart(BaseInstallClass): else: pass - def setGroupSelection(self, backend, intf=None, *args): - backend.selectGroup("Core") + def setGroupSelection(self, anaconda, *args): + anaconda.backend.selectGroup("Core") if self.ksdata.addBase: - backend.selectGroup("Base") + anaconda.backend.selectGroup("Base") else: log.warning("not adding Base group") for grp in self.ksdata.groupList: - num = backend.selectGroup(grp) + num = anaconda.backend.selectGroup(grp) if self.ksdata.handleMissing == KS_MISSING_IGNORE: continue if num > 0: continue - rc = intf.messageWindow(_("Missing Group"), + rc = anaconda.intf.messageWindow(_("Missing Group"), _("You have specified that the " "group '%s' should be installed. " "This group does not exist. " @@ -949,7 +949,7 @@ class Kickstart(BaseInstallClass): else: pass - map(backend.deselectPackage, self.ksdata.excludedList) + map(anaconda.backend.deselectPackage, self.ksdata.excludedList) # # look through ksfile and if it contains a line: diff --git a/network.py b/network.py index 819e39fb7..7a9f6570e 100644 --- a/network.py +++ b/network.py @@ -56,10 +56,10 @@ def sanityCheckHostname(hostname): return None -def networkDeviceCheck(network, dispatch): - devs = network.available() +def networkDeviceCheck(anaconda): + devs = anaconda.id.network.available() if not devs: - dispatch.skipStep("network") + anaconda.dispatch.skipStep("network") # return if the device is of a type that requires a ptpaddr to be specified diff --git a/packages.py b/packages.py index 6df2f7cc3..bd4897ffe 100644 --- a/packages.py +++ b/packages.py @@ -40,43 +40,43 @@ import rhpl.arch import logging log = logging.getLogger("anaconda") -def doPostAction(id, instPath, intf = None): - id.instClass.postAction(instPath, flags.serial, intf) +def doPostAction(anaconda): + anaconda.id.instClass.postAction(anaconda, flags.serial) -def firstbootConfiguration(id, instPath): - if id.firstboot == FIRSTBOOT_RECONFIG: - f = open(instPath + '/etc/reconfigSys', 'w+') +def firstbootConfiguration(anaconda): + if anaconda.id.firstboot == FIRSTBOOT_RECONFIG: + f = open(anaconda.rootPath + '/etc/reconfigSys', 'w+') f.close() - elif id.firstboot == FIRSTBOOT_SKIP: - f = open(instPath + '/etc/sysconfig/firstboot', 'w+') + elif anaconda.id.firstboot == FIRSTBOOT_SKIP: + f = open(anaconda.rootPath + '/etc/sysconfig/firstboot', 'w+') f.write('RUN_FIRSTBOOT=NO') f.close() return -def writeKSConfiguration(id, instPath): +def writeKSConfiguration(anaconda): log.info("Writing autokickstart file") if not flags.test: - fn = instPath + "/root/anaconda-ks.cfg" + fn = anaconda.rootPath + "/root/anaconda-ks.cfg" else: fn = "/tmp/anaconda-ks.cfg" - id.writeKS(fn) + anaconda.id.writeKS(fn) -def copyAnacondaLogs(instPath): +def copyAnacondaLogs(anaconda): log.info("Copying anaconda logs") for (fn, dest) in (("/tmp/anaconda.log", "anaconda.log"), ("/tmp/syslog", "anaconda.syslog"), ("/tmp/ramfs/X.log", "anaconda.xlog")): if os.access(fn, os.R_OK): try: - shutil.copyfile(fn, "%s/var/log/%s" %(instPath, dest)) - os.chmod("%s/var/log/%s" %(instPath, dest), 0600) + shutil.copyfile(fn, "%s/var/log/%s" %(anaconda.rootPath, dest)) + os.chmod("%s/var/log/%s" %(anaconda.rootPath, dest), 0600) except: pass -def writeXConfiguration(id, instPath): +def writeXConfiguration(anaconda): testmode = flags.test # comment out to test @@ -95,67 +95,67 @@ def writeXConfiguration(id, instPath): # instPath = '/' # end code for test writing - if id.xsetup.skipx: + if anaconda.id.xsetup.skipx: return - card = id.videocard.primaryCard() + card = anaconda.id.videocard.primaryCard() if not card: return log.info("Writing X configuration") if not testmode: - fn = instPath + fn = anaconda.rootPath else: fn = "/tmp/" - id.xsetup.write(fn+"/etc/X11", id.mouse, id.keyboard) - id.desktop.write(instPath) + anaconda.id.xsetup.write(fn+"/etc/X11", anaconda.id.mouse, anaconda.id.keyboard) + anaconda.id.desktop.write(anaconda.rootPath) -def doMigrateFilesystems(dir, thefsset, diskset, upgrade, instPath): - if dir == DISPATCH_BACK: +def doMigrateFilesystems(anaconda): + if anaconda.dir == DISPATCH_BACK: return DISPATCH_NOOP - if thefsset.haveMigratedFilesystems(): + if anaconda.id.fsset.haveMigratedFilesystems(): return DISPATCH_NOOP - thefsset.migrateFilesystems (instPath) + anaconda.id.fsset.migrateFilesystems (anaconda.rootPath) # if we're upgrading, we may need to do lvm device node hackery - if upgrade: - thefsset.makeLVMNodes(instPath, trylvm1 = 1) + if anaconda.id.upgrade: + anaconda.id.fsset.makeLVMNodes(anaconda.rootPath, trylvm1 = 1) -def turnOnFilesystems(dir, thefsset, diskset, partitions, upgrade, instPath): - if dir == DISPATCH_BACK: +def turnOnFilesystems(anaconda): + if anaconda.dir == DISPATCH_BACK: log.info("unmounting filesystems") - thefsset.umountFilesystems(instPath) + anaconda.id.fsset.umountFilesystems(anaconda.rootPath) return if flags.setupFilesystems: - if not upgrade: - partitions.doMetaDeletes(diskset) - thefsset.setActive(diskset) - if not thefsset.isActive(): - diskset.savePartitions () - thefsset.checkBadblocks(instPath) - if not thefsset.volumesCreated: - thefsset.createLogicalVolumes(instPath) - thefsset.formatSwap(instPath) - thefsset.turnOnSwap(instPath) - thefsset.makeFilesystems (instPath) - thefsset.mountFilesystems (instPath) - -def setupTimezone(timezone, upgrade, instPath, dir): + if not anaconda.id.upgrade: + anaconda.id.partitions.doMetaDeletes(anaconda.id.diskset) + anaconda.id.fsset.setActive(anaconda.id.diskset) + if not anaconda.id.fsset.isActive(): + anaconda.id.diskset.savePartitions () + anaconda.id.fsset.checkBadblocks(anaconda.rootPath) + if not anaconda.id.fsset.volumesCreated: + anaconda.id.fsset.createLogicalVolumes(anaconda.rootPath) + anaconda.id.fsset.formatSwap(anaconda.rootPath) + anaconda.id.fsset.turnOnSwap(anaconda.rootPath) + anaconda.id.fsset.makeFilesystems (anaconda.rootPath) + anaconda.id.fsset.mountFilesystems (anaconda.rootPath) + +def setupTimezone(anaconda): # we don't need this on an upgrade or going backwards - if upgrade or (dir == DISPATCH_BACK): + if anaconda.id.upgrade or anaconda.dir == DISPATCH_BACK: return # dont do this in test mode! if flags.test or flags.rootpath: return - os.environ["TZ"] = timezone.tz - tzfile = "/usr/share/zoneinfo/" + timezone.tz + os.environ["TZ"] = anaconda.id.timezone.tz + tzfile = "/usr/share/zoneinfo/" + anaconda.id.timezone.tz if not os.access(tzfile, os.R_OK): log.error("unable to set timezone") else: @@ -167,9 +167,9 @@ def setupTimezone(timezone, upgrade, instPath, dir): if rhpl.getArch() == "s390": return args = [ "/usr/sbin/hwclock", "--hctosys" ] - if timezone.utc: + if anaconda.id.timezone.utc: args.append("-u") - elif timezone.arc: + elif anaconda.id.timezone.arc: args.append("-a") try: @@ -181,7 +181,7 @@ def setupTimezone(timezone, upgrade, instPath, dir): # FIXME: this is a huge gross hack. hard coded list of files # created by anaconda so that we can not be killed by selinux -def setFileCons(instPath, partitions): +def setFileCons(anaconda): import partRequests if flags.selinux: @@ -197,7 +197,7 @@ def setFileCons(instPath, partitions): "/etc/mdadm.conf"] vgs = [] - for entry in partitions.requests: + for entry in anaconda.id.partitions.requests: if isinstance(entry, partRequests.VolumeGroupRequestSpec): vgs.append("/dev/%s" %(entry.volumeGroupName,)) @@ -205,9 +205,9 @@ def setFileCons(instPath, partitions): for dir in ["/var/lib/rpm", "/etc/lvm", "/dev/mapper"] + vgs: def addpath(x): return dir + "/" + x - if not os.path.isdir(instPath + dir): + if not os.path.isdir(anaconda.rootPath + dir): continue - dirfiles = os.listdir(instPath + dir) + dirfiles = os.listdir(anaconda.rootPath + dir) files.extend(map(addpath, dirfiles)) files.append(dir) @@ -215,7 +215,7 @@ def setFileCons(instPath, partitions): # regexes will work child = os.fork() if (not child): - os.chroot(instPath) + os.chroot(anaconda.rootPath) for f in files: if not os.access("%s" %(f,), os.R_OK): log.warning("%s doesn't exist" %(f,)) diff --git a/partitioning.py b/partitioning.py index 9955f9179..02351ff3a 100644 --- a/partitioning.py +++ b/partitioning.py @@ -52,9 +52,9 @@ def partitionObjectsInitialize(anaconda): 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(): - rc = intf.messageWindow(_("Installation cannot continue."), +def partitioningComplete(anaconda): + if anaconda.dir == DISPATCH_BACK and anaconda.id.fsset.isActive(): + rc = anaconda.intf.messageWindow(_("Installation cannot continue."), _("The partitioning options you have chosen " "have already been activated. You can " "no longer return to the disk editing " @@ -65,17 +65,17 @@ def partitioningComplete(bl, fsset, diskSet, partitions, intf, instPath, dir): sys.exit(0) return DISPATCH_FORWARD - partitions.sortRequests() - fsset.reset() - for request in partitions.requests: + anaconda.id.partitions.sortRequests() + anaconda.id.fsset.reset() + for request in anaconda.id.partitions.requests: # XXX improve sanity checking if (not request.fstype or (request.fstype.isMountable() and not request.mountpoint)): continue - entry = request.toEntry(partitions) + entry = request.toEntry(anaconda.id.partitions) if entry: - fsset.add (entry) + anaconda.id.fsset.add (entry) else: raise RuntimeError, ("Managed to not get an entry back from " "request.toEntry") @@ -84,9 +84,8 @@ def partitioningComplete(bl, fsset, diskSet, partitions, intf, instPath, dir): or iutil.memAvailable() > isys.EARLY_SWAP_RAM): return - # XXX this attribute is probably going away - if not partitions.isKickstart: - rc = intf.messageWindow(_("Low Memory"), + if not anaconda.isKickstart: + rc = anaconda.intf.messageWindow(_("Low Memory"), _("As you don't have much memory in this " "machine, we need to turn on swap space " "immediately. To do this we'll have to " @@ -96,14 +95,11 @@ def partitioningComplete(bl, fsset, diskSet, partitions, intf, instPath, dir): rc = 1 if rc: - partitions.doMetaDeletes(diskSet) - fsset.setActive(diskSet) - diskSet.savePartitions () - fsset.createLogicalVolumes(instPath) - fsset.formatSwap(instPath) - fsset.turnOnSwap(instPath) + anaconda.id.partitions.doMetaDeletes(anaconda.id.diskset) + anaconda.id.fsset.setActive(anaconda.id.diskset) + anaconda.id.diskset.savePartitions () + anaconda.id.fsset.createLogicalVolumes(anaconda.rootPath) + anaconda.id.fsset.formatSwap(anaconda.rootPath) + anaconda.id.fsset.turnOnSwap(anaconda.rootPath) return - - - diff --git a/upgrade.py b/upgrade.py index bbf246ef0..4ed558cb6 100644 --- a/upgrade.py +++ b/upgrade.py @@ -172,12 +172,12 @@ def bindMountDevDirectory(instPath): fs.mount("/dev", "%s/dev" % (instPath,), bindMount=1) # returns None if no filesystem exist to migrate -def upgradeMigrateFind(dispatch, thefsset): - migents = thefsset.getMigratableEntries() +def upgradeMigrateFind(anaconda): + migents = anaconda.id.fsset.getMigratableEntries() if not migents or len(migents) < 1: - dispatch.skipStep("upgrademigratefs") + anaconda.dispatch.skipStep("upgrademigratefs") else: - dispatch.skipStep("upgrademigratefs", skip = 0) + anaconda.dispatch.skipStep("upgrademigratefs", skip = 0) # returns None if no more swap is needed diff --git a/upgradeclass.py b/upgradeclass.py index 606dbf4cd..c393dfdbb 100644 --- a/upgradeclass.py +++ b/upgradeclass.py @@ -67,9 +67,9 @@ class InstallClass(BaseInstallClass): if rhpl.getArch() != "i386" and rhpl.getArch() != "x86_64": dispatch.skipStep("upgbootloader") - def setInstallData(self, id): - BaseInstallClass.setInstallData(self, id) - id.setUpgrade(True) + def setInstallData(self, anaconda): + BaseInstallClass.setInstallData(self, anaconda) + anaconda.id.setUpgrade(True) def __init__(self, expert): BaseInstallClass.__init__(self, expert) diff --git a/yuminstall.py b/yuminstall.py index 34f0eba7a..e4022e091 100644 --- a/yuminstall.py +++ b/yuminstall.py @@ -651,19 +651,19 @@ class YumBackend(AnacondaBackend): if rc == 0: sys.exit(0) - def doInitialSetup(self, id, instPath): - if id.getUpgrade(): + def doInitialSetup(self, anaconda): + if anaconda.id.getUpgrade(): # FIXME: make sure that the rpmdb doesn't have stale locks :/ for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]: try: - os.unlink("%s/var/lib/rpm/%s" %(instPath, rpmfile)) + os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile)) except: log.error("failed to unlink /var/lib/rpm/%s" %(rpmfile,)) self.ac = AnacondaYumConf(self.method.getMethodUri(), - configfile="/tmp/yum.conf", root=instPath) + configfile="/tmp/yum.conf", root=anaconda.rootPath) self.ac.write() - self.ayum = AnacondaYum(fn="/tmp/yum.conf", root=instPath, method=self.method) + self.ayum = AnacondaYum(fn="/tmp/yum.conf", root=anaconda.rootPath, method=self.method) def doGroupSetup(self): self.ayum.doGroupSetup() @@ -672,7 +672,7 @@ class YumBackend(AnacondaBackend): if self.ayum.comps._groups.has_key("xen"): del self.ayum.comps._groups["xen"] - def doRepoSetup(self, intf, instPath): + def doRepoSetup(self, anaconda): if not os.path.exists("/tmp/cache"): iutil.mkdirChain("/tmp/cache/headers") @@ -688,7 +688,7 @@ class YumBackend(AnacondaBackend): tot = 0 for t in tasks: tot += t[1] - waitwin = YumProgress(intf, _("Retrieving installation information..."), + waitwin = YumProgress(anaconda.intf, _("Retrieving installation information..."), tot) self.ayum.repos.callback = waitwin @@ -703,7 +703,7 @@ class YumBackend(AnacondaBackend): except RepoError, e: log.error("reading package metadata: %s" %(e,)) waitwin.pop() - intf.messageWindow(_("Error"), + anaconda.intf.messageWindow(_("Error"), _("Unable to read package metadata. This may be " "due to a missing repodata directory. Please " "ensure that your install tree has been " @@ -714,7 +714,7 @@ class YumBackend(AnacondaBackend): self.ayum.repos.callback = None self.ayum.repos.setFailureCallback((self.urlgrabberFailureCB, (), - {"intf":intf, "method":self.method})) + {"intf":anaconda.intf, "method":self.method})) def _catchallCategory(self): # FIXME: this is a bad hack, but catch groups which aren't in @@ -834,17 +834,17 @@ class YumBackend(AnacondaBackend): for entry in fsset.entries: map(self.selectPackage, entry.fsystem.getNeededPackages()) - def doPostSelection(self, intf, id, instPath, dir): + def doPostSelection(self, anaconda): # Only solve dependencies on the way through the installer, not the way back. - if dir == DISPATCH_BACK: + if anaconda.dir == DISPATCH_BACK: return # do some sanity checks for kernel and bootloader self.selectBestKernel() self.selectBootloader() - self.selectFSPackages(id.fsset) - - if id.getUpgrade(): + self.selectFSPackages(anaconda.id.fsset) + + if anaconda.id.getUpgrade(): from upgrade import upgrade_remove_blacklist self.upgradeFindPackages() for pkg in upgrade_remove_blacklist: @@ -859,24 +859,24 @@ class YumBackend(AnacondaBackend): self.ayum.remove(name=pkgname, arch=pkgarch) self.ayum.update() - dscb = YumDepSolveProgress(intf) + dscb = YumDepSolveProgress(anaconda.intf) self.ayum.dsCallback = dscb try: (code, msgs) = self.ayum.buildTransaction() (self.dlpkgs, self.totalSize, self.totalFiles) = self.ayum.getDownloadPkgs() - if not id.getUpgrade(): - usrPart = id.partitions.getRequestByMountPoint("/usr") + if not anaconda.id.getUpgrade(): + usrPart = anaconda.id.partitions.getRequestByMountPoint("/usr") if usrPart is not None: largePart = usrPart else: - largePart = id.partitions.getRequestByMountPoint("/") + largePart = anaconda.id.partitions.getRequestByMountPoint("/") if largePart and \ - largePart.getActualSize(id.partitions, id.diskset) < self.totalSize / 1024: + largePart.getActualSize(anaconda.id.partitions, anaconda.id.diskset) < self.totalSize / 1024: dscb.pop() - rc = intf.messageWindow(_("Error"), + rc = anaconda.intf.messageWindow(_("Error"), _("Your selected packages require %d MB " "of free space for installation, but " "you do not have enough available. " @@ -893,11 +893,11 @@ class YumBackend(AnacondaBackend): dscb.pop() self.ayum.dsCallback = None - def doPreInstall(self, intf, id, instPath, dir): - if dir == DISPATCH_BACK: + def doPreInstall(self, anaconda): + if anaconda.dir == DISPATCH_BACK: for d in ("/selinux", "/dev"): try: - isys.umount(instPath + d, removeDir = 0) + isys.umount(anaconda.rootPath + d, removeDir = 0) except Exception, e: log.error("unable to unmount %s: %s" %(d, e)) return @@ -906,44 +906,44 @@ class YumBackend(AnacondaBackend): return # shorthand - upgrade = id.getUpgrade() + upgrade = anaconda.id.getUpgrade() if upgrade: # An old mtab can cause confusion (esp if loop devices are # in it) - f = open(instPath + "/etc/mtab", "w+") + f = open(anaconda.rootPath + "/etc/mtab", "w+") f.close() # we really started writing modprobe.conf out before things were # all completely ready. so now we need to nuke old modprobe.conf's # if you're upgrading from a 2.4 dist so that we can get the # transition right - if (os.path.exists(instPath + "/etc/modules.conf") and - os.path.exists(instPath + "/etc/modprobe.conf") and - not os.path.exists(instPath + "/etc/modprobe.conf.anacbak")): + if (os.path.exists(anaconda.rootPath + "/etc/modules.conf") and + os.path.exists(anaconda.rootPath + "/etc/modprobe.conf") and + not os.path.exists(anaconda.rootPath + "/etc/modprobe.conf.anacbak")): log.info("renaming old modprobe.conf -> modprobe.conf.anacbak") - os.rename(instPath + "/etc/modprobe.conf", - instPath + "/etc/modprobe.conf.anacbak") + os.rename(anaconda.rootPath + "/etc/modprobe.conf", + anaconda.rootPath + "/etc/modprobe.conf.anacbak") - if self.method.systemMounted (id.fsset, instPath): - id.fsset.umountFilesystems(instPath) + if self.method.systemMounted (anaconda.id.fsset, anaconda.rootPath): + anaconda.id.fsset.umountFilesystems(anaconda.rootPath) return DISPATCH_BACK for i in ( '/var', '/var/lib', '/var/lib/rpm', '/tmp', '/dev', '/etc', '/etc/sysconfig', '/etc/sysconfig/network-scripts', '/etc/X11', '/root', '/var/tmp', '/etc/rpm', '/var/cache', '/var/cache/yum' ): try: - os.mkdir(instPath + i) + os.mkdir(anaconda.rootPath + i) except os.error, (errno, msg): pass # log.error("Error making directory %s: %s" % (i, msg)) - self.initLog(id, instPath) + self.initLog(anaconda.id, anaconda.rootPath) if flags.setupFilesystems: # setup /etc/rpm/platform for the post-install environment - iutil.writeRpmPlatform(instPath) + iutil.writeRpmPlatform(anaconda.rootPath) try: # FIXME: making the /var/lib/rpm symlink here is a hack to @@ -964,40 +964,39 @@ class YumBackend(AnacondaBackend): # SELinux hackery (#121369) if flags.selinux: try: - os.mkdir(instPath + "/selinux") + os.mkdir(anaconda.rootPath + "/selinux") except Exception, e: pass try: - isys.mount("/selinux", instPath + "/selinux", "selinuxfs") + isys.mount("/selinux", anaconda.rootPath + "/selinux", "selinuxfs") except Exception, e: log.error("error mounting selinuxfs: %s" %(e,)) # we need to have a /dev during install and now that udev is # handling /dev, it gets to be more fun. so just bind mount the # installer /dev - if 1: - log.warning("no dev package, going to bind mount /dev") - isys.mount("/dev", "/mnt/sysimage/dev", bindMount = 1) - if not upgrade: - id.fsset.mkDevRoot("/mnt/sysimage/") + log.warning("no dev package, going to bind mount /dev") + isys.mount("/dev", "/mnt/sysimage/dev", bindMount = 1) + if not upgrade: + anaconda.id.fsset.mkDevRoot("/mnt/sysimage/") # write out the fstab if not upgrade: - id.fsset.write(instPath) + anaconda.id.fsset.write(anaconda.rootPath) # rootpath mode doesn't have this file around if os.access("/tmp/modprobe.conf", os.R_OK): shutil.copyfile("/tmp/modprobe.conf", - instPath + "/etc/modprobe.conf") + anaconda.rootPath + "/etc/modprobe.conf") if os.access("/tmp/zfcp.conf", os.R_OK): shutil.copyfile("/tmp/zfcp.conf", - instPath + "/etc/zfcp.conf") + anaconda.rootPath + "/etc/zfcp.conf") # make a /etc/mtab so mkinitrd can handle certain hw (usb) correctly - f = open(instPath + "/etc/mtab", "w+") - f.write(id.fsset.mtab()) + f = open(anaconda.rootPath + "/etc/mtab", "w+") + f.write(anaconda.id.fsset.mtab()) f.close() - def checkSupportedUpgrade(self, intf, instPath): + def checkSupportedUpgrade(self, anaconda): # Figure out current version for upgrade nag and for determining weird # upgrade cases supportedUpgradeVersion = -1 @@ -1016,7 +1015,7 @@ class YumBackend(AnacondaBackend): supportedUpgradeVersion = 1 if supportedUpgradeVersion == 0: - rc = intf.messageWindow(_("Warning"), + rc = anaconda.intf.messageWindow(_("Warning"), _("You appear to be upgrading from a system " "which is too old to upgrade to this " "version of %s. Are you sure you wish to " @@ -1026,34 +1025,33 @@ class YumBackend(AnacondaBackend): if rc == 0: for rpmfile in ["__db.000", "__db.001", "__db.002", "__db.003"]: try: - os.unlink("%s/var/lib/rpm/%s" %(instPath, rpmfile)) + os.unlink("%s/var/lib/rpm/%s" %(anaconda.rootPath, rpmfile)) except: log.info("error %s removing file: /var/lib/rpm/%s" %(e,rpmfile)) pass sys.exit(0) - def doInstall(self, intf, id, instPath): + def doInstall(self, anaconda): log.info("Preparing to install packages") if flags.test: log.info("Test mode - not performing install") return - - if not id.upgrade: + if not anaconda.id.upgrade: rpm.addMacro("__dbi_htconfig", "hash nofsync %{__dbi_other} %{__dbi_perms}") pkgTimer = timer.Timer(start = 0) - id.instProgress.setSizes(len(self.dlpkgs), self.totalSize, self.totalFiles) - id.instProgress.processEvents() + anaconda.id.instProgress.setSizes(len(self.dlpkgs), self.totalSize, self.totalFiles) + anaconda.id.instProgress.processEvents() - cb = simpleCallback(intf.messageWindow, id.instProgress, pkgTimer, self.method, intf.progressWindow, self.instLog, self.modeText, self.ayum.ts) + cb = simpleCallback(anaconda.intf.messageWindow, anaconda.id.instProgress, pkgTimer, self.method, anaconda.intf.progressWindow, self.instLog, self.modeText, self.ayum.ts) - cb.initWindow = intf.waitWindow(_("Install Starting"), + cb.initWindow = anaconda.intf.waitWindow(_("Install Starting"), _("Starting install process. This may take several minutes...")) - self.ayum.run(self.instLog, cb, intf, id) + self.ayum.run(self.instLog, cb, anaconda.intf, anaconda.id) if not cb.beenCalled: cb.initWindow.pop() @@ -1061,33 +1059,33 @@ class YumBackend(AnacondaBackend): self.method.filesDone() self.instLog.close () - id.instProgress = None + anaconda.id.instProgress = None - def doPostInstall(self, intf, id, instPath): + def doPostInstall(self, anaconda): if flags.test: return - if id.getUpgrade(): - w = intf.progressWindow(_("Post Upgrade"), + if anaconda.id.getUpgrade(): + w = anaconda.intf.progressWindow(_("Post Upgrade"), _("Performing post upgrade configuration..."), 6) else: - w = intf.progressWindow(_("Post Install"), + w = anaconda.intf.progressWindow(_("Post Install"), _("Performing post install configuration..."), 6) - id.network.write(instPath) + anaconda.id.network.write(anaconda.rootPath) for tsmbr in self.ayum.tsInfo.matchNaevr(name='rhgb'): - id.bootloader.args.append("rhgb quiet") + anaconda.id.bootloader.args.append("rhgb quiet") break for tsmbr in self.ayum.tsInfo.matchNaevr(name='gdm'): - if id.displayMode == 'g': - id.desktop.setDefaultRunLevel(5) + if anaconda.id.displayMode == 'g': + anaconda.id.desktop.setDefaultRunLevel(5) break # XXX: write proper lvm config w.pop() - AnacondaBackend.doPostInstall(self, intf, id, instPath) + AnacondaBackend.doPostInstall(self, anaconda) def kernelVersionList(self): kernelVersions = [] |