Changeset 3871 in MondoRescue
- Timestamp:
- Mar 7, 2024, 6:06:33 PM (12 months ago)
- Location:
- branches/3.3/mondo/src
- Files:
-
- 1 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-filelist.c
r3868 r3871 10 10 #include "my-stuff.h" 11 11 #include "mondostructures.h" 12 #include "lib-common-externs.h" 12 13 13 #include "libmondo-string-EXT.h" 14 14 #include "libmondo-files-EXT.h" … … 675 675 676 676 if ((tmp = find_home_of_exe("setfacl")) != NULL) { 677 i = set_EXAT_list(masklist, facl_fname, tmp)677 i = set_EXAT_list(masklist, acl_fname, tmp); 678 678 mr_free(tmp); 679 679 } else { -
branches/3.3/mondo/src/common/libmondo-files.c
r3867 r3871 13 13 #include "mr_file.h" 14 14 #include "mondostructures.h" 15 #include "lib-common-externs.h" 15 16 16 #include "libmondo-tools-EXT.h" 17 17 #include "libmondo-gui-EXT.h" … … 19 19 #include "libmondo-fork-EXT.h" 20 20 #include "libmondo-string-EXT.h" 21 #include "libmondo-newt-specific-EXT.h" 21 22 22 23 /*@unused@*/ … … 24 25 25 26 extern char err_log_lines[NOOF_ERR_LINES][MAX_STR_LEN]; 26 27 extern char *mr_popup_and_get_string(const char *, const char *, const char *);28 27 29 28 extern int g_currentY; -
branches/3.3/mondo/src/common/libmondo-fork.c
r3866 r3871 15 15 #include "libmondo-files-EXT.h" 16 16 #include "libmondo-tools-EXT.h" 17 #include "lib-common-externs.h" 17 18 18 19 19 /*@unused@*/ … … 87 87 #define MONDO_POPMSG "Your machine will not retract the CD tray automatically. Please call mondoarchive with the -m (manual CD tray) flag." 88 88 89 90 int run_external_binary_with_percentage_indicator_NEW(char *tt, char *cmd) { 91 92 /*@ int *************************************************************** */ 93 int res = 0; 94 int percentage = 0; 95 int maxpc = 100; 96 int pcno = 0; 97 int counter = 0; 98 99 /*@ buffers *********************************************************** */ 100 char *command = NULL; 101 /*@ pointers ********************************************************** */ 102 static int chldres = 0; 103 int *pchild_result; 104 pthread_t childthread; 105 106 pchild_result = &chldres; 107 assert_string_is_neither_NULL_nor_zerolength(cmd); 108 assert_string_is_neither_NULL_nor_zerolength(tt); 109 *pchild_result = 999; 110 111 mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE); 112 log_msg(3, "command = '%s'", command); 113 if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) { 114 fatal_error("Unable to create an archival thread"); 115 } 116 117 log_msg(8, "Parent running"); 118 open_evalcall_form(tt); 119 120 for (sleep(1); command[0] != '\0'; sleep(1)) { 121 if (strstr(cmd,"mindi") != NULL) { 122 pcno = grab_percentage_from_last_line_of_file(MINDI_RUNFILE); 123 } else { 124 pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE); 125 } 126 if (pcno < 0 || pcno > 100) { 127 log_msg(8, "Weird pc# %d", pcno); 128 continue; 129 } 130 percentage = pcno * 100 / maxpc; 131 if (counter++ >= 5) { 132 counter = 0; 133 log_file_end_to_screen(MONDO_LOGFILE, ""); 134 } 135 update_evalcall_form(percentage); 136 } 137 mr_free(command); 138 139 log_file_end_to_screen(MONDO_LOGFILE, ""); 140 close_evalcall_form(); 141 pthread_join(childthread, (void *) (&pchild_result)); 142 if (pchild_result) { 143 res = *pchild_result; 144 } else { 145 res = 666; 146 } 147 log_msg(3, "Parent res = %d", res); 148 return (res); 149 } 150 151 89 152 /** 90 153 * Call mkisofs to create an ISO image. … … 645 708 646 709 647 648 int run_external_binary_with_percentage_indicator_NEW(char *tt, char *cmd) {649 650 /*@ int *************************************************************** */651 int res = 0;652 int percentage = 0;653 int maxpc = 100;654 int pcno = 0;655 int counter = 0;656 657 /*@ buffers *********************************************************** */658 char *command = NULL;659 /*@ pointers ********************************************************** */660 static int chldres = 0;661 int *pchild_result;662 pthread_t childthread;663 664 pchild_result = &chldres;665 assert_string_is_neither_NULL_nor_zerolength(cmd);666 assert_string_is_neither_NULL_nor_zerolength(tt);667 *pchild_result = 999;668 669 mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);670 log_msg(3, "command = '%s'", command);671 if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) {672 fatal_error("Unable to create an archival thread");673 }674 675 log_msg(8, "Parent running");676 open_evalcall_form(tt);677 678 for (sleep(1); command[0] != '\0'; sleep(1)) {679 if (strstr(cmd,"mindi") != NULL) {680 pcno = grab_percentage_from_last_line_of_file(MINDI_RUNFILE);681 } else {682 pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);683 }684 if (pcno < 0 || pcno > 100) {685 log_msg(8, "Weird pc# %d", pcno);686 continue;687 }688 percentage = pcno * 100 / maxpc;689 if (counter++ >= 5) {690 counter = 0;691 log_file_end_to_screen(MONDO_LOGFILE, "");692 }693 update_evalcall_form(percentage);694 }695 mr_free(command);696 697 log_file_end_to_screen(MONDO_LOGFILE, "");698 close_evalcall_form();699 pthread_join(childthread, (void *) (&pchild_result));700 if (pchild_result) {701 res = *pchild_result;702 } else {703 res = 666;704 }705 log_msg(3, "Parent res = %d", res);706 return (res);707 }708 709 710 710 /** 711 711 * Feed @p input_fifo through ntfsclone (restore) to @p output_device. -
branches/3.3/mondo/src/common/libmondo-raid.c
r3868 r3871 16 16 #include "libmondo-string-EXT.h" 17 17 #include "libmondo-fork-EXT.h" 18 #include "lib-common-externs.h" 18 19 19 #include "mr_mem.h" 20 20 #include "mr_str.h" -
branches/3.3/mondo/src/common/libmondo-string-EXT.h
r3859 r3871 34 34 35 35 extern char *media_descriptor_string(t_bkptype); 36 37 extern char *mr_center_string(char *in, int width); 38 -
branches/3.3/mondo/src/common/libmondo-string.c
r3867 r3871 11 11 #include "mr_str.h" 12 12 #include "mondostructures.h" 13 #include "lib-common-externs.h" 13 14 14 #include "libmondo-files-EXT.h" 15 15 #include "libmondo-gui-EXT.h" -
branches/3.3/mondo/src/common/libmondo-tools.c
r3867 r3871 13 13 #include "mr_sys.h" 14 14 #include "mondostructures.h" 15 #include "lib-common-externs.h" 15 16 16 #include "libmondo-gui-EXT.h" 17 17 #include "libmondo-files-EXT.h" … … 236 236 #endif 237 237 log_msg(1, "g_kernel_version = %f", d); 238 return (d); 238 239 if (g_kernel_version < 2.6) { 240 fatal_error("Please use MondoRescue < 3.3.0 to support that old kernel or upgrade your distribution :-)"); 241 } 242 return(d); 239 243 } 240 244 -
branches/3.3/mondo/src/common/libmondo-verify.c
r3868 r3871 19 19 #include "libmondo-devices-EXT.h" 20 20 #include "libmondo-tools-EXT.h" 21 #include "lib-common-externs.h" 21 22 22 23 23 /*@unused@*/ -
branches/3.3/mondo/src/common/newt-specific-EXT.h
r3864 r3871 15 15 extern void log_to_screen(const char *fmt, ...); 16 16 extern void popup_and_OK(const char *prompt); 17 extern bool popup_and_get_string(char *title, char *b, char *output, 18 17 extern bool popup_and_get_string(char *title, char *b, char *output, int maxsize); 18 extern char *mr_popup_and_get_string(char *title, char *b, char *output, int maxsize); 19 19 extern bool popup_with_buttons(char *p, char *button1, char *button2); 20 20 extern void refresh_log_screen(); -
branches/3.3/mondo/src/common/newt-specific.c
r3869 r3871 28 28 #include "libmondo-fork-EXT.h" 29 29 #include "libmondo-gui-EXT.h" 30 #include "lib-common-externs.h" 30 31 31 32 32 extern char *MONDO_LOGFILE; 33 33 34 34 extern struct s_bkpinfo *bkpinfo; 35 36 extern char *mr_center_string(char *in, int width);37 35 38 36 /*@unused@*/ … … 639 637 640 638 /** 639 * Update the progress form's complete blurb and show @p g_current_progress. 640 * @param blurb1 The first line of the blurb. Use @p g_blurb_str_1 to keep it unchanged. 641 * @param blurb2 The second line of the blurb. Use @p g_blurb_str_3 (no, that's not a typo) to keep it the same. 642 * @param blurb3 The third line of the blurb. Use @p g_blurb_str_2 (no, that's not a typo either) to keep it the same. 643 */ 644 void update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) { 645 646 /*@ long ***************************************************** */ 647 long current_time = 0L; 648 long time_taken = 0L; 649 long time_remaining = 0L; 650 long time_total_est = 0L; 651 652 char *blurb1_str = NULL; 653 char *blurb2_str = NULL; 654 char *blurb3_str = NULL; 655 656 /*@ int ******************************************************* */ 657 int percentage = 0; 658 int i = 0; 659 660 /*@ buffers *************************************************** */ 661 char *percentline_str = NULL; 662 char *timeline_str = NULL; 663 char *taskprogress = NULL; 664 665 if (!g_text_mode) { 666 assert(blurb1 != NULL); 667 assert(blurb2 != NULL); 668 assert(blurb3 != NULL); 669 assert(g_timeline != NULL); 670 } 671 672 current_time = get_time(); 673 time_taken = current_time - g_start_time; 674 if (g_maximum_progress == 0) { 675 percentage = 0; 676 } else { 677 if (g_current_progress > g_maximum_progress) { 678 log_msg(0, "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld", blurb1, blurb2, blurb3, g_current_progress, g_maximum_progress); 679 g_current_progress = g_maximum_progress; 680 } 681 percentage = (int) ((g_current_progress * 100L) / g_maximum_progress); 682 } 683 if (percentage < 1) { 684 percentage = 1; 685 } 686 if (percentage > 100) { 687 percentage = 100; 688 } 689 if (g_current_progress) { 690 time_total_est = time_taken * (long) g_maximum_progress / (long) g_current_progress; 691 time_remaining = time_total_est - time_taken; 692 } else { 693 time_remaining = 0L; 694 } 695 g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27; 696 if (g_text_mode) { 697 printf("---progress-form---1--- %s\n", blurb1); 698 printf("---progress-form---2--- %s\n", blurb2); 699 printf("---progress-form---3--- %s\n", blurb3); 700 printf("---progress-form---E---\n"); 701 mr_asprintf(taskprogress, "TASK: ["); 702 for (i = 0; i < percentage; i += 5) { 703 mr_strcat(taskprogress, "*"); 704 } 705 for (; i < 100; i += 5) { 706 mr_strcat(taskprogress, "."); 707 } 708 if (percentage > 100) { 709 log_msg(2, "percentage = %d", percentage); 710 } 711 mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60); 712 printf("---progress-form---4--- %s\n", taskprogress); 713 paranoid_free(taskprogress); 714 } else { 715 mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60); 716 mr_asprintf(percentline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage); 717 718 blurb1_str = mr_center_string(blurb1, 54); 719 blurb2_str = mr_center_string(blurb2, 54); 720 blurb3_str = mr_center_string(blurb3, 54); 721 if (g_blurb1) { 722 newtLabelSetText(g_blurb1, blurb1_str); 723 } 724 if (g_blurb2) { 725 // Not a typo but ridiculous ! 726 newtLabelSetText(g_blurb2, blurb3_str); 727 } 728 if (g_blurb3) { 729 // Not a typo but ridiculous ! 730 newtLabelSetText(g_blurb3, blurb2_str); 731 } 732 newtScaleSet(g_scale, (unsigned long long) g_current_progress); 733 if ((percentage >= 2) && (g_timeline)) { 734 newtLabelSetText(g_timeline, timeline_str); 735 } 736 mr_free(timeline_str); 737 738 if (g_percentline) { 739 newtLabelSetText(g_percentline, percentline_str); 740 } 741 mr_free(percentline_str); 742 mr_free(blurb1_str); 743 mr_free(blurb2_str); 744 mr_free(blurb3_str); 745 746 newtDrawForm(g_progressForm); 747 newtRefresh(); 748 } 749 } 750 751 752 /** 641 753 * Open a progress form with title @p title. 642 754 * @param title The title to use for the progress form (will be put in the title bar on Newt). … … 1109 1221 update_progress_form_full(g_blurb_str_1, g_blurb_str_2, g_blurb_str_3); 1110 1222 } 1111 1112 1113 /**1114 * Update the progress form's complete blurb and show @p g_current_progress.1115 * @param blurb1 The first line of the blurb. Use @p g_blurb_str_1 to keep it unchanged.1116 * @param blurb2 The second line of the blurb. Use @p g_blurb_str_3 (no, that's not a typo) to keep it the same.1117 * @param blurb3 The third line of the blurb. Use @p g_blurb_str_2 (no, that's not a typo either) to keep it the same.1118 */1119 void update_progress_form_full(char *blurb1, char *blurb2, char *blurb3) {1120 1121 /*@ long ***************************************************** */1122 long current_time = 0L;1123 long time_taken = 0L;1124 long time_remaining = 0L;1125 long time_total_est = 0L;1126 1127 char *blurb1_str = NULL;1128 char *blurb2_str = NULL;1129 char *blurb3_str = NULL;1130 1131 /*@ int ******************************************************* */1132 int percentage = 0;1133 int i = 0;1134 1135 /*@ buffers *************************************************** */1136 char *percentline_str = NULL;1137 char *timeline_str = NULL;1138 char *taskprogress = NULL;1139 1140 if (!g_text_mode) {1141 assert(blurb1 != NULL);1142 assert(blurb2 != NULL);1143 assert(blurb3 != NULL);1144 assert(g_timeline != NULL);1145 }1146 1147 current_time = get_time();1148 time_taken = current_time - g_start_time;1149 if (g_maximum_progress == 0) {1150 percentage = 0;1151 } else {1152 if (g_current_progress > g_maximum_progress) {1153 log_msg(0, "update_progress_form_full(%s,%s,%s) --- g_current_progress=%ld; g_maximum_progress=%ld", blurb1, blurb2, blurb3, g_current_progress, g_maximum_progress);1154 g_current_progress = g_maximum_progress;1155 }1156 percentage = (int) ((g_current_progress * 100L) / g_maximum_progress);1157 }1158 if (percentage < 1) {1159 percentage = 1;1160 }1161 if (percentage > 100) {1162 percentage = 100;1163 }1164 if (g_current_progress) {1165 time_total_est = time_taken * (long) g_maximum_progress / (long) g_current_progress;1166 time_remaining = time_total_est - time_taken;1167 } else {1168 time_remaining = 0L;1169 }1170 g_mysterious_dot_counter = (g_mysterious_dot_counter + 1) % 27;1171 if (g_text_mode) {1172 printf("---progress-form---1--- %s\n", blurb1);1173 printf("---progress-form---2--- %s\n", blurb2);1174 printf("---progress-form---3--- %s\n", blurb3);1175 printf("---progress-form---E---\n");1176 mr_asprintf(taskprogress, "TASK: [");1177 for (i = 0; i < percentage; i += 5) {1178 mr_strcat(taskprogress, "*");1179 }1180 for (; i < 100; i += 5) {1181 mr_strcat(taskprogress, ".");1182 }1183 if (percentage > 100) {1184 log_msg(2, "percentage = %d", percentage);1185 }1186 mr_strcat(taskprogress, "] %3d%% done; %2ld:%02ld to go", percentage, (long) time_remaining / 60, (long) time_remaining % 60);1187 printf("---progress-form---4--- %s\n", taskprogress);1188 paranoid_free(taskprogress);1189 } else {1190 mr_asprintf(timeline_str, "%2ld:%02ld taken %2ld:%02ld remaining ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);1191 mr_asprintf(percentline_str, " %3d%% done %3d%% to go", percentage, 100 - percentage);1192 1193 blurb1_str = mr_center_string(blurb1, 54);1194 blurb2_str = mr_center_string(blurb2, 54);1195 blurb3_str = mr_center_string(blurb3, 54);1196 if (g_blurb1) {1197 newtLabelSetText(g_blurb1, blurb1_str);1198 }1199 if (g_blurb2) {1200 // Not a typo but ridiculous !1201 newtLabelSetText(g_blurb2, blurb3_str);1202 }1203 if (g_blurb3) {1204 // Not a typo but ridiculous !1205 newtLabelSetText(g_blurb3, blurb2_str);1206 }1207 newtScaleSet(g_scale, (unsigned long long) g_current_progress);1208 if ((percentage >= 2) && (g_timeline)) {1209 newtLabelSetText(g_timeline, timeline_str);1210 }1211 mr_free(timeline_str);1212 1213 if (g_percentline) {1214 newtLabelSetText(g_percentline, percentline_str);1215 }1216 mr_free(percentline_str);1217 mr_free(blurb1_str);1218 mr_free(blurb2_str);1219 mr_free(blurb3_str);1220 1221 newtDrawForm(g_progressForm);1222 newtRefresh();1223 }1224 }1225 1223 1226 1224 -
branches/3.3/mondo/src/mondorestore/mondo-rstr-mountlist.c
r3859 r3871 13 13 #include "mondostructures.h" 14 14 #include "libmondo-mountlist.h" 15 #include "lib-common-externs.h" 15 16 16 #include "libmondo-raid-EXT.h" 17 17 #include "libmondo-devices-EXT.h" -
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c
r3866 r3871 15 15 #include "mondo-rstr-tools.h" 16 16 #include "libmondo-mountlist-EXT.h" 17 #include "libmondo-newt-specific-EXT.h" 17 18 18 19 /** -
branches/3.3/mondo/src/mondorestore/mondorestore.c
r3866 r3871 9 9 **************************************************************************/ 10 10 #include <pthread.h> 11 #include <utime.h> 11 12 #include "my-stuff.h" 12 13 #include "mr_mem.h" … … 20 21 #include "mondo-rstr-tools-EXT.h" 21 22 #include "libmondo-mountlist-EXT.h" 22 #include <utime.h>23 #include "libmondo-newt-specific-EXT.h" 23 24 24 25 extern void wait_until_software_raids_are_prepped(char *, int);
Note:
See TracChangeset
for help on using the changeset viewer.