[PATCH] Prompt for media check on DVD installs (#676551).

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

 



---
 loader/cdinstall.c |   27 +++++++++++++--------------
 loader/cdinstall.h |    1 +
 loader/loader.c    |    1 +
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/loader/cdinstall.c b/loader/cdinstall.c
index 161def7..e1e5fe7 100644
--- a/loader/cdinstall.c
+++ b/loader/cdinstall.c
@@ -191,13 +191,18 @@ static void wrongCDMessage(void) {
 }
 
 /* ask about doing media check */
-static void queryCDMediaCheck(char *dev) {
+void queryCDMediaCheck(char *instRepo) {
     int rc;
+    char *tmp, *device;
 
     /* dont bother to test in automated installs */
     if (FL_KICKSTART(flags) && !FL_MEDIACHECK(flags))
         return;
 
+    /* Skip over the leading "cdrom://". */
+    tmp = instRepo+8;
+    checked_asprintf(&device, "%.*s", (int) (strchr(tmp, ':')-tmp), tmp);
+
     /* see if we should check image(s) */
     /* in rescue mode only test if they explicitly asked to */
     if (!FL_RESCUE(flags) || FL_MEDIACHECK(flags)) {
@@ -213,18 +218,18 @@ static void queryCDMediaCheck(char *dev) {
              * remount to pretend nothing ever happened.
              */
             umount("/mnt/source");
-            mediaCheckCdrom(dev);
+            mediaCheckCdrom(device);
 
             do {
-                if (doPwMount(dev, "/mnt/source", "iso9660", "ro", NULL)) {
-                    ejectCdrom(dev);
+                if (doPwMount(device, "/mnt/source", "iso9660", "ro", NULL)) {
+                    ejectCdrom(device);
                     wrongCDMessage();
                     continue;
                 }
 
                 if (access("/mnt/source/.discinfo", R_OK)) {
                     umount("/mnt/source");
-                    ejectCdrom(dev);
+                    ejectCdrom(device);
                     wrongCDMessage();
                     continue;
                 }
@@ -233,6 +238,8 @@ static void queryCDMediaCheck(char *dev) {
             } while (1);
         }
     }
+
+    free(device);
 }
 
 int findInstallCD(struct loaderData_s *loaderData) {
@@ -314,20 +321,12 @@ int findInstallCD(struct loaderData_s *loaderData) {
 
 int promptForCdrom(struct loaderData_s *loaderData) {
     int rc;
-    char *cddev = NULL, *colon, *start;
 
     do {
         rc = findInstallCD(loaderData);
 
         if (loaderData->instRepo && rc == LOADER_OK) {
-            /* Skip over the leading cdrom:// */
-            start = loaderData->instRepo+8;
-            colon = strchr(start, ':');
-
-            /* Then grab just the device portion out of the instRepo string. */
-            cddev = strndup(start, colon-start);
-            queryCDMediaCheck(cddev);
-            free(cddev);
+            queryCDMediaCheck(loaderData->instRepo);
             return rc;
         } else {
             char * buf;
diff --git a/loader/cdinstall.h b/loader/cdinstall.h
index 6666b03..f883e7a 100644
--- a/loader/cdinstall.h
+++ b/loader/cdinstall.h
@@ -25,6 +25,7 @@
 int findInstallCD(struct loaderData_s *loaderData);
 int promptForCdrom(struct loaderData_s *loaderData);
 int loadCdromImages(struct loaderData_s *loaderData);
+void queryCDMediaCheck(char *instRepo);
 
 int kickstartFromCD(char *kssrc);
 #endif
diff --git a/loader/loader.c b/loader/loader.c
index 644c1e8..dcdedc9 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -1284,6 +1284,7 @@ static void doLoaderMain(struct loaderData_s *loaderData,
      */
     if (!FL_ASKMETHOD(flags) && !loaderData->instRepo && findInstallCD(loaderData) == LOADER_OK) {
         logMessage(DEBUGLVL, "Found installation media, so skipping lang and kbd");
+        queryCDMediaCheck(loaderData->instRepo);
         skipLangKbd = 1;
         flags |= LOADER_FLAGS_NOPASS;
     }
-- 
1.7.1.1

_______________________________________________
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