Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2013-12-06 09:43:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxrc (Old) and /work/SRC/openSUSE:Factory/.linuxrc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc" Changes: -------- --- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes 2013-11-19 10:45:43.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.linuxrc.new/linuxrc.changes 2013-12-06 09:43:48.000000000 +0100 @@ -1,0 +2,19 @@ +Thu Dec 5 11:41:22 CET 2013 - [email protected] + +- rework linemode (fate #313156) +- 4.2.2 + +------------------------------------------------------------------- +Wed Dec 4 14:55:07 CET 2013 - [email protected] + +- add 'back' entry in linemode (fate #313155) +- use readline in linemode +- allow media checks of any device (bnc #848020) +- 4.2.1 + +------------------------------------------------------------------- +Fri Nov 29 11:22:07 CET 2013 - [email protected] + +- add back language menu + +------------------------------------------------------------------- Old: ---- linuxrc-4.2.0.tar.bz2 New: ---- linuxrc-4.2.2.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.U2IqrU/_old 2013-12-06 09:43:48.000000000 +0100 +++ /var/tmp/diff_new_pack.U2IqrU/_new 2013-12-06 09:43:48.000000000 +0100 @@ -21,12 +21,13 @@ BuildRequires: hwinfo-devel BuildRequires: libblkid-devel BuildRequires: libcurl-devel +BuildRequires: readline-devel Summary: SUSE Installation Program License: GPL-3.0+ Group: System/Boot -Version: 4.2.0 +Version: 4.2.2 Release: 0 -Source: linuxrc-4.2.0.tar.bz2 +Source: linuxrc-4.2.2.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build %description ++++++ linuxrc-4.2.0.tar.bz2 -> linuxrc-4.2.2.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/Makefile new/linuxrc-4.2.2/Makefile --- old/linuxrc-4.2.0/Makefile 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/Makefile 2013-12-04 11:45:35.000000000 +0100 @@ -1,6 +1,6 @@ CC = gcc CFLAGS = -c -g -O2 -Wall -Wno-pointer-sign -LDFLAGS = -rdynamic -lhd -lblkid -lcurl +LDFLAGS = -rdynamic -lhd -lblkid -lcurl -lreadline GIT2LOG = $(shell [ -x ./git2log ] && echo ./git2log ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/VERSION new/linuxrc-4.2.2/VERSION --- old/linuxrc-4.2.0/VERSION 2013-11-18 14:08:56.000000000 +0100 +++ new/linuxrc-4.2.2/VERSION 2013-12-05 11:41:19.000000000 +0100 @@ -1 +1 @@ -4.2.0 +4.2.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/auto2.c new/linuxrc-4.2.2/auto2.c --- old/linuxrc-4.2.0/auto2.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/auto2.c 2013-11-29 12:09:41.000000000 +0100 @@ -56,6 +56,7 @@ int auto2_init() { int ok, win_old, install_unset = 0; + char *device; auto2_scan_hardware(); @@ -82,11 +83,6 @@ while(!inst_update_cd()); } - if(config.mediacheck) { - if(!config.win) util_disp_init(); - digest_media_verify(); - } - if(config.win && !win_old) util_disp_done(); ok = auto2_find_repo(); @@ -101,6 +97,32 @@ LXRC_WAIT + device = config.url.install->used.device ?: config.url.install->device; + + win_old = config.win; + + if(config.debug) { + fprintf(stderr, "ok = %d\n", ok); + fprintf(stderr, "is.network = %d\n", config.url.install->is.network); + fprintf(stderr, "is.mountable = %d\n", config.url.install->is.mountable); + fprintf(stderr, "device = %s\n", device); + } + + if( + ok && + config.mediacheck && + !config.url.install->is.network && + config.url.install->is.mountable && + device + ) { + if(!config.win) util_disp_init(); + digest_media_verify(device); + } + + if(config.win && !win_old) util_disp_done(); + + LXRC_WAIT + util_splash_bar(50, SPLASH_50); return ok; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/changelog new/linuxrc-4.2.2/changelog --- old/linuxrc-4.2.0/changelog 2013-11-18 14:08:57.000000000 +0100 +++ new/linuxrc-4.2.2/changelog 2013-12-05 11:41:21.000000000 +0100 @@ -1,3 +1,12 @@ +2013-12-05: HEAD + - rework linemode (fate #313156) + +2013-12-04: 4.2.1 + - add 'back' entry in linemode (fate #313155) + - use readline in linemode + - allow media checks of any device (bnc #848020) + - add back language menu + 2013-11-18: 4.2.0 - add back language defines - nfs: use mount(8) and mount.nfs(8) to mount nfs exports (bnc #799496) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/checkmedia.c new/linuxrc-4.2.2/checkmedia.c --- old/linuxrc-4.2.0/checkmedia.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/checkmedia.c 2013-11-29 12:10:09.000000000 +0100 @@ -72,18 +72,28 @@ window_t win; -void digest_media_verify() +void digest_media_verify(char *device) { int i; - char buf[256], *device = NULL; + char buf[256]; hd_t *hd; - update_device_list(0); - iso.err = 1; - if(config.device) get_info(device = config.device); + fprintf(stderr, "digest_media_verify(%s)\n", device); + + if(device) { + device = strdup(long_dev(device)); + get_info(device); + } + else { + update_device_list(0); + if(config.device) get_info(device = config.device); + + dia_message("No CD-ROM or DVD found!!!", MSGTYPE_ERROR); + } +#if 0 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; @@ -107,6 +117,7 @@ config.manual=1; return; } +#endif fprintf(stderr, " app: %s\nmedia: %s%d\n size: %u kB\n pad: %u kB\n", @@ -122,7 +133,7 @@ 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); + sprintf(buf, "This is not a %s medium.", config.product); dia_message(buf, MSGTYPE_ERROR); config.manual=1; return; @@ -168,7 +179,7 @@ config.manual=1; } else { - dia_message("Checksumming Canceled.", MSGTYPE_INFO); + dia_message("Checksumming canceled.", MSGTYPE_INFO); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/checkmedia.h new/linuxrc-4.2.2/checkmedia.h --- old/linuxrc-4.2.0/checkmedia.h 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/checkmedia.h 2013-11-21 11:06:43.000000000 +0100 @@ -1 +1 @@ -void digest_media_verify(void); +void digest_media_verify(char *device); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/dialog.c new/linuxrc-4.2.2/dialog.c --- old/linuxrc-4.2.0/dialog.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/dialog.c 2013-12-05 11:31:09.000000000 +0100 @@ -11,6 +11,7 @@ #include <string.h> #include <unistd.h> #include <ctype.h> +#include <readline/readline.h> #include <sys/types.h> #include <sys/wait.h> @@ -40,7 +41,7 @@ { di_expert_info, "System Information", }, { di_expert_modules, "Kernel Modules (Hardware Drivers)", }, - { di_expert_verify, "Verify Installation CD-ROM/DVD", }, + { di_expert_verify, "Verify Installation Medium", }, { di_expert_eject, "Eject CD", }, { di_exit_reboot, "Exit or Reboot", }, @@ -129,6 +130,9 @@ static int dia_binary(char *txt, char *button0, char *button1, int def); static int dia_win_open (window_t *win_prr, char *txt_tv); static int lgetchar(void); +static char *readline_input(char *prompt, char *val); + +static int dia_input(char *txt_tv, char *input_tr, int len_iv, int fieldlen_iv, int pw_mode); /* * @@ -270,6 +274,7 @@ putchar('\n'); dia_printformatted(txt, 0, max_x_ig - 1, 1); putchar('\n'); + printf("0) <-- Back <--\n"); printf("1) %s\n", button0_txt); printf("2) %s\n", button1_txt); printf("\n> ");fflush(stdout); @@ -430,6 +435,9 @@ putchar('\n'); dia_printformatted(head_tv, 0, max_x_ig - 1, 1); putchar('\n'); + + printf("%s0) <-- Back <--\n", nr_items_iv >= 10 ? " " : ""); + for (i = cnt = 0; i < nr_items_iv; i++) { for (p = items_arv[i].text; *p == ' '; p++) @@ -444,6 +452,8 @@ } } + // printf("\n%s0) <-- Back <--\n", nr_items_iv >= 10 ? " " : ""); + printf("\n> "); fflush(stdout); current_ii = dia_readnum(); @@ -887,116 +897,123 @@ win_close(win_prv); } -int dia_input (char *txt_tv, char *input_tr, int len_iv, int fieldlen_iv, int pw_mode) +int dia_input(char *txt_tv, char *input_tr, int len_iv, int fieldlen_iv, int pw_mode) { - window_t win_ri; - window_t tmp_win_ri; - int rc_ii; + window_t win_ri; + window_t tmp_win_ri; + int rc_ii = 0; + + if(config.linemode) { + int i; + char *buf = NULL; + + if(txt_tv) { + printf( + "\n%s%s (Enter '+++' to abort).\n", + txt_tv, + *txt_tv && txt_tv[strlen(txt_tv) - 1] == '.' ? "" : "." + ); + } - if (config.linemode) - { - int i, c; + if(pw_mode) kbd_echo_off(); + + if(config.linemode == 1) { + buf = readline_input("> ", input_tr); + } + else { + int c; + const int buf_len = 1024; + + buf = malloc(buf_len); + + strncpy(buf, input_tr, buf_len - 1); + buf[buf_len - 1] = 0; ctrlc: - putchar('\n'); - i = strlen(txt_tv); - if (i > 0 && txt_tv[i - 1] == '.') - i--; - c = i = dia_printformatted(txt_tv, i, max_x_ig - 1, 0); - if(c) { - putchar('\n'); - c = i = 0; - } - if (*input_tr) - i += strlen(input_tr) + 3; - if (i > max_x_ig - fieldlen_iv - 2) - { - putchar('\n'); - c = 0; - } - if (*input_tr && !pw_mode) - printf(" [%s]> " + (c == 0), input_tr); - else - printf("> "); - fflush(stdout); - if (pw_mode) - kbd_echo_off(); - for (i = 0; ; i++) - { - c = lgetchar(); - if (c == '\n' || c == '\r' || c == EOF) - { - if (i == 0) - break; - input_tr[i < len_iv - 1 ? i : len_iv - 1] = 0; - break; - } - if (i == 0 && c == 033 /* escape */) - { - c = lgetchar(); - if (c == '\n' || c == '\r' || c == EOF) - { - if (pw_mode) - kbd_reset(); - return -1; - } - if (c == 033 || c == 'x') - { - while (c = lgetchar(), c != '\n' && c != '\r' && c != EOF); - if (pw_mode) kbd_reset(); - dia_handle_ctrlc(); - goto ctrlc; - } - } - if ((unsigned char)c < ' ') - { - i--; - continue; - } - if (i < len_iv - 1) - input_tr[i] = c; - } - if (pw_mode) - kbd_reset(); - rc_ii = 0; + if(*buf && !pw_mode) { + printf("[%s]> ", buf); } - else - { - disp_toggle_output (DISP_OFF); - memset (&win_ri, 0, sizeof (window_t)); - win_ri.bg_color = colors_prg->input_win; - win_ri.fg_color = colors_prg->msg_fg; - dia_win_open (&win_ri, txt_tv); - - memset (&tmp_win_ri, 0, sizeof (window_t)); - tmp_win_ri.x_left = win_ri.x_left + 1; - tmp_win_ri.y_left = win_ri.y_right - 3; - tmp_win_ri.x_right = win_ri.x_right - 1; - tmp_win_ri.y_right = win_ri.y_right - 1; - tmp_win_ri.style = STYLE_RAISED; - tmp_win_ri.bg_color = win_ri.bg_color; - tmp_win_ri.fg_color = win_ri.fg_color; - win_open (&tmp_win_ri); - win_clear (&tmp_win_ri); - disp_flush_area (&win_ri); + else { + printf("> "); + } + fflush(stdout); - rc_ii = win_input (max_x_ig / 2 - fieldlen_iv / 2, win_ri.y_right - 2, - input_tr, len_iv, fieldlen_iv, pw_mode); + for(i = 0; ; i++) { + c = lgetchar(); + + if(c == '\n' || c == '\r' || c == EOF) { + if(i == 0) break; + buf[i < buf_len - 1 ? i : buf_len - 1] = 0; + break; + } - win_close (&win_ri); + if(i == 0 && c == 033 /* escape */) { + c = lgetchar(); + if(c == '\n' || c == '\r' || c == EOF) { + free(buf); + buf = NULL; + break; + } + if(c == 033 || c == 'x') { + while (c = lgetchar(), c != '\n' && c != '\r' && c != EOF); + if(pw_mode) kbd_reset(); + dia_handle_ctrlc(); + if(pw_mode) kbd_echo_off(); + goto ctrlc; + } + } + + if((unsigned char) c < ' ') { i--; continue; } + + if(i < buf_len - 1) buf[i] = c; + } + } + + if(pw_mode) kbd_reset(); + + if(buf && ((i = strlen(buf)) < 3 || strcmp(buf + i - 3, "+++"))) { + strncpy(input_tr, buf, len_iv); + input_tr[len_iv - 1] = 0; } + else { + rc_ii = -1; + } + + free(buf); + } + else { + disp_toggle_output(DISP_OFF); + memset(&win_ri, 0, sizeof (window_t)); + win_ri.bg_color = colors_prg->input_win; + win_ri.fg_color = colors_prg->msg_fg; + dia_win_open(&win_ri, txt_tv); + + memset(&tmp_win_ri, 0, sizeof (window_t)); + tmp_win_ri.x_left = win_ri.x_left + 1; + tmp_win_ri.y_left = win_ri.y_right - 3; + tmp_win_ri.x_right = win_ri.x_right - 1; + tmp_win_ri.y_right = win_ri.y_right - 1; + tmp_win_ri.style = STYLE_RAISED; + tmp_win_ri.bg_color = win_ri.bg_color; + tmp_win_ri.fg_color = win_ri.fg_color; + win_open(&tmp_win_ri); + win_clear(&tmp_win_ri); + disp_flush_area(&win_ri); + + rc_ii = win_input(max_x_ig / 2 - fieldlen_iv / 2, win_ri.y_right - 2, input_tr, len_iv, fieldlen_iv, pw_mode); + + win_close(&win_ri); + } #if defined(__s390__) || defined(__s390x__) - /* HMC console is bugged and sends SPACE LF instead of LF when - user presses enter on an empty line */ - if(strcmp(input_tr, " ") == 0) { - *input_tr = 0; - } + /* + * HMC console is bugged and sends SPACE LF instead of LF when + * user presses enter on an empty line. + */ + if(!strcmp(input_tr, " ")) *input_tr = 0; #endif - if(strcmp(input_tr, "+++") == 0) /* escape sequence */ - return -1; - else - return (rc_ii); + + return rc_ii; } @@ -1405,7 +1422,6 @@ { int i, j; static int is_in_ctrlc_is = FALSE; - static char s[64] = { }; char *t; file_t *f; @@ -1442,17 +1458,17 @@ exit(0); } else if(i == -69) { - i = dia_input("Run Command", s, sizeof s - 1, 35, 0); - if(!i) { - if(strstr(s, "exec ") == s) { - t = s + 5; + i = dia_input2("Run Command", &config.run_command, 35, 0); + if(!i && config.run_command) { + if(strstr(config.run_command, "exec ") == config.run_command) { + t = config.run_command + 5; while(isspace(*t)) t++; kbd_end(0); /* restore terminal settings */ j = execlp(t, t, NULL); kbd_init(0); } else { - j = system(s); + j = system(config.run_command); } if(j) fprintf(stderr, " exit code: %d\n", WIFEXITED(j) ? WEXITSTATUS(j) : -1); } @@ -1465,9 +1481,9 @@ util_status_info(0); } else if(i == -73) { - i = dia_input("Change config", s, sizeof s - 1, 35, 0); + i = dia_input2("Change config", &config.change_config, 35, 0); if(!i) { - f = file_parse_buffer(s, kf_cfg + kf_cmd + kf_cmd_early); + f = file_parse_buffer(config.change_config, kf_cfg + kf_cmd + kf_cmd_early); file_do_info(f, kf_cfg + kf_cmd + kf_cmd_early); file_free_file(f); } @@ -1646,7 +1662,7 @@ int dia_input2(char *txt, char **input, int fieldlen, int pw_mode) { - char buf[256]; + char buf[1024]; int i; if(!input) return 0; @@ -1724,3 +1740,22 @@ return i; } + +char *readline_input(char *prompt, char *val) +{ + char *s; + + // rl_catch_signals = 0; + // rl_set_signals(); + + if(val) { + while(*val) rl_stuff_char(*val++); + } + + s = readline(prompt); + + rl_clear_signals(); + + return s; +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/dialog.h new/linuxrc-4.2.2/dialog.h --- old/linuxrc-4.2.0/dialog.h 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/dialog.h 2013-12-04 12:07:39.000000000 +0100 @@ -119,8 +119,6 @@ extern void dia_status_on (window_t *win_prr, char *txt_tv); extern void dia_status (window_t *win_prv, int percent_iv); extern void dia_status_off (window_t *win_prr); -extern int dia_input (char *txt_tv, char *input_tr, - int len_iv, int fieldlen_iv, int pw_mode); extern int dia_show_file (char *head_tv, char *file_tv, int eof_iv); extern void dia_info (window_t *win_prr, char *txt_tv, int type); extern int dia_show_lines (char *head_tv, char *lines_atv [], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/global.h new/linuxrc-4.2.2/global.h --- old/linuxrc-4.2.0/global.h 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/global.h 2013-12-04 12:05:47.000000000 +0100 @@ -331,7 +331,7 @@ unsigned extramount:1; /* mountpoints.extra is in use */ unsigned textmode:1; /* start yast2 in text mode */ unsigned debugwait:1; /* pop up dialogs at some critical points */ - unsigned linemode:1; /* line mode */ + unsigned linemode:2; /* line mode */ unsigned ask_language:1; /* let use choose language */ unsigned ask_keytable:1; /* let user choose keytable */ unsigned nopcmcia:1; /* don't start pcmcia automatically */ @@ -452,6 +452,8 @@ slist_t *udevrules; /* udev rules */ char *namescheme; /* device name scheme (e.g.: by-id, by-label, by-path) */ slist_t *ptoptions; /* pass-through options: options that just need to be added /etc/install.inf */ + char *change_config; /* for 'change config option' input field */ + char *run_command; /* for 'run command' input field */ struct { unsigned md5:1; /* support md5 */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/install.c new/linuxrc-4.2.2/install.c --- old/linuxrc-4.2.0/install.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/install.c 2013-12-03 11:41:26.000000000 +0100 @@ -1394,204 +1394,7 @@ */ int choose_dud(char **dev) { - int i, j, item_cnt, last_item, dev_len, item_width; - int sort_cnt, err = 0; - char *s, *s1, *s2, *s3, *buf = NULL, **items, **values; - hd_data_t *hd_data; - hd_t *hd, *hd1; - window_t win; - - *dev = NULL; - - hd_data = calloc(1, sizeof *hd_data); - - if(config.manual < 2) { - dia_info(&win, "Searching for storage devices...", MSGTYPE_INFO); - fix_device_names(hd_list(hd_data, hw_block, 1, NULL)); - win_close(&win); - } - - for(i = 0, hd = hd_data->hd; hd; hd = hd->next) { - if(!hd_is_hw_class(hd, hw_block)) continue; - - /* don't look at whole disk devs, if there are partitions */ - if( - (hd1 = hd_get_device_by_idx(hd_data, hd->attached_to)) && - hd1->base_class.id == bc_storage_device - ) { - hd1->status.available = status_no; - } - - i++; - } - - /* just max values, actual lists might be shorter */ - items = calloc(i + 1 + 2, sizeof *items); - values = calloc(i + 1 + 2, sizeof *values); - - item_cnt = 0; - - /* max device name length */ - for(dev_len = 0, hd = hd_data->hd; hd; hd = hd->next) { - if( - !hd_is_hw_class(hd, hw_block) || - hd->status.available == status_no || - !hd->unix_dev_name - ) continue; - - j = strlen(hd->unix_dev_name); - if(j > dev_len) dev_len = j; - } - dev_len = dev_len > 5 ? dev_len - 5 : 1; - - item_width = sizeof "other device" - 1; - - for(sort_cnt = 0; sort_cnt < 4; sort_cnt++) { - for(hd = hd_data->hd; hd; hd = hd->next) { - if( - !hd_is_hw_class(hd, hw_block) || - hd->status.available == status_no || - !hd->unix_dev_name || - strncmp(hd->unix_dev_name, "/dev/", sizeof "/dev/" - 1) - ) continue; - - j = 0; - switch(sort_cnt) { - case 0: - if(hd_is_hw_class(hd, hw_floppy)) j = 1; - break; - - case 1: - if(hd_is_hw_class(hd, hw_cdrom)) j = 1; - break; - - case 2: - if(hd_is_hw_class(hd, hw_usb)) { - j = 1; - } - else { - hd1 = hd_get_device_by_idx(hd_data, hd->attached_to); - if(hd1 && hd_is_hw_class(hd1, hw_usb)) j = 1; - } - break; - - default: - j = 1; - break; - } - - if(!j) continue; - - hd->status.available = status_no; - - if( - !(hd1 = hd_get_device_by_idx(hd_data, hd->attached_to)) || - hd1->base_class.id != bc_storage_device - ) { - hd1 = hd; - } - - s1 = hd1->model; - if(hd_is_hw_class(hd, hw_floppy)) s1 = ""; - - s2 = "Disk"; - if(hd_is_hw_class(hd, hw_partition)) s2 = "Partition"; - if(hd_is_hw_class(hd, hw_floppy)) s2 = "Floppy"; - if(hd_is_hw_class(hd, hw_cdrom)) s2 = "CD-ROM"; - - s3 = ""; - if(hd_is_hw_class(hd1, hw_usb)) s3 = "USB "; - - s = NULL; - strprintf(&s, "%*s: %s%s%s%s", - dev_len, - short_dev(hd->unix_dev_name), - s3, - s2, - *s1 ? ", " : "", - s1 - ); - - j = strlen(s); - if(j > item_width) item_width = j; - - // fprintf(stderr, "<%s>\n", s); - - values[item_cnt] = strdup(short_dev(hd->unix_dev_name)); - items[item_cnt++] = s; - s = NULL; - } - } - - last_item = 0; - - if(config.update.dev) { - for(i = 0; i < item_cnt; i++) { - if(values[i] && !strcmp(values[i], config.update.dev)) { - last_item = i + 1; - break; - } - } - - if(!last_item) { - values[item_cnt] = strdup(config.update.dev); - items[item_cnt++] = strdup(config.update.dev); - last_item = item_cnt; - } - } - - values[item_cnt] = NULL; - items[item_cnt++] = strdup("other device"); - - if(item_width > 60) item_width = 60; - - if(item_cnt > 1) { - i = dia_list("Please choose the Driver Update medium.", item_width + 2, NULL, items, last_item, align_left); - } - else { - i = item_cnt; - } - - if(i > 0) { - s = values[i - 1]; - if(s) { - str_copy(&config.update.dev, values[i - 1]); - *dev = config.update.dev; - } - else { - str_copy(&buf, NULL); - i = dia_input2("Please enter the Driver Update device.", &buf, 30, 0); - if(!i) { - if(util_check_exist(long_dev(buf)) == 'b') { - str_copy(&config.update.dev, short_dev(buf)); - *dev = config.update.dev; - } - else { - dia_message("Invalid device name.", MSGTYPE_ERROR); - } - } - else { - err = 1; - } - } - } - else { - err = 1; - } - - for(i = 0; i < item_cnt; i++) { free(items[i]); free(values[i]); } - free(items); - free(values); - - free(buf); - - hd_free_hd_data(hd_data); - - free(hd_data); - - // fprintf(stderr, "dud dev = %s\n", *dev); - - return err; + return util_choose_disk_device(dev, 1, "Please choose the Driver Update medium.", "Please enter the Driver Update device."); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/linuxrc.c new/linuxrc-4.2.2/linuxrc.c --- old/linuxrc-4.2.0/linuxrc.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/linuxrc.c 2013-12-04 14:47:29.000000000 +0100 @@ -139,7 +139,7 @@ } config.had_segv = 1; - config.linemode = (state >> 1) & 1; + config.linemode = (state >> 1) & 3; if((state & 1) == 0) { /* was not in window mode */ fprintf(stderr, "\n\nLinuxrc crashed. :-((\nPress ENTER to continue.\n"); @@ -635,12 +635,7 @@ } signal(SIGBUS, lxrc_catch_signal); - - if(!config.test) { - signal(SIGINT, lxrc_catch_signal); - signal(SIGTERM, lxrc_catch_signal); - } - + signal(SIGTERM, lxrc_catch_signal); signal(SIGSEGV, (void (*)(int)) lxrc_catch_signal_11); signal(SIGPIPE, lxrc_catch_signal); } @@ -659,6 +654,7 @@ siginterrupt(SIGSEGV, 1); siginterrupt(SIGPIPE, 1); lxrc_catch_signal(0); + signal(SIGINT, SIG_IGN); signal(SIGUSR1, lxrc_usr1); /* reboot (RB_DISABLE_CAD); */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/module.c new/linuxrc-4.2.2/module.c --- old/linuxrc-4.2.0/module.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/module.c 2013-12-04 12:02:41.000000000 +0100 @@ -558,7 +558,7 @@ char *mod_get_params(module_t *mod) { - char buf[256], buf2[256]; + char buf[256], *buf2 = NULL; slist_t *sl; if(mod_param_text) { @@ -580,14 +580,14 @@ if(sl && sl->value) strcpy(buf2, sl->value); - if(dia_input(buf, buf2, sizeof buf2 - 1, 30, 0)) return NULL; + if(dia_input2(buf, &buf2, 30, 0)) return NULL; if(!sl) { sl = slist_add(&config.module.input_params, slist_new()); sl->key = strdup(mod->name); } if(sl->value) free(sl->value); - sl->value = strdup(buf2); + sl->value = buf2; return sl->value; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/net.c new/linuxrc-4.2.2/net.c --- old/linuxrc-4.2.0/net.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/net.c 2013-12-05 11:35:19.000000000 +0100 @@ -1517,10 +1517,9 @@ for(u = 0; u < config.net.nameservers; u++) { if(config.net.nameservers == 1) { s = "Enter the IP address of your name server. Leave empty if you don't need one."; - if(config.linemode) s = "Enter the IP address of your name server. Leave empty or enter \"+++\" if you don't need one."; } else { - sprintf(buf, config.linemode ? "Enter the IP of name server %u or \"+++\" for none." : "Enter the IP of name server %u or press ESC.", u + 1); + sprintf(buf, "Enter the IP of name server %u or press ESC.", u + 1); s = buf; } if(net_get_address(s, &config.net.nameserver[u], 0)) break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/settings.c new/linuxrc-4.2.2/settings.c --- old/linuxrc-4.2.0/settings.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/settings.c 2013-12-04 12:00:57.000000000 +0100 @@ -61,122 +61,37 @@ #define LANG_DEFAULT lang_en -static language_t set_languages_arm [] = -{ -#ifdef TRANS_af -{ lang_af, "Afrikaans", "us", SMALL_FONT, UNI_FONT, 0, 0, "af_ZA", "af", 0 }, -#endif - -#ifdef TRANS_bg -{ lang_bg, "Български", "us", SMALL_FONT, UNI_FONT, 0, 0, "bg_BG", "bg", 0 }, -#endif - -#ifdef TRANS_ca -{ lang_ca, "Català", "us", SMALL_FONT, UNI_FONT, 0, 0, "ca_ES", "ca", 0 }, -#endif - -#ifdef TRANS_cs -{ lang_cs, "Čeština", "cz-us-qwertz", SMALL_FONT, UNI_FONT, 1, 1, "cs_CZ", "cs", 0 }, -#endif - -#ifdef TRANS_da -{ lang_da, "Dansk", "dk", SMALL_FONT, UNI_FONT, 0, 0, "da_DK", "da", 0 }, -#endif - -#ifdef TRANS_de -{ lang_de, "Deutsch", "de-latin1-nodeadkeys", SMALL_FONT, UNI_FONT, 0, 0, "de_DE", "de", 0 }, -#endif - -#ifdef TRANS_en -{ lang_en, "English", "us", SMALL_FONT, UNI_FONT, 0, 0, "en_US", "en_US", 0 }, -#endif - -#ifdef TRANS_es -{ lang_es, "Español", "es", SMALL_FONT, UNI_FONT, 0, 1, "es_ES", "es", 0 }, -#endif - -#ifdef TRANS_fr -{ lang_fr, "Français", "fr-latin1", SMALL_FONT, UNI_FONT, 0, 0, "fr_FR", "fr", 0 }, -#endif - -#ifdef TRANS_el -{ lang_el, "Ελληνικά", "gr", SMALL_FONT, UNI_FONT, 1, 1, "el_GR", "el", 0 }, -#endif - -#ifdef TRANS_it -{ lang_it, "Italiano", "it", SMALL_FONT, UNI_FONT, 0, 0, "it_IT", "it", 0 }, -#endif - -#ifdef TRANS_ja -{ lang_ja, "Japanese", "jp106", SMALL_FONT, UNI_FONT, 0, 0, "ja_JP", "ja", 1 }, -#endif - -#ifdef TRANS_hu -{ lang_hu, "Magyar", "hu", SMALL_FONT, UNI_FONT, 1, 1, "hu_HU", "hu", 0 }, -#endif - -#ifdef TRANS_nl -{ lang_nl, "Nederlands", "us", SMALL_FONT, UNI_FONT, 0, 1, "nl_NL", "nl", 0 }, -#endif - -#ifdef TRANS_nb -{ lang_nb, "Norsk", "no-latin1", SMALL_FONT, UNI_FONT, 0, 1, "nb_NO", "nb", 0 }, -#endif - -#ifdef TRANS_pl -{ lang_pl, "Polski", "Pl02", SMALL_FONT, UNI_FONT, 1, 1, "pl_PL", "pl", 0 }, -#endif - -#ifdef TRANS_pt -{ lang_pt, "Português", "pt-latin1", SMALL_FONT, UNI_FONT, 0, 1, "pt_PT", "pt", 0 }, -#endif - -#ifdef TRANS_pt_BR -{ lang_pt_BR, "Português Brasileiro", "br-abnt2", SMALL_FONT, UNI_FONT, 0, 1, "pt_BR", "pt_BR", 0 }, -#endif - -#ifdef TRANS_ru -{ lang_ru, "Русский", "ru1", SMALL_FONT, UNI_FONT, 1, 1, "ru_RU", "ru", 0 }, -#endif - -#ifdef TRANS_zh_CN -{ lang_zh_CN, "Simplified Chinese", "us", SMALL_FONT, UNI_FONT, 0, 0, "zh_CN", "zh_CN", 1 }, -#endif - -#ifdef TRANS_sk -{ lang_sk, "Slovenčina", "sk-qwerty", SMALL_FONT, UNI_FONT, 1, 1, "sk_SK", "sk", 0 }, -#endif - -#ifdef TRANS_sl -{ lang_sl, "Slovenščina", "slovene", SMALL_FONT, UNI_FONT, 1, 1, "sl_SI", "sl", 0 }, -#endif - -#ifdef TRANS_fi -{ lang_fi, "Suomi", "fi-latin1", SMALL_FONT, UNI_FONT, 0, 1, "fi_FI", "fi", 0 }, -#endif - -#ifdef TRANS_sv -{ lang_sv, "Svenska", "sv-latin1", SMALL_FONT, UNI_FONT, 0, 1, "sv_SE", "sv", 0 }, -#endif - -#ifdef TRANS_zh_TW -{ lang_zh_TW, "Traditional Chinese", "us", SMALL_FONT, UNI_FONT, 0, 0, "zh_TW", "zh_TW", 1 }, -#endif - -#ifdef TRANS_uk -{ lang_uk, "Українська", "us", SMALL_FONT, UNI_FONT, 0, 1, "uk_UA", "uk", 0 }, -#endif - -#ifdef TRANS_xh -{ lang_xh, "isiXhosa", "us", SMALL_FONT, UNI_FONT, 0, 0, "xh_ZA", "xh", 0 }, -#endif - -#ifdef TRANS_zu -{ lang_zu, "isiZulu", "us", SMALL_FONT, UNI_FONT, 0, 0, "zu_ZA", "zu", 0 }, -#endif - -// dummy for unknown language, must be last entry -{lang_dummy, "", "us", SMALL_FONT, UNI_FONT, 0, 0, NULL, 0 }, +static language_t set_languages_arm[] = { + { lang_af, "Afrikaans", "us", SMALL_FONT, UNI_FONT, 0, 0, "af_ZA", "af", 0 }, + { lang_bg, "Български", "us", SMALL_FONT, UNI_FONT, 0, 0, "bg_BG", "bg", 0 }, + { lang_ca, "Català", "us", SMALL_FONT, UNI_FONT, 0, 0, "ca_ES", "ca", 0 }, + { lang_cs, "Čeština", "cz-us-qwertz", SMALL_FONT, UNI_FONT, 1, 1, "cs_CZ", "cs", 0 }, + { lang_da, "Dansk", "dk", SMALL_FONT, UNI_FONT, 0, 0, "da_DK", "da", 0 }, + { lang_de, "Deutsch", "de-latin1-nodeadkeys", SMALL_FONT, UNI_FONT, 0, 0, "de_DE", "de", 0 }, + { lang_en, "English", "us", SMALL_FONT, UNI_FONT, 0, 0, "en_US", "en_US", 0 }, + { lang_es, "Español", "es", SMALL_FONT, UNI_FONT, 0, 1, "es_ES", "es", 0 }, + { lang_fr, "Français", "fr-latin1", SMALL_FONT, UNI_FONT, 0, 0, "fr_FR", "fr", 0 }, + { lang_el, "Ελληνικά", "gr", SMALL_FONT, UNI_FONT, 1, 1, "el_GR", "el", 0 }, + { lang_it, "Italiano", "it", SMALL_FONT, UNI_FONT, 0, 0, "it_IT", "it", 0 }, + { lang_ja, "Japanese", "jp106", SMALL_FONT, UNI_FONT, 0, 0, "ja_JP", "ja", 1 }, + { lang_hu, "Magyar", "hu", SMALL_FONT, UNI_FONT, 1, 1, "hu_HU", "hu", 0 }, + { lang_nl, "Nederlands", "us", SMALL_FONT, UNI_FONT, 0, 1, "nl_NL", "nl", 0 }, + { lang_nb, "Norsk", "no-latin1", SMALL_FONT, UNI_FONT, 0, 1, "nb_NO", "nb", 0 }, + { lang_pl, "Polski", "Pl02", SMALL_FONT, UNI_FONT, 1, 1, "pl_PL", "pl", 0 }, + { lang_pt, "Português", "pt-latin1", SMALL_FONT, UNI_FONT, 0, 1, "pt_PT", "pt", 0 }, + { lang_pt_BR, "Português Brasileiro", "br-abnt2", SMALL_FONT, UNI_FONT, 0, 1, "pt_BR", "pt_BR", 0 }, + { lang_ru, "Русский", "ru1", SMALL_FONT, UNI_FONT, 1, 1, "ru_RU", "ru", 0 }, + { lang_zh_CN, "Simplified Chinese", "us", SMALL_FONT, UNI_FONT, 0, 0, "zh_CN", "zh_CN", 1 }, + { lang_sk, "Slovenčina", "sk-qwerty", SMALL_FONT, UNI_FONT, 1, 1, "sk_SK", "sk", 0 }, + { lang_sl, "Slovenščina", "slovene", SMALL_FONT, UNI_FONT, 1, 1, "sl_SI", "sl", 0 }, + { lang_fi, "Suomi", "fi-latin1", SMALL_FONT, UNI_FONT, 0, 1, "fi_FI", "fi", 0 }, + { lang_sv, "Svenska", "sv-latin1", SMALL_FONT, UNI_FONT, 0, 1, "sv_SE", "sv", 0 }, + { lang_zh_TW, "Traditional Chinese", "us", SMALL_FONT, UNI_FONT, 0, 0, "zh_TW", "zh_TW", 1 }, + { lang_uk, "Українська", "us", SMALL_FONT, UNI_FONT, 0, 1, "uk_UA", "uk", 0 }, + { lang_xh, "isiXhosa", "us", SMALL_FONT, UNI_FONT, 0, 0, "xh_ZA", "xh", 0 }, + { lang_zu, "isiZulu", "us", SMALL_FONT, UNI_FONT, 0, 0, "zu_ZA", "zu", 0 }, + // dummy for unknown language, must be last entry + { lang_dummy, "", "us", SMALL_FONT, UNI_FONT, 0, 0, "en_US", "en_US", 0 }, }; #if defined(__i386__) || defined(__arm__) || defined(__x86_64__) || defined(__alpha__) || defined(__PPC__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__MIPSEB__) @@ -640,7 +555,7 @@ int set_expert_cb(dia_item_t di) { int i; - static char s[64] = { }; + char *dev = NULL; file_t *f; di_set_expert_last = di; @@ -655,7 +570,8 @@ break; case di_expert_verify: - digest_media_verify(); + util_choose_disk_device(&dev, 2, "Please choose the device to check.", "Enter the device to check."); + if(dev) digest_media_verify(dev); break; case di_expert_eject: @@ -667,9 +583,9 @@ break; case di_extras_change: - i = dia_input("Change config", s, sizeof s - 1, 35, 0); + i = dia_input2("Change config", &config.change_config, 35, 0); if(!i) { - f = file_parse_buffer(s, kf_cfg + kf_cmd + kf_cmd_early); + f = file_parse_buffer(config.change_config, kf_cfg + kf_cmd + kf_cmd_early); file_do_info(f, kf_cfg + kf_cmd + kf_cmd_early); file_free_file(f); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/util.c new/linuxrc-4.2.2/util.c --- old/linuxrc-4.2.0/util.c 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/util.c 2013-12-03 11:55:07.000000000 +0100 @@ -4230,3 +4230,225 @@ } +/* + * Let user enter a device + * (*dev = NULL if she changed her mind). + * + * type: 0 = all block devs + * 1 = skip whole disk if it has partitions + * 2 = skip partitions + * + * return values: + * 0 : ok + * 1 : abort + */ +int util_choose_disk_device(char **dev, int type, char *list_title, char *input_title) +{ + int i, j, item_cnt, last_item, dev_len, item_width; + int sort_cnt, err = 0; + char *s, *s1, *s2, *s3, *buf = NULL, **items, **values; + hd_data_t *hd_data; + hd_t *hd, *hd1; + window_t win; + + *dev = NULL; + + hd_data = calloc(1, sizeof *hd_data); + + if(config.manual < 2) { + dia_info(&win, "Searching for storage devices...", MSGTYPE_INFO); + fix_device_names(hd_list(hd_data, hw_block, 1, NULL)); + win_close(&win); + } + + for(i = 0, hd = hd_data->hd; hd; hd = hd->next) { + if(!hd_is_hw_class(hd, hw_block)) continue; + + if( + type == 1 && // skip whole disks if there are partitions + (hd1 = hd_get_device_by_idx(hd_data, hd->attached_to)) && + hd1->base_class.id == bc_storage_device + ) { + hd1->status.available = status_no; + } + + if( + type == 2 && // skip partitions + hd_is_hw_class(hd, hw_partition) + ) { + hd->status.available = status_no; + } + + i++; + } + + /* just max values, actual lists might be shorter */ + items = calloc(i + 1 + 2, sizeof *items); + values = calloc(i + 1 + 2, sizeof *values); + + item_cnt = 0; + + /* max device name length */ + for(dev_len = 0, hd = hd_data->hd; hd; hd = hd->next) { + if( + !hd_is_hw_class(hd, hw_block) || + hd->status.available == status_no || + !hd->unix_dev_name + ) continue; + + j = strlen(hd->unix_dev_name); + if(j > dev_len) dev_len = j; + } + dev_len = dev_len > 5 ? dev_len - 5 : 1; + + item_width = sizeof "other device" - 1; + + for(sort_cnt = 0; sort_cnt < 4; sort_cnt++) { + for(hd = hd_data->hd; hd; hd = hd->next) { + if( + !hd_is_hw_class(hd, hw_block) || + hd->status.available == status_no || + !hd->unix_dev_name || + strncmp(hd->unix_dev_name, "/dev/", sizeof "/dev/" - 1) + ) continue; + + j = 0; + switch(sort_cnt) { + case 0: + if(hd_is_hw_class(hd, hw_floppy)) j = 1; + break; + + case 1: + if(hd_is_hw_class(hd, hw_cdrom)) j = 1; + break; + + case 2: + if(hd_is_hw_class(hd, hw_usb)) { + j = 1; + } + else { + hd1 = hd_get_device_by_idx(hd_data, hd->attached_to); + if(hd1 && hd_is_hw_class(hd1, hw_usb)) j = 1; + } + break; + + default: + j = 1; + break; + } + + if(!j) continue; + + hd->status.available = status_no; + + if( + !(hd1 = hd_get_device_by_idx(hd_data, hd->attached_to)) || + hd1->base_class.id != bc_storage_device + ) { + hd1 = hd; + } + + s1 = hd1->model; + if(hd_is_hw_class(hd, hw_floppy)) s1 = ""; + + s2 = "Disk"; + if(hd_is_hw_class(hd, hw_partition)) s2 = "Partition"; + if(hd_is_hw_class(hd, hw_floppy)) s2 = "Floppy"; + if(hd_is_hw_class(hd, hw_cdrom)) s2 = "CD-ROM"; + + s3 = ""; + if(hd_is_hw_class(hd1, hw_usb)) s3 = "USB "; + + s = NULL; + strprintf(&s, "%*s: %s%s%s%s", + dev_len, + short_dev(hd->unix_dev_name), + s3, + s2, + *s1 ? ", " : "", + s1 + ); + + j = strlen(s); + if(j > item_width) item_width = j; + + // fprintf(stderr, "<%s>\n", s); + + values[item_cnt] = strdup(short_dev(hd->unix_dev_name)); + items[item_cnt++] = s; + s = NULL; + } + } + + last_item = 0; + + if(config.update.dev) { + for(i = 0; i < item_cnt; i++) { + if(values[i] && !strcmp(values[i], config.update.dev)) { + last_item = i + 1; + break; + } + } + + if(!last_item) { + values[item_cnt] = strdup(config.update.dev); + items[item_cnt++] = strdup(config.update.dev); + last_item = item_cnt; + } + } + + values[item_cnt] = NULL; + items[item_cnt++] = strdup("other device"); + + if(item_width > 60) item_width = 60; + + if(item_cnt > 1) { + i = dia_list(list_title, item_width + 2, NULL, items, last_item, align_left); + } + else { + i = item_cnt; + } + + if(i > 0) { + s = values[i - 1]; + if(s) { + str_copy(&config.update.dev, values[i - 1]); + *dev = config.update.dev; + } + else { + str_copy(&buf, NULL); + i = dia_input2(input_title, &buf, 30, 0); + if(!i) { + if(util_check_exist(long_dev(buf)) == 'b') { + str_copy(&config.update.dev, short_dev(buf)); + *dev = config.update.dev; + } + else { + dia_message("Invalid device name.", MSGTYPE_ERROR); + } + } + else { + err = 1; + } + } + } + else { + err = 1; + } + + for(i = 0; i < item_cnt; i++) { free(items[i]); free(values[i]); } + free(items); + free(values); + + free(buf); + + hd_free_hd_data(hd_data); + + free(hd_data); + + // fprintf(stderr, "dud dev = %s\n", *dev); + + return err; +} + + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-4.2.0/util.h new/linuxrc-4.2.2/util.h --- old/linuxrc-4.2.0/util.h 2013-11-18 14:06:40.000000000 +0100 +++ new/linuxrc-4.2.2/util.h 2013-12-03 11:41:22.000000000 +0100 @@ -145,4 +145,6 @@ void util_run_script(char *name); void util_plymouth_off(void); +int util_choose_disk_device(char **dev, int type, char *list_title, char *input_title); + -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
