summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lumens <clumens@redhat.com>2008-03-24 17:20:38 -0400
committerChris Lumens <clumens@redhat.com>2008-03-24 17:20:38 -0400
commitb167a920ec87a1afc98589fb960142f8618faa74 (patch)
treedc822b8d501d5f87d3a893bc624d391fa047c32f
parent0d8ef4c2b6a61fec6974ef4c1095d75f13d7ea67 (diff)
downloadanaconda-b167a920ec87a1afc98589fb960142f8618faa74.tar.gz
anaconda-b167a920ec87a1afc98589fb960142f8618faa74.tar.xz
anaconda-b167a920ec87a1afc98589fb960142f8618faa74.zip
Move /tmp/stage2.img to /mnt/sysimage to free up some memory (#438377).
-rw-r--r--backend.py4
-rw-r--r--yuminstall.py77
2 files changed, 47 insertions, 34 deletions
diff --git a/backend.py b/backend.py
index 80c79f0f4..4c047a20e 100644
--- a/backend.py
+++ b/backend.py
@@ -189,9 +189,9 @@ class AnacondaBackend:
pass
def doRepoSetup(anaconda):
- anaconda.backend.doInitialSetup(anaconda)
- if anaconda.backend.doRepoSetup(anaconda) == DISPATCH_BACK:
+ if anaconda.backend.doInitialSetup(anaconda) == DISPATCH_BACK:
return DISPATCH_BACK
+ anaconda.backend.doRepoSetup(anaconda)
if anaconda.id.upgrade:
anaconda.backend.checkSupportedUpgrade(anaconda)
iutil.writeRpmPlatform(anaconda.rootPath)
diff --git a/yuminstall.py b/yuminstall.py
index 091a6cd94..2a64ef4ea 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -320,47 +320,58 @@ class AnacondaYum(YumSorter):
self.localPackages = []
def systemMounted(self, fsset, chroot):
- if os.path.exists("/tmp/stage2.img"):
- log.debug("Not copying stage2.img as we already have it")
- return
+ stage2img = None
- if not os.path.exists("%s/images/stage2.img" %(self.tree,)):
+ if os.path.exists("/tmp/stage2.img"):
+ log.info("Using /tmp/stage2.img as stage2 image")
+ stage2img = "/tmp/stage2.img"
+ elif os.path.exists("%s/images/stage2.img" % self.tree):
+ log.info("Using %s/images/stage2.img as stage2 image" % self.tree)
+ stage2img = "%s/images/stage2.img" % self.tree
+ else:
log.debug("Not copying stage2.img as we can't find it")
return
- if self.isodir or self.anaconda.mediaDevice:
- self._loopbackFile = "%s%s/rhinstall-stage2.img" % (chroot,
- fsset.filesystemSpace(chroot)[0][0])
+ self._loopbackFile = "%s%s/rhinstall-stage2.img" % (chroot,
+ fsset.filesystemSpace(chroot)[0][0])
- try:
- win = self.anaconda.intf.waitWindow (_("Copying File"),
- _("Transferring install image to hard drive..."))
- shutil.copyfile("%s/images/stage2.img" % (self.tree,),
- self._loopbackFile)
+ try:
+ win = self.anaconda.intf.waitWindow(_("Copying File"),
+ _("Transferring install image to hard drive..."))
+ shutil.copyfile(stage2img, self._loopbackFile)
+ win.pop()
+ except Exception, e:
+ if win:
win.pop()
- except Exception, e:
- if win:
- win.pop()
- log.critical("error transferring stage2.img: %s" %(e,))
+ log.critical("error transferring stage2.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.")
+ 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)
+ self.anaconda.intf.messageWindow(_("Error"), msg)
+ try:
os.unlink(self._loopbackFile)
- return 1
- else:
- self._loopbackFile = "%s/images/stage2.img" % self.tree
+ except:
+ pass
+
+ return 1
isys.lochangefd("/dev/loop0", self._loopbackFile)
+ # Try to remove the stage2 image from /tmp to decrease memory usage.
+ if stage2img == "/tmp/stage2.img":
+ try:
+ os.unlink(stage2img)
+ except:
+ pass
+
def _switchCD(self, discnum):
if os.access("%s/.discinfo" % self.tree, os.R_OK):
f = open("%s/.discinfo" % self.tree)
@@ -849,6 +860,12 @@ class YumBackend(AnacondaBackend):
iutil.writeRpmPlatform()
self.ayum = AnacondaYum(anaconda)
+ if self.ayum.systemMounted (anaconda.id.fsset, anaconda.rootPath):
+ anaconda.id.fsset.umountFilesystems(anaconda.rootPath)
+ return DISPATCH_BACK
+ else:
+ return DISPATCH_FORWARD
+
def doGroupSetup(self):
# FIXME: this is a pretty ugly hack to make it so that we don't lose
# groups being selected (#237708)
@@ -1299,10 +1316,6 @@ class YumBackend(AnacondaBackend):
os.rename(anaconda.rootPath + "/etc/modprobe.conf",
anaconda.rootPath + "/etc/modprobe.conf.anacbak")
- if self.ayum.systemMounted (anaconda.id.fsset, anaconda.rootPath):
- anaconda.id.fsset.umountFilesystems(anaconda.rootPath)
- return DISPATCH_BACK
-
dirList = ['/var', '/var/lib', '/var/lib/rpm', '/tmp', '/dev', '/etc',
'/etc/sysconfig', '/etc/sysconfig/network-scripts',
'/etc/X11', '/root', '/var/tmp', '/etc/rpm', '/var/cache',