Re: [PATCH] No longer force ISOs to be on ext2, ext3, or vfat partitions.

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

 



On Fri, 2009-04-17 at 23:56 -0500, Jerry Vonau wrote:
> On Fri, 2009-04-17 at 15:02 -0400, Chris Lumens wrote: 
> > This also changes it so the test for testing mode doesn't mean the rest of
> > the function gets indented.
> > ---
> >  loader/hdinstall.c |  111 ++++++++++++++++++++++++----------------------------
> >  1 files changed, 51 insertions(+), 60 deletions(-)
> > 
> > diff --git a/loader/hdinstall.c b/loader/hdinstall.c
> > index e27b04a..46f604e 100644
> > --- a/loader/hdinstall.c
> > +++ b/loader/hdinstall.c
> > @@ -58,85 +58,76 @@ extern uint64_t flags;
> >  static char * setupIsoImages(char * device, char * dirName, char * location) {
> >      int rc = 0;
> >      char *url = NULL, *dirspec, *updpath, *path;
> > -    char *typetry[] = {"ext3", "ext2", "vfat", NULL};
> > -    char **type;
> >  
> >      logMessage(INFO, "mounting device %s for hard drive install", device);
> >  
> > -    if (!FL_TESTING(flags)) {
> > -        for (type=typetry; *type; type++) {
> > -            if (!doPwMount(device, "/mnt/isodir", *type, "ro", NULL))
> > -                break;
> > -        }
> > +    if (FL_TESTING(flags))
> > +        return NULL;
> >  
> > -        if (!type)
> > -            return NULL;
> > +    if (doPwMount(device, "/mnt/isodir", "auto", "ro", NULL))
> > +        return NULL;
> >  
> > -        if (asprintf(&dirspec, "/mnt/isodir%.*s",
> > -                     (int) (strrchr(dirName, '/') - dirName), dirName) == -1) {
> > -            logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
> > -            abort();
> > -        }
> > +    if (asprintf(&dirspec, "/mnt/isodir%.*s",
> > +                 (int) (strrchr(dirName, '/') - dirName), dirName) == -1) {
> > +        logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
> > +        abort();
> > +    }
> >  
> > -        if (asprintf(&path, "/mnt/isodir%s", dirName) == -1) {
> > -            logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
> > -            abort();
> > -        }
> > +    if (asprintf(&path, "/mnt/isodir%s", dirName) == -1) {
> > +        logMessage(CRITICAL, "%s: %d: %m", __func__, __LINE__);
> > +        abort();
> > +    }
> >  
> > -        if (path) {
> > -            logMessage(INFO, "Path to stage2 image is %s", path);
> > +    if (path) {
> > +        logMessage(INFO, "Path to stage2 image is %s", path);
> >  
> > -            rc = copyFile(path, "/tmp/install.img");
> > -            rc = mountStage2("/tmp/install.img");
> > +        rc = copyFile(path, "/tmp/install.img");
> > +        rc = mountStage2("/tmp/install.img");
> >  
> 
> When booting from usb and passing stage2= this memory never gets freed
> later in the install. The install.img doesn't get copied to sysimage and
> install.img remains in memory. Now that stage2= is an absolute path to
> the image, maybe we could just leave /mnt/isodir mounted, and mount
> stage2.img straight away, kind of like the boot.iso does? 
> 
Or if you don't want to play around with loader this patch works for me

Jerry


diff -up ./anaconda.orig ./anaconda
--- ./anaconda.orig	2009-04-18 10:33:49.000000000 -0500
+++ ./anaconda	2009-04-18 16:32:36.000000000 -0500
@@ -487,6 +487,25 @@ class Anaconda:
         self.backend = apply(b, (self,))
 
     def setMethodstr(self, methodstr):
+        log.info("anaconda called with methodstr %s" % methodstr)
+        if methodstr.startswith("hd:"):
+            method = methodstr[3:]
+            if method.count(":") == 1:
+                (device, tree) = method.split(":")
+            else:
+                (device, fstype, tree) = method.split(":")
+
+            if device.startswith("/dev/"):
+                device = device[5:]
+
+            if not tree.startswith("/"):
+                tree = "/%s" %(tree,)
+
+            self.mediaDevice = device
+            self.methodstr = methodstr
+            log.info("anaconda changed methodstr %s" %methodstr)
+            log.info("anaconda changed mediaDevice %s" %self.mediaDevice)
+
         if methodstr.startswith("cdrom://"):
             (device, tree) = string.split(methodstr[8:], ":", 1)
 
diff -up ./backend.py.orig ./backend.py
--- ./backend.py.orig	2009-04-18 10:33:49.000000000 -0500
+++ ./backend.py	2009-04-18 16:27:45.000000000 -0500
@@ -157,6 +157,7 @@ class AnacondaBackend:
         # 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):
+            log.info("anaconda not finding install.img")
             return
 
         free = anaconda.id.storage.fsset.fsFreeSpace(anaconda.rootPath)
@@ -166,6 +167,9 @@ class AnacondaBackend:
         try:
             win = anaconda.intf.waitWindow(_("Copying File"),
                     _("Transferring install image to hard drive..."))
+            
+            log.info("anaconda install.img is %s" %installimg)
+            log.info("anaconda loopbackFile is %s" %self._loopbackFile)
             shutil.copyfile(installimg, self._loopbackFile)
             win.pop()
         except Exception, e:
@@ -192,7 +196,15 @@ class AnacondaBackend:
             return 1
 
         isys.lochangefd("/dev/loop0", self._loopbackFile)
-        isys.umount("/mnt/stage2")
+
+        try:
+            os.unlink(installimg)
+        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-04-18 10:33:49.000000000 -0500
+++ ./yuminstall.py	2009-04-18 14:25:56.000000000 -0500
@@ -762,7 +762,11 @@ class AnacondaYum(YumSorter):
         mkeys.sort(mediasort)
 
         if len(mkeys) > 1:
-            stage2img = "%s/images/install.img" % self.tree
+            if os.path.exists("/tmp/install.img"):        
+                stage2img = '/tmp/install.img'
+            else:
+                stage2img = "%s/images/install.img" % self.tree
+
             if self.anaconda.backend.mountInstallImage(self.anaconda, stage2img):
                 self.anaconda.id.storage.fsset.unmountFilesystems(self.anaconda.rootPath)
                 return DISPATCH_BACK
_______________________________________________
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