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
"
"# new kernels the default
")
# 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.rootPa th)
+ 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.ro otPath)
+ 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
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)
# 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)
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.
"
"Press <return> to get a shell. If you would like to "
"make your system the root environment, run the command:
"
" chroot %(rootPath)s
%(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.
"
- "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
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.anacon da.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 = []