Changeset 1264 in MondoRescue
- Timestamp:
- Mar 24, 2007, 1:48:55 AM (17 years ago)
- Location:
- branches/stable/mondo/src
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-filelist.c
r1259 r1264 1359 1359 "grep -Fv \"%s\" %s > %s.new 2> /dev/null", dir, 1360 1360 g_skeleton_filelist, g_skeleton_filelist); 1361 // mr_msg(0, "fsm = %s", find_skeleton_marker);1362 1361 if (!system(find_skeleton_marker)) { 1363 1362 percentage = (int) (skeleton_lino * 100 / g_skeleton_entries); 1364 1363 skeleton_lino++; 1365 // mr_msg(5, "Found %s", dir);1366 // mr_msg(2, "Incrementing skeleton_lino; now %ld/%ld (%d%%)", skeleton_lino, g_skeleton_entries, percentage);1367 1364 sprintf(find_skeleton_marker, "mv -f %s.new %s", 1368 1365 g_skeleton_filelist, g_skeleton_filelist); 1369 // mr_msg(6, "fsm = %s", find_skeleton_marker);1370 1366 run_program_and_log_output(find_skeleton_marker, 8); 1371 1367 time(&this_time); … … 1386 1382 depth++; 1387 1383 1388 // mr_msg(0, "Cataloguing %s", dir);1389 1384 if (sth[0] == ' ') { 1390 1385 skip_these = sth; … … 1428 1423 counter = 0; 1429 1424 uberctr++; 1425 #ifndef _XWIN 1430 1426 mr_asprintf(&strtmp, " %c ", 1431 1427 special_dot_char(uberctr)); 1432 #ifndef _XWIN1433 1428 if (!g_text_mode) { 1434 1429 newtDrawRootText(77, g_noof_rows - 3, 1435 1430 strtmp); 1436 mr_free(strtmp);1437 1431 newtRefresh(); 1438 1432 } 1433 mr_free(strtmp); 1439 1434 #endif 1440 1435 } -
branches/stable/mondo/src/common/newt-specific.c
r1251 r1264 21 21 #include "mr_msg.h" 22 22 #include "mr_str.h" 23 #include "mr_err.h" 23 24 24 25 #include "mondostructures.h" … … 398 399 printf("Type 'less %s' to see the output log\n", MONDO_LOGFILE); 399 400 free_libmondo_global_strings(); 400 exit(signal_code);401 mr_exit(signal_code, "Execution run ended"); 401 402 } 402 403 -
branches/stable/mondo/src/include/mr_conf.h
r1256 r1264 79 79 }; 80 80 81 /* mondorestore structure storing conf info 82 * each field of the configuration file should have an entry here 83 */ 84 struct mr_rs_conf { 85 /* Default media size */ 86 int media_size; 87 /* Default device of media */ 88 char *media_device; 89 /* Is the CD tray manual ? */ 90 bool manual_tray; 91 /* Default log level */ 92 int log_level; 93 /* default prefix for ISO names */ 94 char *prefix; 95 /* External tape blocksize */ 96 int external_tape_blocksize; 97 /* Internal tape blocksize */ 98 int internal_tape_blocksize; 99 /* Size in MB of the slices for biggiefiles */ 100 int slice_size; 101 /* Boot loader to use */ 102 char *boot_loader; 103 /* Differential backup ? */ 104 bool differential; 105 /* Default compression tool */ 106 char *compression_tool; 107 /* Which mode should be activated by default*/ 108 char *ui_mode; 109 /* Activate automatic restore ? */ 110 bool automatic_restore; 111 /* Images creation dir */ 112 char *images_dir; 113 }; 114 81 115 /* functions (public methods) */ 82 116 -
branches/stable/mondo/src/include/my-stuff.h
r1166 r1264 32 32 #include "mr_mem.h" 33 33 #include "mr_msg.h" 34 35 #if !defined(bool) && !defined(__cplusplus) 36 /** 37 * Create the illusion of a Boolean type. 38 */ 39 #define bool unsigned char 40 #define TRUE 1 41 #define FALSE 0 42 #endif 34 #include "mr_types.h" 43 35 44 36 #ifdef HAVE_CONFIG_H -
branches/stable/mondo/src/lib/mr_conf.c
r1256 r1264 17 17 #include <string.h> 18 18 19 #include "mr_types.h" 19 20 #include "mr_msg.h" 20 21 #include "mr_mem.h" … … 278 279 279 280 /*removes all comments from the buffer*/ 280 static void mr_conf_remove_comments( ) {281 static void mr_conf_remove_comments(void) { 281 282 char *tmp_buf; /*temporary buffer without comments */ 282 283 size_t length /*initial length */ ; -
branches/stable/mondo/src/lib/mr_err.c
r1256 r1264 19 19 #include "mr_msg.h" 20 20 21 /* This should be a pointer to func setup by the main function */ 22 /* Highly incomplete function for the moment */ 23 static void mr_cleanup(void) { 24 /* We have to free all allocated memory */ 25 /* We have to remove all temporary files */ 26 /* We have to unmount what has been mounted */ 27 /* We have to properly end newt */ 28 /* We have to remind people of log files */ 29 mr_msg_close(); 30 } 21 /* Pointer to the right cleanup function provided by each main */ 22 extern void *mr_cleanup(void); 31 23 32 24 /* -
branches/stable/mondo/src/mondoarchive/mondo-cli-EXT.h
r1164 r1264 11 11 flag_val[128][MAX_STR_LEN], 12 12 bool flag_set[128]); 13 extern void help_screen(void);14 13 extern void terminate_daemon(int sig); 15 14 extern void set_signals(int on); -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1191 r1264 964 964 965 965 /** 966 * Print a not-so-helpful help message and exit.967 */968 void help_screen(void)969 {970 mr_msg(1, "Type 'man mondo-archive' for more information\n");971 exit(1);972 }973 974 975 /**976 966 * Terminate Mondo in response to a signal. 977 967 * @param sig The signal number received. -
branches/stable/mondo/src/mondoarchive/mondo-cli.h
r128 r1264 11 11 char flag_val[128][MAX_STR_LEN], 12 12 bool flag_set[128]); 13 void help_screen();14 13 void terminate_daemon(int sig); 15 14 void set_signals(int on); -
branches/stable/mondo/src/mondoarchive/mondoarchive.c
r1256 r1264 27 27 #include "mr_msg.h" 28 28 #include "mr_file.h" 29 #include "mr_err.h" 29 30 #include "mr_conf.h" 30 31 … … 127 128 128 129 /* create the mr_ar_conf structure from mondo's conf file */ 129 static void mr_ar_store_conf(struct mr_ar_conf *mr_c onf) {130 static void mr_ar_store_conf(struct mr_ar_conf *mr_cnf) { 130 131 131 mr_asprintf(mr_conf->iso_creation_cmd, mr_conf_sread("mondo_iso_creation_cmd")); 132 mr_asprintf(mr_conf->iso_creation_options, mr_conf_sread("mondo_iso_creation_options")); 133 mr_asprintf(mr_conf->iso_burning_cmd, mr_conf_sread("mondo_iso_burning_cmd")); 134 mr_asprintf(mr_conf->iso_burning_options, mr_conf_sread("mondo_iso_burning_options")); 135 iso_burning_speed = mr_conf_iread("mondo_iso_burning_speed"); 136 media_size = mr_conf_iread("mondo_media_size"); 137 mr_asprintf(mr_conf->media_device, mr_conf_sread("mondo_media_device")); 138 manual_tray = mr_conf_bread("mondo_manual_tray"); 139 log_level = mr_conf_iread("mondo_log_level"); 140 mr_asprintf(mr_conf->prefix, mr_conf_sread("mondo_prefix")); 141 external_tape_blocksize = mr_conf_iread("mondo_external_tape_blocksize"); 142 internal_tape_blocksize = mr_conf_iread("mondo_internal_tape_blocksize"); 143 slice_size = mr_conf_iread("mondo_slice_size"); 144 mr_asprintf(mr_conf->deplist_file, mr_conf_sread("mondo_deplist_file")); 145 write_boot_floppy = mr_conf_bread("mondo_write_boot_floppy"); 146 create_mindi_cd = mr_conf_bread("mondo_create_mindi_cd"); 147 mr_asprintf(mr_conf->kernel, mr_conf_sread("mondo_kernel")); 148 mr_asprintf(mr_conf->additional_modules, mr_conf_sread("mondo_additional_modules")); 149 mr_asprintf(mr_conf->boot_loader, mr_conf_sread("mondo_boot_loader")); 150 differential = mr_conf_bread("mondo_differential"); 151 mr_asprintf(mr_conf->compression_tool, mr_conf_sread("mondo_compression_tool")); 152 compression_level = mr_conf_iread("mondo_compression_level"); 153 mr_asprintf(mr_conf->exclude_paths, mr_conf_sread("mondo_exclude_paths")); 154 mr_asprintf(mr_conf->include_paths, mr_conf_sread("mondo_include_paths")); 155 mr_asprintf(mr_conf->ui_mode, mr_conf_sread("mondo_ui_mode")); 156 automatic_restore = mr_conf_bread("mondo_automatic_restore"); 157 mr_asprintf(mr_conf->scratch_dir, mr_conf_sread("mondo_scratch_dir")); 158 mr_asprintf(mr_conf->tmp_dir, mr_conf_sread("mondo_tmp_dir")); 159 mr_asprintf(mr_conf->images_dir, mr_conf_sread("mondo_images_dir")); 132 mr_asprintf(&mr_cnf->iso_creation_cmd, mr_conf_sread("mondo_iso_creation_cmd")); 133 mr_asprintf(&mr_cnf->iso_creation_options, mr_conf_sread("mondo_iso_creation_options")); 134 mr_asprintf(&mr_cnf->iso_burning_cmd, mr_conf_sread("mondo_iso_burning_cmd")); 135 mr_asprintf(&mr_cnf->iso_burning_options, mr_conf_sread("mondo_iso_burning_options")); 136 mr_cnf->iso_burning_speed = mr_conf_iread("mondo_iso_burning_speed"); 137 mr_cnf->media_size = mr_conf_iread("mondo_media_size"); 138 mr_asprintf(&mr_cnf->media_device, mr_conf_sread("mondo_media_device")); 139 mr_cnf->manual_tray = mr_conf_bread("mondo_manual_tray"); 140 mr_cnf->log_level = mr_conf_iread("mondo_log_level"); 141 mr_asprintf(&mr_cnf->prefix, mr_conf_sread("mondo_prefix")); 142 mr_cnf->external_tape_blocksize = mr_conf_iread("mondo_external_tape_blocksize"); 143 mr_cnf->internal_tape_blocksize = mr_conf_iread("mondo_internal_tape_blocksize"); 144 mr_cnf->slice_size = mr_conf_iread("mondo_slice_size"); 145 mr_asprintf(&mr_cnf->deplist_file, mr_conf_sread("mondo_deplist_file")); 146 mr_cnf->write_boot_floppy = mr_conf_bread("mondo_write_boot_floppy"); 147 mr_cnf->create_mindi_cd = mr_conf_bread("mondo_create_mindi_cd"); 148 mr_asprintf(&mr_cnf->kernel, mr_conf_sread("mondo_kernel")); 149 mr_asprintf(&mr_cnf->additional_modules, mr_conf_sread("mondo_additional_modules")); 150 mr_asprintf(&mr_cnf->boot_loader, mr_conf_sread("mondo_boot_loader")); 151 mr_cnf->differential = mr_conf_bread("mondo_differential"); 152 mr_asprintf(&mr_cnf->compression_tool, mr_conf_sread("mondo_compression_tool")); 153 mr_cnf->compression_level = mr_conf_iread("mondo_compression_level"); 154 mr_asprintf(&mr_cnf->exclude_paths, mr_conf_sread("mondo_exclude_paths")); 155 mr_asprintf(&mr_cnf->include_paths, mr_conf_sread("mondo_include_paths")); 156 mr_asprintf(&mr_cnf->ui_mode, mr_conf_sread("mondo_ui_mode")); 157 mr_cnf->automatic_restore = mr_conf_bread("mondo_automatic_restore"); 158 mr_asprintf(&mr_cnf->scratch_dir, mr_conf_sread("mondo_scratch_dir")); 159 mr_asprintf(&mr_cnf->tmp_dir, mr_conf_sread("mondo_tmp_dir")); 160 mr_asprintf(&mr_cnf->images_dir, mr_conf_sread("mondo_images_dir")); 161 mr_msg(5, "Directory for images is %s", mr_cnf->images_dir); 162 } 163 164 /* destroy the mr_ar_conf structure's content */ 165 static void mr_ar_clean_conf(struct mr_ar_conf *mr_cnf) { 166 167 if (mr_cnf == NULL) { 168 return; 169 } 170 mr_free(mr_cnf->iso_creation_cmd); 171 mr_free(mr_cnf->iso_creation_options); 172 mr_free(mr_cnf->iso_burning_cmd); 173 mr_free(mr_cnf->iso_burning_options); 174 mr_free(mr_cnf->media_device); 175 mr_free(mr_cnf->prefix); 176 mr_free(mr_cnf->deplist_file); 177 mr_free(mr_cnf->kernel); 178 mr_free(mr_cnf->additional_modules); 179 mr_free(mr_cnf->boot_loader); 180 mr_free(mr_cnf->compression_tool); 181 mr_free(mr_cnf->exclude_paths); 182 mr_free(mr_cnf->include_paths); 183 mr_free(mr_cnf->ui_mode); 184 mr_free(mr_cnf->scratch_dir); 185 mr_free(mr_cnf->tmp_dir); 186 mr_free(mr_cnf->images_dir); 187 } 188 189 /* Create the pointer to the function called in mr_exit */ 190 void (*mr_cleanup)(void) = NULL; 191 192 /* Cleanup all memory allocated in various structures */ 193 void mr_ar_cleanup(void) { 194 /* Highly incomplete function for the moment */ 195 /* We have to free all allocated memory */ 196 mr_ar_clean_conf(&mr_conf); 197 /* We have to remove all temporary files */ 198 /* We have to unmount what has been mounted */ 199 /* We have to properly end newt */ 200 /* We have to remind people of log files */ 201 202 mr_msg_close(); 160 203 } 161 204 … … 184 227 printf(_("Initializing...")); 185 228 229 /* Reference the right cleanup function for mr_exit */ 230 mr_cleanup = mr_ar_cleanup; 231 186 232 /* initialize log file with time stamp */ 187 233 /* We start with a loglevel of 4 - Adapted later on */ … … 484 530 } else { 485 531 printf(_("See %s for details of backup run.\n"), MONDO_LOGFILE); 486 exit(retval);532 mr_exit(retval, NULL); 487 533 } 488 534 -
branches/stable/mondo/src/mondorestore/mondo-prep.c
r1252 r1264 520 520 /** buffers ***********************************************************/ 521 521 char *devices = NULL; 522 char *strtmp = NULL;523 522 char *level = NULL; 524 523 char *program = NULL; … … 624 623 char *program2 = NULL; 625 624 char *tmp = NULL; 626 char *tmp1 = NULL;627 625 #ifdef __FreeBSD__ 628 626 char *line = NULL; … … 1389 1387 char *format = NULL; 1390 1388 char *tmp = NULL; 1391 char *tmp1 = NULL;1392 1389 1393 1390 /** end *************************************************************/ -
branches/stable/mondo/src/mondorestore/mondorestore.c
r1251 r1264 19 19 #include "mr_msg.h" 20 20 #include "mr_str.h" 21 #include "mr_err.h" 21 22 22 23 #include "mondostructures.h" … … 129 130 extern int copy_from_src_to_dest(FILE * f_orig, FILE * f_archived, 130 131 char direction); 132 133 struct mr_rs_conf mr_conf; 134 135 /* destroy the mr_rs_conf structure's content */ 136 static void mr_rs_clean_conf(struct mr_rs_conf *mr_cnf) { 137 138 if (mr_cnf == NULL) { 139 return; 140 } 141 mr_free(&mr_cnf->media_device); 142 mr_free(&mr_cnf->prefix); 143 mr_free(&mr_cnf->boot_loader); 144 mr_free(&mr_cnf->compression_tool); 145 mr_free(&mr_cnf->ui_mode); 146 mr_free(&mr_cnf->images_dir); 147 } 148 149 /* Create the pointer to the function called in mr_exit */ 150 void (*mr_cleanup)(void) = NULL; 151 152 /* Cleanup all memory allocated in various structures */ 153 void mr_rs_cleanup(void) { 154 /* Highly incomplete function for the moment */ 155 /* We have to free all allocated memory */ 156 /* Not allocated yet 157 mr_rs_clean_conf(&mr_conf); 158 */ 159 /* We have to remove all temporary files */ 160 /* We have to unmount what has been mounted */ 161 /* We have to properly end newt */ 162 /* We have to remind people of log files */ 163 164 mr_msg_close(); 165 } 131 166 132 167 /************************************************************************** … … 954 989 int res = 0; 955 990 int old_loglevel; 956 char *sz_msg = NULL;957 991 struct s_node *node = NULL; 958 992 … … 1710 1744 1711 1745 /** malloc add ***/ 1712 char *tmp = NULL;1713 1746 char *command = NULL; 1714 1747 char *afio_fname = NULL; … … 2754 2787 #endif 2755 2788 2789 /* Reference the right cleanup function for mr_exit */ 2790 mr_cleanup = mr_rs_cleanup; 2791 2756 2792 if (getuid() != 0) { 2757 2793 fprintf(stderr, _("Please run as root.\n")); 2758 exit(127);2794 mr_exit(127, NULL); 2759 2795 } 2760 2796 … … 3205 3241 unlink("/tmp/filelist.full.gz"); 3206 3242 3207 exit(retval);3243 mr_exit(retval, NULL); 3208 3244 } 3209 3245
Note:
See TracChangeset
for help on using the changeset viewer.