diff options
author | Chris Lumens <clumens@redhat.com> | 2008-08-27 14:31:38 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2008-08-27 14:32:29 -0400 |
commit | fafcceb8103dfcf74f0f50279e88ae7e05e3b01e (patch) | |
tree | 8f990be5b1d730c2f4d6b2f5064d96ae5b03176f /backend.py | |
parent | 2302f8d4823b2cecd8e83b497354324d88e697c6 (diff) | |
download | anaconda-fafcceb8103dfcf74f0f50279e88ae7e05e3b01e.tar.gz anaconda-fafcceb8103dfcf74f0f50279e88ae7e05e3b01e.tar.xz anaconda-fafcceb8103dfcf74f0f50279e88ae7e05e3b01e.zip |
Don't copy the install.img over in single media cases (#216167).
The only reason we copy the install.img over to the hard drive is because we
need to free up the CD/DVD device for switching media. If we don't need to
do that, then there's no reason to do the copy.
Diffstat (limited to 'backend.py')
-rw-r--r-- | backend.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/backend.py b/backend.py index 14848b5c5..e515bba00 100644 --- a/backend.py +++ b/backend.py @@ -54,6 +54,8 @@ class AnacondaBackend: # FIXME: we should handle this a little more elegantly self.skipFormatRoot = False + self._loopbackFile = None + def postAction(self, anaconda): pass @@ -128,6 +130,60 @@ class AnacondaBackend: else: self.modeText = _("Installing %s\n") + def mountInstallImage(self, anaconda, installimg): + if not flags.setupFilesystems: + return + + if self._loopbackFile and os.path.exists(self._loopbackFile): + return + + # If we've booted off the first CD/DVD (so, not the boot.iso) then + # copy the install.img to the filesystem and switch loopback devices + # to there. Otherwise we won't be able to unmount and swap media. + if not self.anaconda.mediaDevice or not os.path.exists(installimg): + return + + self._loopbackFile = "%s%s/rhinstall-install.img" % (self.anaconda.rootPath, + anaconda.id.fsset.filesystemSpace(self.anaconda.rootPath)[0][0]) + + try: + win = self.anaconda.intf.waitWindow(_("Copying File"), + _("Transferring install image to hard drive...")) + shutil.copyfile(installimg, self._loopbackFile) + win.pop() + except Exception, e: + if win: + win.pop() + + log.critical("error transferring install.img: %s" %(e,)) + + if isinstance(e, IOError) and e.errno == 5: + msg = _("An error occurred transferring the install image " + "to your hard drive. This is probably due to " + "bad media.") + else: + msg = _("An error occurred transferring the install image " + "to your hard drive. You are probably out of disk " + "space.") + + self.anaconda.intf.messageWindow(_("Error"), msg) + try: + os.unlink(self._loopbackFile) + except: + pass + + return 1 + + isys.lochangefd("/dev/loop0", self._loopbackFile) + isys.umount("/mnt/stage2") + + def removeInstallImage(self): + if self._loopbackFile: + try: + os.unlink(self._loopbackFile) + except SystemError: + pass + def kernelVersionList(self, rootPath="/"): return [] |