Ignore:
Timestamp:
May 20, 2007, 11:02:02 PM (17 years ago)
Author:
Bruno Cornec
Message:
  • Add ata_generic for mindi
  • Attempt to fix #117 (all paritions are now looked at if no grub or lilo found in MBR)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1408 r1452  
    22972297        return ('G');
    22982298    } else {
    2299         log_it("Unknown boot loader");
    2300         return ('U');
     2299        // We need to look on each partition then
     2300        mr_asprintf(&list_drives_cmd,
     2301            "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2302        log_it("list_drives_cmd = %s", list_drives_cmd);
     2303
     2304        if (!(pdrives = popen(list_drives_cmd, "r"))) {
     2305            log_OS_error("Unable to open list of drives");
     2306            mr_free(list_drives_cmd);
     2307            return ('\0');
     2308        }
     2309        mr_free(list_drives_cmd);
     2310
     2311        for (mr_getline(&current_drive, &n, pdrives); !feof(pdrives);
     2312            mr_getline(&current_drive, &n, pdrives)) {
     2313            mr_strip_spaces(current_drive);
     2314            log_it("looking at partition %s's BR", current_drive);
     2315            if (does_string_exist_in_boot_block(current_drive, "GRUB")) {
     2316                count_grubs++;
     2317                strcpy(which_device, current_drive);
     2318                break;
     2319            }
     2320            if (does_string_exist_in_boot_block(current_drive, "LILO")) {
     2321                count_lilos++;
     2322                strcpy(which_device, current_drive);
     2323                break;
     2324            }
     2325        }
     2326   
     2327        if (pclose(pdrives)) {
     2328            log_OS_error("Cannot pclose pdrives");
     2329        }
     2330        log_it("%d grubs and %d lilos\n", count_grubs, count_lilos);
     2331        if (count_grubs && !count_lilos) {
     2332            return ('G');
     2333        } else if (count_lilos && !count_grubs) {
     2334            return ('L');
     2335        } else if (count_grubs == 1 && count_lilos == 1) {
     2336            log_it("I'll bet you used to use LILO but switched to GRUB...");
     2337            return ('G');
     2338        } else {
     2339            log_it("Unknown boot loader");
     2340            return ('U');
     2341        }
    23012342    }
    23022343#endif
Note: See TracChangeset for help on using the changeset viewer.