Ignore:
Timestamp:
Mar 4, 2024, 5:11:25 PM (4 months ago)
Author:
Bruno Cornec
Message:

manages kernel_path dynamically

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-files.c

    r3826 r3829  
    269269 * don't do anything.
    270270 * @param kernel Where to put the found kernel.
    271  * @return 0 for success, 1 for failure.
     271 * @return 0 for success aborts otherwise
    272272 */
    273273int figure_out_kernel_path_interactively_if_necessary(char *kernel)
     
    276276    char *command = NULL;
    277277
    278     if (!kernel[0]) {
    279         tmp = call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null");
    280         strcpy(kernel, tmp);
    281         mr_free(tmp);
     278    if (kernel == NULL) {
     279        kernel = call_program_and_get_last_line_of_output("mindi --findkernel 2> /dev/null");
    282280    }
    283281    // If we didn't get anything back, check whether mindi raised a fatal error
    284     if (!kernel[0]) {
     282    if (strcmp(kernel,"") == 0) {
    285283        mr_asprintf(command, "grep 'Fatal error' %s", MINDI_LOGFILE);
    286284        tmp = call_program_and_get_last_line_of_output(command);
     
    295293    } else {
    296294        // If we've found the kernel, allow sysadmin to modify it if he wants
    297         if (!g_text_mode) {
    298             if (!popup_and_get_string("Kernel path", "We found this full path name for your kernel. You should just use it in most cases", kernel, MAX_STR_LEN / 4)) {
    299                 fatal_error("Kernel not found. Please specify with the '-k' flag.");
     295        while ((kernel == NULL) || (strcmp(kernel,"") == 0)) {
     296            if (!g_text_mode) {
     297                tmp = mr_popup_and_get_string("Kernel path", "We found this full path name for your kernel. You should just use it in most cases", kernel);
     298                if (tmp == NULL) {
     299                    fatal_error("Kernel not found. Please specify with the '-k' flag.");
     300                } else {
     301                    mr_free(kernel);
     302                    kernel = tmp;
     303                }
    300304            }
    301305        }
     
    304308
    305309    log_it("Calling Mindi with kernel path of '%s'", kernel);
    306     while (!kernel[0]) {
    307         if (!ask_me_yes_or_no("Kernel not found or invalid. Choose another?")) {
    308             return (1);
    309         }
    310         if (!popup_and_get_string("Kernel path", "What is the full path and filename of your kernel, please?", kernel, MAX_STR_LEN / 4)) {
    311             fatal_error("Kernel not found. Please specify with the '-k' flag.");
    312         }
    313         log_it("User says kernel is at %s", kernel);
    314     }
    315     return (0);
     310    return(0);
    316311}
    317312
Note: See TracChangeset for help on using the changeset viewer.