[PATCH] Support stage2= for CD installs in loader.

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

 



---
 anaconda            |    2 +-
 loader2/cdinstall.c |   27 +++++++++++++++++++++------
 yuminstall.py       |    9 +++++++--
 3 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/anaconda b/anaconda
index 0f2a144..dd5c0c1 100755
--- a/anaconda
+++ b/anaconda
@@ -577,7 +577,7 @@ class Anaconda:
                 tree = "/%s" %(tree,)
 
             self.mediaDevice = device
-            self.methodstr = "file://" + tree
+            self.methodstr = "cdrom://%s" % tree
         else:
             self.methodstr = m
 
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index 27f65cf..8453278 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -239,16 +239,22 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
     struct device ** devices;
     char *cddev = NULL;
 
-    r = asprintf(&stage2loc, "%s/images/stage2.img", location);
-    r = asprintf(&imageDir, "%s/images", location);
-    r = asprintf(&discinfoloc, "%s/.discinfo", location);
-
     devices = getDevices(DEVICE_CDROM);
     if (!devices) {
         logMessage(ERROR, "got to setupCdrom without a CD device");
         return NULL;
     }
 
+    if (loaderData && FL_STAGE2(flags)) {
+        stage2loc = strdup(location);
+        r = asprintf(&imageDir, "%.*s", (int) (strrchr(location, '/') - directory), directory);
+        r = asprintf(&discinfoloc, "%s/.discinfo", imageDir);
+    } else {
+        r = asprintf(&stage2loc, "%s/images/stage2.img", location);
+        r = asprintf(&imageDir, "%s/images", location);
+        r = asprintf(&discinfoloc, "%s/.discinfo", location);
+    }
+
     /* JKFIXME: ASSERT -- we have a cdrom device when we get here */
     do {
         for (i = 0; devices[i]; i++) {
@@ -308,6 +314,11 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
 
                     r = asprintf(&buf, "cdrom://%s:%s",
                                  devices[i]->device, location);
+
+                    free(stage2loc);
+                    free(imageDir);
+                    free(discinfoloc);
+
                     if (r == -1)
                         return NULL;
                     else
@@ -340,13 +351,17 @@ char * setupCdrom(char * location, struct loaderData_s * loaderData,
                                _("OK"), _("Back"), buf, _("OK"));
             free(buf);
             if (rc == 2)
-                return NULL;
+                goto err;
         } else {
             /* we can't ask them about it, so just return not found */
-            return NULL;
+            goto err;
         }
     } while (1);
 
+err:
+    free(stage2loc);
+    free(imageDir);
+    free(discinfoloc);
     return NULL;
 }
 
diff --git a/yuminstall.py b/yuminstall.py
index 8d6886d..39c50b1 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -285,9 +285,14 @@ class AnacondaYum(YumSorter):
         else:
             self.isodir = None
 
-        # The loader mounts the first disc for us, so don't remount it.
+        # The loader may have mounted the first disc for us, but there's
+        # no guarantee what with the stage2= stuff.
         if self.anaconda.mediaDevice or self.isodir:
-            self.currentMedia = 1
+            if os.path.ismount(self.tree):
+                self.currentMedia = 1
+            else:
+                self.currentMedia = None
+
             self.mediagrabber = self.mediaHandler
         else:
             self.currentMedia = None
-- 
1.5.3.7

_______________________________________________
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