stage2 harddrive behavour

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all:

Just wondering, since you now have a hybrid boot.iso that is using the
hd:LABEL=Fedora:/images/install.img for stage2, should this image when
used on a usbkey, not be treated the same as if were a cdrom? The cdrom
is mounting stage2 straight away, while in hdinstall.c there is: 

if (path) {
        logMessage(INFO, "Path to stage2 image is %s", path);

        rc = copyFile(path, "/tmp/install.img");
        rc = mountStage2("/tmp/install.img");

        free(path);

I'd love to see this changed in loader, with just

rc = mountStage2(path)

I can see that you may want to copy the image to ram for rescue, same as
the cdrom does, but should you not free up the ram? Why waste it? 

OR

There used to be a systemMounted fix that was in yuminstall.py, that
copied the image to the harddrive, that one got moved to backend.py.
That is good, but mountInstallImage gets passed /mnt/source, but that is
not the install.img that was booted, and mediaDevice is not set with a
harddrive source.  Well here is a patch to help with that, and calls
mountInstallImage earlier, during doConfigSetup, to free the ram before
the dependencies are resolved. Kind of reverts
306154146587e067c2a5477d23fdfc4026f4e58b but for backend.py

Jerry




diff -up ./backend.py.orig ./backend.py
--- ./backend.py.orig	2009-08-17 19:44:29.000000000 -0500
+++ ./backend.py	2009-08-17 21:13:10.000000000 -0500
@@ -150,23 +150,55 @@ class AnacondaBackend:
         if not flags.setupFilesystems:
             return
 
+        log.info("installimg is %s" % installimg )
+        log.info("Loopback file is %s" % self._loopbackFile )
+
         if self._loopbackFile and os.path.exists(self._loopbackFile):
+            log.info("and exists %s" % 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 anaconda.mediaDevice or not os.path.exists(installimg):
+        # If they booted with a boot.iso, just continue using that install.img.
+        if os.path.exists("/mnt/stage2/images/install.img"):
+            log.info("Don't need to transfer stage2 image")
             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.
+
+        log.info("mediaDevice is %s" % anaconda.mediaDevice )
+        log.info("Using %s as stage2 image" % installimg)
+
+        # This s/b the one that was copied into /tmp .... 
+        # Why was this copied to ram when you have passed stage2= 
+        # lets free the RAM
+
+        if os.path.exists("/mnt/isodir/images/install.img"):
+            log.info("OVERRIDE Using /mnt/isodir/images/install.img as stage2 image")
+            stage2img = "/mnt/isodir/images/install.img"
+            isys.lochangefd("/dev/loop0", stage2img)
+            try:
+                os.unlink("/tmp/install.img")
+            except:
+                pass 
+            return
+        
+        # Well if it is net install...         
+        if os.path.exists("/tmp/install.img"):
+            log.info("OVERRIDE Using /tmp/install.img as stage2 image")
+            stage2img = "/tmp/install.img"
+        else:
+            stage2img = installimg
+ 
         free = anaconda.id.storage.fsset.fsFreeSpace(anaconda.rootPath)
         self._loopbackFile = "%s%s/rhinstall-install.img" % (anaconda.rootPath,
-                                                             free[0][0])
-
+                                                              free[0][0])
+        log.info("New image name %s" % self._loopbackFile )
+ 
         try:
             win = anaconda.intf.waitWindow(_("Copying File"),
-                    _("Transferring install image to hard drive"))
-            shutil.copyfile(installimg, self._loopbackFile)
+                    _("Transferring install image to hard drive..."))
+            shutil.copyfile(stage2img, self._loopbackFile)
             win.pop()
         except Exception, e:
             if win:
@@ -192,7 +224,17 @@ class AnacondaBackend:
             return 1
 
         isys.lochangefd("/dev/loop0", self._loopbackFile)
-        isys.umount("/mnt/stage2")
+
+        if stage2img == "/tmp/install.img":
+            try:
+                os.unlink(stage2img)
+            except:
+                pass 
+        try:
+            isys.umount("/mnt/stage2")
+        except:
+            pass
+
 
     def removeInstallImage(self):
         if self._loopbackFile:
diff -up ./yuminstall.py.orig ./yuminstall.py
--- ./yuminstall.py.orig	2009-08-17 19:44:29.000000000 -0500
+++ ./yuminstall.py	2009-08-17 21:07:45.000000000 -0500
@@ -603,6 +603,9 @@ class AnacondaYum(YumSorter):
 
 
     def doConfigSetup(self, fn='/tmp/anaconda-yum.conf', root='/'):
+        stage2img = "%s/images/install.img" % self.tree
+        self.anaconda.backend.mountInstallImage(self.anaconda, stage2img)
+
         if hasattr(self, "preconf"):
             self.preconf.fn = fn
             self.preconf.root = root
@@ -803,12 +806,6 @@ class AnacondaYum(YumSorter):
         mkeys = self.tsInfo.reqmedia.keys()
         mkeys.sort(mediasort)
 
-        if len(mkeys) > 1:
-            stage2img = "%s/images/install.img" % self.tree
-            if self.anaconda.backend.mountInstallImage(self.anaconda, stage2img):
-                self.anaconda.id.storage.fsset.umountFilesystems(self.anaconda.rootPath)
-                return DISPATCH_BACK
-
         for i in mkeys:
             self.tsInfo.curmedia = i
             if i > 0:
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux