Programatically changing references. I revised this and sometimes 'constants' import had to be added. --- anaconda | 3 +- pyanaconda/__init__.py | 2 +- pyanaconda/backend.py | 14 ++++++------ pyanaconda/bootloader.py | 6 ++-- pyanaconda/exception.py | 5 ++- pyanaconda/iw/kbd_gui.py | 3 +- pyanaconda/iw/language_gui.py | 2 +- pyanaconda/iw/timezone_gui.py | 2 +- pyanaconda/kickstart.py | 2 +- pyanaconda/livecd.py | 18 ++++++++-------- pyanaconda/packages.py | 36 ++++++++++++++++---------------- pyanaconda/rescue.py | 16 +++++++------- pyanaconda/sshd.py | 3 +- pyanaconda/storage/__init__.py | 16 +++++++------- pyanaconda/textw/keyboard_text.py | 2 +- pyanaconda/textw/language_text.py | 4 +- pyanaconda/textw/timezone_text.py | 2 +- pyanaconda/upgrade.py | 20 +++++++++--------- pyanaconda/yuminstall.py | 40 ++++++++++++++++++------------------ 19 files changed, 100 insertions(+), 96 deletions(-) diff --git a/anaconda b/anaconda index 250b2ea..b99bc52 100755 --- a/anaconda +++ b/anaconda @@ -564,6 +564,7 @@ if __name__ == "__main__": # pull this in to get product name and versioning from pyanaconda import product + from pyanaconda.constants import ROOT_PATH from pyanaconda import isys isys.initLog() @@ -745,7 +746,7 @@ if __name__ == "__main__": anaconda.instLanguage.instLang = opts.lang anaconda.instLanguage.buildLocale() anaconda.instLanguage.systemLang = opts.lang - anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(ROOT_PATH)) if opts.keymap: anaconda.dispatch.skip_steps("keyboard") diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py index 62acb64..905b4d6 100644 --- a/pyanaconda/__init__.py +++ b/pyanaconda/__init__.py @@ -31,7 +31,7 @@ import os, time, string import iutil import isys -from constants import * +from constants import ROOT_PATH from tempfile import mkstemp import logging diff --git a/pyanaconda/backend.py b/pyanaconda/backend.py index eb5e780..cd630bd 100644 --- a/pyanaconda/backend.py +++ b/pyanaconda/backend.py @@ -44,7 +44,7 @@ class AnacondaBackend: """Abstract backend class all backends should inherit from this @param instPath: root path for the installation to occur""" self.anaconda = anaconda - self.instPath = anaconda.rootPath + self.instPath = ROOT_PATH self.instLog = None self.modeText = "" @@ -66,14 +66,14 @@ class AnacondaBackend: pass def doPreInstall(self, anaconda): - self.initLog(anaconda.rootPath) + self.initLog(ROOT_PATH) def copyFirmware(self, anaconda): # Multiple driver disks may be loaded, so we need to glob for all # the firmware files in the common DD firmware directory for f in glob.glob(DD_FIRMWARE+"/*"): try: - shutil.copyfile(f, "%s/lib/firmware/" % anaconda.rootPath) + shutil.copyfile(f, "%s/lib/firmware/" % ROOT_PATH) except IOError as e: log.error("Could not copy firmware file %s: %s" % (f, e.strerror)) @@ -82,17 +82,17 @@ class AnacondaBackend: self.copyFirmware(anaconda) if anaconda.extraModules: - for (n, arch, tag) in self.kernelVersionList(anaconda.rootPath): - packages.recreateInitrd(n, anaconda.rootPath) + for (n, arch, tag) in self.kernelVersionList(ROOT_PATH): + packages.recreateInitrd(n, ROOT_PATH) #copy RPMS for d in glob.glob(DD_RPMS): - shutil.copytree(d, anaconda.rootPath + "/root/" + os.path.basename(d)) + shutil.copytree(d, ROOT_PATH + "/root/" + os.path.basename(d)) #copy modules and firmware if os.path.exists(DD_ALL): try: - shutil.copytree(DD_ALL, anaconda.rootPath + "/root/DD") + shutil.copytree(DD_ALL, ROOT_PATH + "/root/DD") except IOError as e: pass diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py index d17bd79..f115a30 100644 --- a/pyanaconda/bootloader.py +++ b/pyanaconda/bootloader.py @@ -1973,7 +1973,7 @@ class SILO(YabootSILOBase): # anaconda-specific functions def writeSysconfigKernel(anaconda, default_kernel): - f = open(anaconda.rootPath + "/etc/sysconfig/kernel", "w+") + f = open(ROOT_PATH + "/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) @@ -2012,7 +2012,7 @@ def writeBootloader(anaconda): _("Installing bootloader.")) # get a list of installed kernel packages - kernel_versions = anaconda.backend.kernelVersionList(anaconda.rootPath) + kernel_versions = anaconda.backend.kernelVersionList(ROOT_PATH) if not kernel_versions: log.warning("no kernel was installed -- bootloader config unchanged") if anaconda.intf: @@ -2072,7 +2072,7 @@ def writeBootloader(anaconda): network=anaconda.network) try: - anaconda.bootloader.write(install_root=anaconda.rootPath) + anaconda.bootloader.write(install_root=ROOT_PATH) except BootLoaderError as e: if anaconda.intf: anaconda.intf.messageWindow(_("Warning"), diff --git a/pyanaconda/exception.py b/pyanaconda/exception.py index 016e9f3..6cef5c9 100644 --- a/pyanaconda/exception.py +++ b/pyanaconda/exception.py @@ -31,6 +31,7 @@ import signal from flags import flags import kickstart import storage.errors +from pyanaconda.constants import ROOT_PATH import logging log = logging.getLogger("anaconda") @@ -100,8 +101,8 @@ class AnacondaExceptionHandler(ExceptionHandler): def initExceptionHandling(anaconda): fileList = [ "/tmp/anaconda.log", "/tmp/lvmout", "/tmp/resize.out", "/tmp/program.log", "/tmp/storage.log", "/tmp/ifcfg.log", - "/tmp/yum.log", anaconda.rootPath + "/root/install.log", - anaconda.rootPath + "/root/upgrade.log", "/proc/cmdline" ] + "/tmp/yum.log", ROOT_PATH + "/root/install.log", + ROOT_PATH + "/root/upgrade.log", "/proc/cmdline" ] if flags.livecdInstall: fileList.extend(["/var/log/messages"]) else: diff --git a/pyanaconda/iw/kbd_gui.py b/pyanaconda/iw/kbd_gui.py index 83ccaff..84fd366 100644 --- a/pyanaconda/iw/kbd_gui.py +++ b/pyanaconda/iw/kbd_gui.py @@ -19,6 +19,7 @@ # from iw_gui import * +from pyanaconda.constants import ROOT_PATH import sys sys.path.append("/usr/share/system-config-keyboard") @@ -36,7 +37,7 @@ class KeyboardWindow(InstallWindow, installKeyboardWindow): installKeyboardWindow.getNext(self) def getScreen(self, anaconda): - default = anaconda.instLanguage.getDefaultKeyboard(anaconda.rootPath) + default = anaconda.instLanguage.getDefaultKeyboard(ROOT_PATH) anaconda.keyboard.set(default) vbox = installKeyboardWindow.getScreen(self, default, anaconda.keyboard) self.modelView.connect("select-cursor-row", lambda widget, vbox=vbox: self.ics.setGrabNext(1)) diff --git a/pyanaconda/iw/language_gui.py b/pyanaconda/iw/language_gui.py index 7bc771e..7b2c652 100644 --- a/pyanaconda/iw/language_gui.py +++ b/pyanaconda/iw/language_gui.py @@ -51,7 +51,7 @@ class LanguageWindow (InstallWindow): self.instLang.instLang = self.lang self.instLang.systemLang = self.lang self.instLang.buildLocale() - anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(ROOT_PATH)) self.ics.getICW().setLanguage() return None diff --git a/pyanaconda/iw/timezone_gui.py b/pyanaconda/iw/timezone_gui.py index 0d2313b..db9ade7 100644 --- a/pyanaconda/iw/timezone_gui.py +++ b/pyanaconda/iw/timezone_gui.py @@ -81,7 +81,7 @@ class TimezoneWindow(InstallWindow): (self.default, asUTC) = self.timezone.getTimezoneInfo() if not self.default: - self.default = anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath) + self.default = anaconda.instLanguage.getDefaultTimeZone(ROOT_PATH) asUTC = 0 if (string.find(self.default, "UTC") != -1): diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py index 461200b..615773c 100644 --- a/pyanaconda/kickstart.py +++ b/pyanaconda/kickstart.py @@ -1363,7 +1363,7 @@ def runPostScripts(anaconda): w = anaconda.intf.waitWindow(_("Post-Installation"), _("Running post-installation scripts")) - map (lambda s: s.run(anaconda.rootPath, flags.serial, anaconda.intf), postScripts) + map (lambda s: s.run(ROOT_PATH, flags.serial, anaconda.intf), postScripts) log.info("All kickstart %%post script(s) have been run") if anaconda.intf is not None: diff --git a/pyanaconda/livecd.py b/pyanaconda/livecd.py index 199f5c5..0968240 100644 --- a/pyanaconda/livecd.py +++ b/pyanaconda/livecd.py @@ -129,7 +129,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): def postAction(self, anaconda): try: anaconda.storage.umountFilesystems(swapoff = False) - os.rmdir(anaconda.rootPath) + os.rmdir(ROOT_PATH) except Exception as e: log.error("Unable to unmount filesystems: %s" % e) @@ -251,7 +251,7 @@ class LiveCDCopyBackend(backend.AnacondaBackend): # And now let's do the real copies for tocopy in mountpoints: device = anaconda.storage.mountpoints[tocopy] - source = "%s/%s" % (anaconda.rootPath, tocopy) + source = "%s/%s" % (ROOT_PATH, tocopy) dest = "/mnt/%s" % (tocopy,) # FIXME: all calls to wait.refresh() are kind of a hack... we @@ -279,11 +279,11 @@ class LiveCDCopyBackend(backend.AnacondaBackend): # so that post-install writes end up where they're supposed to end up _setupFilesystems(anaconda.storage.mountpoints, teardown=True) _setupFilesystems(anaconda.storage.mountpoints, - chroot=anaconda.rootPath) + chroot=ROOT_PATH) # restore stat info for each mountpoint for mountpoint in reversed(mountpoints): - dest = "%s/%s" % (anaconda.rootPath, mountpoint) + dest = "%s/%s" % (ROOT_PATH, mountpoint) log.info("Restoring stats on %s" % (dest,)) st = stats[mountpoint] @@ -304,19 +304,19 @@ class LiveCDCopyBackend(backend.AnacondaBackend): packages.rpmSetupGraphicalSystem(anaconda) # now write out the "real" fstab and mtab - anaconda.storage.write(anaconda.rootPath) + anaconda.storage.write(ROOT_PATH) # copy over the modprobe.conf if os.path.exists("/etc/modprobe.conf"): shutil.copyfile("/etc/modprobe.conf", - anaconda.rootPath + "/etc/modprobe.conf") + ROOT_PATH + "/etc/modprobe.conf") # set the same keyboard the user selected in the keyboard dialog: - anaconda.keyboard.write(anaconda.rootPath) + anaconda.keyboard.write(ROOT_PATH) # rebuild the initrd(s) - vers = self.kernelVersionList(anaconda.rootPath) + vers = self.kernelVersionList(ROOT_PATH) for (n, arch, tag) in vers: - packages.recreateInitrd(n, anaconda.rootPath) + packages.recreateInitrd(n, ROOT_PATH) def kernelVersionList(self, rootPath = "/"): return packages.rpmKernelVersionList(rootPath) diff --git a/pyanaconda/packages.py b/pyanaconda/packages.py index fed10c3..a33526d 100644 --- a/pyanaconda/packages.py +++ b/pyanaconda/packages.py @@ -51,10 +51,10 @@ def doPostAction(anaconda): def firstbootConfiguration(anaconda): if anaconda.firstboot == FIRSTBOOT_RECONFIG: - f = open(anaconda.rootPath + '/etc/reconfigSys', 'w+') + f = open(ROOT_PATH + '/etc/reconfigSys', 'w+') f.close() elif anaconda.firstboot == FIRSTBOOT_SKIP: - f = open(anaconda.rootPath + '/etc/sysconfig/firstboot', 'w+') + f = open(ROOT_PATH + '/etc/sysconfig/firstboot', 'w+') f.write('RUN_FIRSTBOOT=NO') f.close() @@ -62,14 +62,14 @@ def firstbootConfiguration(anaconda): def writeKSConfiguration(anaconda): log.info("Writing autokickstart file") - fn = anaconda.rootPath + "/root/anaconda-ks.cfg" + fn = ROOT_PATH + "/root/anaconda-ks.cfg" anaconda.writeKS(fn) def copyAnacondaLogs(anaconda): log.info("Copying anaconda logs") - if not os.path.isdir (anaconda.rootPath + '/var/log/anaconda'): - os.mkdir(anaconda.rootPath + '/var/log/anaconda') + if not os.path.isdir (ROOT_PATH + '/var/log/anaconda'): + os.mkdir(ROOT_PATH + '/var/log/anaconda') for (fn, dest) in (("/tmp/anaconda.log", "anaconda.log"), ("/tmp/syslog", "anaconda.syslog"), @@ -80,8 +80,8 @@ def copyAnacondaLogs(anaconda): ("/tmp/yum.log", "anaconda.yum.log")): if os.access(fn, os.R_OK): try: - shutil.copyfile(fn, "%s/var/log/anaconda/%s" %(anaconda.rootPath, dest)) - os.chmod("%s/var/log/anaconda/%s" %(anaconda.rootPath, dest), 0600) + shutil.copyfile(fn, "%s/var/log/anaconda/%s" %(ROOT_PATH, dest)) + os.chmod("%s/var/log/anaconda/%s" %(ROOT_PATH, dest), 0600) except: pass @@ -155,12 +155,12 @@ def turnOnFilesystems(anaconda): else: if upgrade_migrate: # we should write out a new fstab with the migrated fstype - shutil.copyfile("%s/etc/fstab" % anaconda.rootPath, - "%s/etc/fstab.anaconda" % anaconda.rootPath) - anaconda.storage.fsset.write(anaconda.rootPath) + shutil.copyfile("%s/etc/fstab" % ROOT_PATH, + "%s/etc/fstab.anaconda" % ROOT_PATH) + anaconda.storage.fsset.write(ROOT_PATH) # and make sure /dev is mounted so we can read the bootloader - bindMountDevDirectory(anaconda.rootPath) + bindMountDevDirectory(ROOT_PATH) def setupTimezone(anaconda): @@ -209,10 +209,10 @@ def setFileCons(anaconda): # If the path begins with rootPath, matchPathCon will never match # anything because policy doesn't contain that path. - if path.startswith(anaconda.rootPath): - path = path.replace(anaconda.rootPath, "") + if path.startswith(ROOT_PATH): + path = path.replace(ROOT_PATH, "") - ret = isys.resetFileContext(path, anaconda.rootPath) + ret = isys.resetFileContext(path, ROOT_PATH) if flags.selinux: log.info("setting SELinux contexts for anaconda created files") @@ -220,13 +220,13 @@ def setFileCons(anaconda): # Add "/mnt/sysimage" to the front of every path so the glob works. # Then run glob on each element of the list and flatten it into a # single list we can run contextCB across. - files = itertools.chain(*map(lambda f: glob.glob("%s%s" % (anaconda.rootPath, f)), + files = itertools.chain(*map(lambda f: glob.glob("%s%s" % (ROOT_PATH, f)), relabelFiles)) contextCB(None, "", files) for dir in relabelDirs + ["/dev/%s" % vg.name for vg in anaconda.storage.vgs]: # Add "/mnt/sysimage" for similar reasons to above. - dir = "%s%s" % (anaconda.rootPath, dir) + dir = "%s%s" % (ROOT_PATH, dir) os.path.walk(dir, contextCB, None) @@ -282,8 +282,8 @@ def rpmKernelVersionList(rootPath = "/"): def rpmSetupGraphicalSystem(anaconda): import rpm - iutil.resetRpmDb(anaconda.rootPath) - ts = rpm.TransactionSet(anaconda.rootPath) + iutil.resetRpmDb(ROOT_PATH) + ts = rpm.TransactionSet(ROOT_PATH) # Only add "rhgb quiet" on non-s390, non-serial installs if iutil.isConsoleOnVirtualTerminal() and \ diff --git a/pyanaconda/rescue.py b/pyanaconda/rescue.py index af564e4..963b81c 100644 --- a/pyanaconda/rescue.py +++ b/pyanaconda/rescue.py @@ -301,7 +301,7 @@ def doRescue(anaconda): "\n\n" "If for some reason this process fails you can choose 'Skip' " "and this step will be skipped and you will go directly to a " - "command shell.\n\n") % (anaconda.rootPath,), + "command shell.\n\n") % (ROOT_PATH,), [_("Continue"), _("Read-Only"), _("Skip"), _("Advanced")] ) if rc == _("Skip").lower(): @@ -380,14 +380,14 @@ def doRescue(anaconda): rootmounted = 0 else: if anaconda.ksdata: - log.info("System has been mounted under: %s" % anaconda.rootPath) + log.info("System has been mounted under: %s" % ROOT_PATH) else: ButtonChoiceWindow(anaconda.intf.screen, _("Rescue"), _("Your system has been mounted under %(rootPath)s.\n\n" "Press <return> to get a shell. If you would like to " "make your system the root environment, run the command:\n\n" "\tchroot %(rootPath)s\n\n%(msg)s") % - {'rootPath': anaconda.rootPath, + {'rootPath': ROOT_PATH, 'msg': msg}, [_("OK")] ) rootmounted = 1 @@ -404,7 +404,7 @@ def doRescue(anaconda): # we have to catch the possible exception # because we support read-only mounting try: - fd = open("%s/.autorelabel" % anaconda.rootPath, "w+") + fd = open("%s/.autorelabel" % ROOT_PATH, "w+") fd.close() except IOError: log.warning("cannot touch /.autorelabel") @@ -456,7 +456,7 @@ def doRescue(anaconda): ButtonChoiceWindow(anaconda.intf.screen, _("Rescue"), _("An error occurred trying to mount some or all of your " "system. Some of it may be mounted under %s.\n\n" - "Press <return> to get a shell.") % anaconda.rootPath + msg, + "Press <return> to get a shell.") % ROOT_PATH + msg, [_("OK")] ) else: if anaconda.ksdata and \ @@ -479,12 +479,12 @@ def doRescue(anaconda): msgStr = "" if rootmounted and not readOnly: - anaconda.storage.makeMtab(root=anaconda.rootPath) + anaconda.storage.makeMtab(root=ROOT_PATH) try: - makeResolvConf(anaconda.rootPath) + makeResolvConf(ROOT_PATH) except (OSError, IOError) as e: log.error("error making a resolv.conf: %s" %(e,)) - msgStr = _("Your system is mounted under the %s directory.") % (anaconda.rootPath,) + msgStr = _("Your system is mounted under the %s directory.") % (ROOT_PATH,) ButtonChoiceWindow(anaconda.intf.screen, _("Rescue"), msgStr, [_("OK")] ) # we do not need ncurses anymore, shut them down diff --git a/pyanaconda/sshd.py b/pyanaconda/sshd.py index 05ba178..b6c9372 100644 --- a/pyanaconda/sshd.py +++ b/pyanaconda/sshd.py @@ -26,6 +26,7 @@ log = logging.getLogger("anaconda") import iutil import users from flags import flags +from constants import ROOT_PATH def createSshKey(algorithm, keyfile): path = '/etc/ssh/%s' % (keyfile,) @@ -50,7 +51,7 @@ def doSshd(anaconda): else: log.info("sshd: not enabled, skipping.") - users.createLuserConf(anaconda.rootPath) + users.createLuserConf(ROOT_PATH) def handleSshPw(anaconda): if not anaconda.ksdata: diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py index 26a3d86..1f08f70 100644 --- a/pyanaconda/storage/__init__.py +++ b/pyanaconda/storage/__init__.py @@ -247,7 +247,7 @@ def writeEscrowPackets(anaconda): for device in escrowDevices: log.debug("escrow: device %s: %s" % (repr(device.path), repr(device.format.type))) - device.format.escrow(anaconda.rootPath + "/root", + device.format.escrow(ROOT_PATH + "/root", backupPassphrase) wait_win.pop() @@ -1485,8 +1485,8 @@ def findExistingRootDevices(anaconda, upgradeany=False): rootDevs = [] notUpgradable = [] - if not os.path.exists(anaconda.rootPath): - iutil.mkdirChain(anaconda.rootPath) + if not os.path.exists(ROOT_PATH): + iutil.mkdirChain(ROOT_PATH) roots = [] for device in anaconda.storage.devicetree.leaves: @@ -1504,7 +1504,7 @@ def findExistingRootDevices(anaconda, upgradeany=False): continue try: - device.format.mount(options="ro", mountpoint=anaconda.rootPath) + device.format.mount(options="ro", mountpoint=ROOT_PATH) except Exception as e: log.warning("mount of %s as %s failed: %s" % (device.name, device.format.type, @@ -1512,9 +1512,9 @@ def findExistingRootDevices(anaconda, upgradeany=False): device.teardown() continue - if os.access(anaconda.rootPath + "/etc/fstab", os.R_OK): + if os.access(ROOT_PATH + "/etc/fstab", os.R_OK): try: - (arch, product, version) = getReleaseString(anaconda.rootPath) + (arch, product, version) = getReleaseString(ROOT_PATH) except ValueError: # This likely isn't our product, so don't even count it as # notUpgradable. @@ -1538,7 +1538,7 @@ def mountExistingSystem(anaconda, rootEnt, readOnly=None): """ Mount filesystems specified in rootDevice's /etc/fstab file. """ rootDevice = rootEnt[0] - rootPath = anaconda.rootPath + rootPath = ROOT_PATH fsset = anaconda.storage.fsset if readOnly: readOnly = "ro" @@ -1595,7 +1595,7 @@ def mountExistingSystem(anaconda, rootEnt, if rc == 0: return -1 - fsset.mountFilesystems(intf=anaconda.intf, rootPath=anaconda.rootPath, + fsset.mountFilesystems(intf=anaconda.intf, rootPath=ROOT_PATH, readOnly=readOnly, skipRoot=True) diff --git a/pyanaconda/textw/keyboard_text.py b/pyanaconda/textw/keyboard_text.py index 6200504..c30e184 100644 --- a/pyanaconda/textw/keyboard_text.py +++ b/pyanaconda/textw/keyboard_text.py @@ -39,7 +39,7 @@ class KeyboardWindow: if anaconda.keyboard.beenset: default = anaconda.keyboard.get () else: - default = anaconda.instLanguage.getDefaultKeyboard(anaconda.rootPath) + default = anaconda.instLanguage.getDefaultKeyboard(ROOT_PATH) if default not in keyboards: default = 'us' diff --git a/pyanaconda/textw/language_text.py b/pyanaconda/textw/language_text.py index 1a36535..2573720 100644 --- a/pyanaconda/textw/language_text.py +++ b/pyanaconda/textw/language_text.py @@ -58,13 +58,13 @@ class LanguageWindow: buttons=[TEXT_OK_BUTTON]) anaconda.instLanguage.instLang = choice anaconda.instLanguage.systemLang = choice - anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(ROOT_PATH)) return INSTALL_OK anaconda.instLanguage.instLang = choice anaconda.instLanguage.systemLang = choice anaconda.instLanguage.buildLocale() - anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath)) + anaconda.timezone.setTimezoneInfo(anaconda.instLanguage.getDefaultTimeZone(ROOT_PATH)) anaconda.intf.drawFrame() diff --git a/pyanaconda/textw/timezone_text.py b/pyanaconda/textw/timezone_text.py index efffc73..2c54906 100644 --- a/pyanaconda/textw/timezone_text.py +++ b/pyanaconda/textw/timezone_text.py @@ -45,7 +45,7 @@ class TimezoneWindow: timezones = self.getTimezoneList() (default, asUtc) = anaconda.timezone.getTimezoneInfo() if not default: - default = anaconda.instLanguage.getDefaultTimeZone(anaconda.rootPath) + default = anaconda.instLanguage.getDefaultTimeZone(ROOT_PATH) bb = ButtonBar(screen, [TEXT_OK_BUTTON, TEXT_BACK_BUTTON]) t = TextboxReflowed(30, diff --git a/pyanaconda/upgrade.py b/pyanaconda/upgrade.py index b3ce420..46868ee 100644 --- a/pyanaconda/upgrade.py +++ b/pyanaconda/upgrade.py @@ -152,8 +152,8 @@ def restoreTime(anaconda): return if os.environ.has_key("TZ"): del os.environ["TZ"] - copyFromSysimage(anaconda.rootPath, '/etc/localtime') - copyFromSysimage(anaconda.rootPath, '/etc/adjtime') + copyFromSysimage(ROOT_PATH, '/etc/localtime') + copyFromSysimage(ROOT_PATH, '/etc/adjtime') if iutil.isS390(): return args = [ "--hctosys" ] @@ -205,8 +205,8 @@ def upgradeMountFilesystems(anaconda): '/bin/sh', '/usr/tmp') badLinks = [] for n in checkLinks: - if not os.path.islink(anaconda.rootPath + n): continue - l = os.readlink(anaconda.rootPath + n) + if not os.path.islink(ROOT_PATH + n): continue + l = os.readlink(ROOT_PATH + n) if l[0] == '/': badLinks.append(n) @@ -224,7 +224,7 @@ def upgradeMountFilesystems(anaconda): badLinks = [] mustBeLinks = ( '/usr/tmp', ) for n in mustBeLinks: - if not os.path.islink(anaconda.rootPath + n): + if not os.path.islink(ROOT_PATH + n): badLinks.append(n) if badLinks: @@ -241,15 +241,15 @@ def upgradeMountFilesystems(anaconda): anaconda.storage.mkDevRoot() # Move /etc/rpm/platform out of the way. - if os.path.exists(anaconda.rootPath + "/etc/rpm/platform"): - shutil.move(anaconda.rootPath + "/etc/rpm/platform", - anaconda.rootPath + "/etc/rpm/platform.rpmsave") + if os.path.exists(ROOT_PATH + "/etc/rpm/platform"): + shutil.move(ROOT_PATH + "/etc/rpm/platform", + ROOT_PATH + "/etc/rpm/platform.rpmsave") # if they've been booting with selinux disabled, then we should # disable it during the install as well (#242510) try: - if os.path.exists(anaconda.rootPath + "/.autorelabel"): - ctx = selinux.getfilecon(anaconda.rootPath + "/.autorelabel")[1] + if os.path.exists(ROOT_PATH + "/.autorelabel"): + ctx = selinux.getfilecon(ROOT_PATH + "/.autorelabel")[1] if not ctx or ctx == "unlabeled": flags.selinux = False log.info("Disabled SELinux for upgrade based on /.autorelabel") diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py index cfd8e0f..482473d 100644 --- a/pyanaconda/yuminstall.py +++ b/pyanaconda/yuminstall.py @@ -102,7 +102,7 @@ class AnacondaCallback: self.messageWindow = anaconda.intf.messageWindow self.progress = anaconda.intf.instProgress self.progressWindowClass = anaconda.intf.progressWindow - self.rootPath = anaconda.rootPath + self.rootPath = ROOT_PATH self.initWindow = None @@ -359,7 +359,7 @@ class AnacondaYum(yum.YumBase): self.anaconda.methodstr = self.anaconda.intf.methodstrRepoWindow(self.anaconda.methodstr or "cdrom:", exception) - self.doConfigSetup(root=self.anaconda.rootPath) + self.doConfigSetup(root=ROOT_PATH) if not self.anaconda.bootloader.update_only: self.conf.installonlypkgs = [] @@ -1204,7 +1204,7 @@ pluginpath=/usr/lib/yum-plugins,/tmp/updates/yum-plugins pluginconfpath=/etc/yum/pluginconf.d,/tmp/updates/pluginconf.d plugins=1 reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anaconda.repos.d -""" % (anaconda.rootPath) +""" % (ROOT_PATH) if anaconda.proxy: buf += "proxy=%s\n" % anaconda.proxy @@ -1225,10 +1225,10 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon # clean up rpmdb locks so that kickstart %post scripts aren't # unhappy (#496961) - iutil.resetRpmDb(anaconda.rootPath) + iutil.resetRpmDb(ROOT_PATH) - if os.access(anaconda.rootPath + "/tmp/yum.log", os.R_OK): - os.unlink(anaconda.rootPath + "/tmp/yum.log") + if os.access(ROOT_PATH + "/tmp/yum.log", os.R_OK): + os.unlink(ROOT_PATH + "/tmp/yum.log") def doBackendSetup(self, anaconda): if anaconda.dir == DISPATCH_BACK: @@ -1236,7 +1236,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon if anaconda.upgrade: # FIXME: make sure that the rpmdb doesn't have stale locks :/ - iutil.resetRpmDb(anaconda.rootPath) + iutil.resetRpmDb(ROOT_PATH) self.ayum = AnacondaYum(anaconda) self.ayum.setup() @@ -1593,27 +1593,27 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon for i in dirList: try: - os.mkdir(anaconda.rootPath + i) + os.mkdir(ROOT_PATH + i) except OSError: pass # log.error("Error making directory %s: %s" % (i, msg)) - self.initLog(anaconda.rootPath) + self.initLog(ROOT_PATH) # write out the fstab if not anaconda.upgrade: - anaconda.storage.fsset.write(anaconda.rootPath) + anaconda.storage.fsset.write(ROOT_PATH) if os.access("/etc/modprobe.d/anaconda.conf", os.R_OK): shutil.copyfile("/etc/modprobe.d/anaconda.conf", - anaconda.rootPath + "/etc/modprobe.d/anaconda.conf") + ROOT_PATH + "/etc/modprobe.d/anaconda.conf") anaconda.network.write() - anaconda.network.copyConfigToPath(instPath=anaconda.rootPath) - anaconda.storage.write(anaconda.rootPath) + anaconda.network.copyConfigToPath(instPath=ROOT_PATH) + anaconda.storage.write(ROOT_PATH) if not anaconda.isHeadless: - anaconda.keyboard.write(anaconda.rootPath) + anaconda.keyboard.write(ROOT_PATH) else: # ensure that /etc/mtab is a symlink to /proc/self/mounts - anaconda.storage.makeMtab(root=anaconda.rootPath) + anaconda.storage.makeMtab(root=ROOT_PATH) def doInstall(self, anaconda): log.info("Preparing to install packages") @@ -1656,19 +1656,19 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon repo.dirCleanup() # expire yum caches on upgrade - if anaconda.upgrade and os.path.exists("%s/var/cache/yum" %(anaconda.rootPath,)): + if anaconda.upgrade and os.path.exists("%s/var/cache/yum" %(ROOT_PATH,)): log.info("Expiring yum caches") try: iutil.execWithRedirect("yum", ["clean", "all"], stdout="/dev/tty5", stderr="/dev/tty5", - root = anaconda.rootPath) + root = ROOT_PATH) except RuntimeError: pass # nuke preupgrade - if flags.cmdline.has_key("preupgrade") and os.path.exists("%s/var/cache/yum/anaconda-upgrade" %(anaconda.rootPath,)): + if flags.cmdline.has_key("preupgrade") and os.path.exists("%s/var/cache/yum/anaconda-upgrade" %(ROOT_PATH,)): try: - shutil.rmtree("%s/var/cache/yum/anaconda-upgrade" %(anaconda.rootPath,)) + shutil.rmtree("%s/var/cache/yum/anaconda-upgrade" %(ROOT_PATH,)) except (OSError, IOError): pass @@ -1882,7 +1882,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon def postAction(self, anaconda): self.ayum.close() self.ayum.closeRpmDB() - iutil.resetRpmDb(anaconda.rootPath) + iutil.resetRpmDb(ROOT_PATH) class DownloadHeaderProgress: def __init__(self, intf, ayum=None): -- 1.7.6 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list