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

Bug#123948: b-f cdrom detection



Hi,

The following (untested) patch may give us the behavior we want, I
think, any seconds?

The only change here is that we are checking the contents of the file.
In general the change that I committed for 3.0.19 is to check the
contents of any cdrom drives at boot.  If there is a debian cdrom in
the drive at boot then we assume it will always be available, that is,
we don't look for it when is_cdrom_image() is called, but rather check
a variable that we set at boot.

Note, the recent submitter with the net-install CD could get around
the problem experienced by booting with the verbose argument.  Needing
the verbose argument isn't entirely intuitive, I just noticed it this
evening reading the code. However, since one of our goals is to limit
prompting the user this is probably a fine way to go.

-David


Index: choose_medium.c
===================================================================
RCS file: /cvs/debian-boot/boot-floppies/utilities/dbootstrap/choose_medium.c,v
retrieving revision 1.132
diff -u -r1.132 choose_medium.c
--- choose_medium.c	2002/02/07 04:00:25	1.132
+++ choose_medium.c	2002/02/16 07:24:07
@@ -818,23 +818,29 @@
     int i_choices = 0;
     int drive;
     int found = 0;
-    struct stat buf;
+    FILE *fp = NULL;
+    char buffer[256];
 
     find_cdroms (&choices, &i_choices);
 
     for (drive = 0 ; drive < i_choices ; drive++) { 
 	unmount_dir(CM_MOUNTPOINT_DIR);
-        if (vexeclog(LOG_INFO, "mount -t iso9660 -o nojoliet -r %s %s",
-            choices[drive].tag, CM_MOUNTPOINT_DIR) == 0) {
-	    if (!stat (CM_MOUNTPOINT_DIR "/.disk/info", &buf)) {
-		umount(CM_MOUNTPOINT_DIR);
-		found = 1;
-		break;
-	    }
+	if (fp)
+	    fclose(fp);
+	if ((vexeclog(LOG_INFO, "mount -t iso9660 -o nojoliet -r %s %s",
+	   		choices[drive].tag, CM_MOUNTPOINT_DIR) == 0)
+		&& (fp = fopen (CM_MOUNTPOINT_DIR "/.disk/info", "r"))
+		&& fgets (buffer, sizeof buffer, fp)
+		&& strstr (buffer, "Official")) {
+	    umount(CM_MOUNTPOINT_DIR);
+	    found = 1;
+	    break;
 	}
    }
     if (choices)
 	free (choices);
+    if (fp)
+	fclose(fp);
     return found;
 }
 



Reply to: