void mod_delete_module() { char **list; int items, choice; module_t *mod, **mod_list; items = mod_list_loaded_modules(&list, &mod_list, align_none); if(items) { choice = dia_list("Choose the module to unload.", MENU_WIDTH, NULL, list, 1, align_left); if(choice > 0) { mod = mod_list[choice - 1]; if(mod->post_inst) { mod_unload_modules(mod->post_inst); } mod_unload_modules(mod->name); if(mod->pre_inst) { mod_unload_modules(mod->pre_inst); } } } else { dia_message("No modules currently loaded.", MSGTYPE_INFO); } }
int mod_load_modules(char *modules, int show) { char buf[256]; int ok = 1; slist_t *sl0, *sl; sl0 = slist_split(' ', modules); for(sl = sl0; sl && ok; sl = sl->next) { if(mod_is_loaded(sl->key)) { if(show == 2) { sprintf(buf, "Module \"%s\" has already been loaded.", sl->key); dia_message(buf, MSGTYPE_INFO); } } else { mod_load_module_manual(sl->key, show); if(!mod_is_loaded(sl->key)) ok = 0; } } slist_free(sl0); return ok; }
void mod_load_module_manual(char *module, int show) { module_t *ml; char *s, buf[256]; window_t win; int i; if(!(ml = mod_get_entry(module))) { mod_insmod(module, NULL); return; } if(!config.win) show = 0; if(show && !ml->dontask) { s = mod_get_params(ml); } else { s = ml->param && (ml->autoload || ml->dontask) ? ml->param : ""; } if(show) { if(s) { sprintf(buf, "Trying to load module \"%s\"...\n\n" "During loading, you may want to watch the kernel messages on virtual console 4 (ALT-F4). Use ALT-F1 to switch back to this menu.", ml->name); dia_info(&win, buf, MSGTYPE_INFO); mod_insmod(ml->name, s); win_close(&win); i = mod_is_loaded(ml->name); if(i) { sprintf(buf, "Module \"%s\" loaded successfully.", ml->name); dia_message(buf, MSGTYPE_INFO); } else { util_beep(FALSE); sprintf(buf, "Failed to load module \"%s\".", ml->name); dia_message(buf, MSGTYPE_ERROR); } } } else { mod_insmod(ml->name, s); } }
/* * Like dia_message() but start and stop window mode as needed. */ int dia_message2(char *txt, int type) { int i, win; if(!(win = config.win)) util_disp_init(); i = dia_message(txt, type); if(!win) util_disp_done(); return i; }
void mod_show_modules() { char **list; int items; #ifdef DEBUG_MODULE slist_t *sl; #endif items = mod_list_loaded_modules(&list, NULL, align_left); #ifdef DEBUG_MODULE for(sl = config.module.used_params; sl; sl = sl->next) { log_info(" %s: >%s<\n", sl->key, sl->value); } #endif if(items) { dia_show_lines("Show Loaded Modules", list, items, MENU_WIDTH, FALSE); } else { dia_message("No modules currently loaded.", MSGTYPE_INFO); } }
/* * return values: * -1 : abort (aka ESC) * 0 : ok * other: stay in menu */ int set_settings_cb (dia_item_t di) { int rc = 0; char *s; url_t *url; di_set_settings_last = di; switch(di) { case di_set_lang: set_choose_language(); break; case di_set_display: set_choose_display(); util_print_banner(); break; case di_set_keymap: set_choose_keytable(1); rc = 1; break; case di_set_animate: rc = dia_yesno("Use animated windows?", config.explode_win ? YES : NO); if(rc == YES) config.explode_win = 1; else if(rc == NO) config.explode_win = 0; rc = 1; break; case di_set_forceroot: rc = dia_yesno("Should the root image be loaded into the RAM disk?", config.download.instsys ? YES : NO); config.download.instsys_set = 1; if(rc == YES) config.download.instsys = 1; else if(rc == NO) config.download.instsys = 0; rc = 1; break; case di_set_rootimage: (void) dia_input2("Enter the path and name of the file to load into the RAM disk as the root file system.", &config.rootimage, 30, 0); rc = 1; break; case di_set_vnc: rc = dia_yesno("Use VNC for install?", config.vnc ? YES : NO); if(rc != ESCAPE) { if((config.vnc = rc == YES ? 1 : 0)) { config.net.do_setup |= DS_VNC; } else { config.net.do_setup &= ~DS_VNC; } } rc = 1; break; case di_set_usessh: rc = dia_yesno("Start SSH for Text Install?", config.usessh ? YES : NO); if(rc != ESCAPE) { if((config.usessh = rc == YES ? 1 : 0)) { config.net.do_setup |= DS_SSH; } else { config.net.do_setup &= ~DS_SSH; } } rc = 1; break; case di_set_startshell: rc = dia_yesno("Start shell before and after YaST?", config.startshell ? YES : NO); if(rc != ESCAPE) config.startshell = rc == YES ? 1 : 0; rc = 1; break; case di_set_slp: if(net_config_needed(1) && net_config()) { rc = 1; break; } url = url_set("slp:"); s = slp_get_install(url); url_free(url); rc = 1; if(s) { url = url_set(s); if(url->scheme) { url_free(config.url.install); config.url.install = url; rc = 0; } else { url_free(url); } } if(rc) dia_message("SLP failed", MSGTYPE_ERROR); rc = 1; break; case di_inst_net_config: net_config(); rc = 1; break; default: break; } return rc; }
void digest_media_verify() { int i; char buf[256], *device = NULL; hd_t *hd; update_device_list(0); iso.err = 1; if(config.device) get_info(device = config.device); if(iso.err) { for(hd = fix_device_names(hd_list(config.hd_data, hw_cdrom, 0, NULL)); hd; hd = hd->next) { if(hd->is.notready) continue; get_info(device = hd->unix_dev_name); if(!iso.err) break; } } if(iso.err) { if(dia_message("Insert Installation CD-ROM or DVD.", MSGTYPE_INFO)) return; for(hd = fix_device_names(hd_list(config.hd_data, hw_cdrom, 0, NULL)); hd; hd = hd->next) { if(hd->is.notready) continue; get_info(device = hd->unix_dev_name); if(!iso.err) break; } } if(iso.err) { dia_message("No CD-ROM or DVD found.", MSGTYPE_ERROR); config.manual=1; return; } fprintf(stderr, " app: %s\nmedia: %s%d\n size: %u kB\n pad: %u kB\n", iso.app_id, iso.media_type, iso.media_nr ?: 1, iso.size, iso.pad ); fprintf(stderr, " ref: "); if(iso.digest.got_old) for(i = 0; i < iso.digest.size; i++) fprintf(stderr, "%02x", iso.digest.old[i]); fprintf(stderr, "\n"); if(!*iso.app_id || !iso.digest.got_old || iso.pad >= iso.size) { sprintf(buf, "This is not a %s CD-ROM.", config.product); dia_message(buf, MSGTYPE_ERROR); config.manual=1; return; } do_digest(device); if(iso.err_ofs) { fprintf(stderr, " err: sector %u\n", iso.err_ofs >> 1); }