Changeset 2332 in MondoRescue for branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
- Timestamp:
- Aug 18, 2009, 3:33:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c
r2331 r2332 111 111 } 112 112 113 mr_asprintf( &command_ptr, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname_ptr);113 mr_asprintf(command_ptr, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname_ptr); 114 114 log_msg(2, command_ptr); 115 115 i = system(command_ptr); … … 207 207 noof_biggiefiles); 208 208 for (bigfileno = 0; bigfileno < noof_biggiefiles; bigfileno++) { 209 mr_asprintf( &tmp, "Comparing big file #%ld", bigfileno + 1);209 mr_asprintf(tmp, "Comparing big file #%ld", bigfileno + 1); 210 210 log_msg(1, tmp); 211 211 update_progress_form(tmp); … … 251 251 char *tmp = NULL; 252 252 char *archiver_exe = NULL; 253 char *tmp1 = NULL; 253 254 char *filelist_name = NULL; 254 255 char *logfile = NULL; … … 257 258 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE; 258 259 assert_string_is_neither_NULL_nor_zerolength(tarball_fname); 259 mr_asprintf( &filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);260 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number); 260 261 noof_lines = count_lines_in_file(filelist_name); 261 262 mr_free(filelist_name); 262 263 263 264 if (strstr(tarball_fname, ".bz2")) { 264 mr_asprintf( &compressor_exe, "bzip2");265 mr_asprintf(compressor_exe, "bzip2"); 265 266 } else if (strstr(tarball_fname, ".gz")) { 266 mr_asprintf( &compressor_exe, "gzip");267 mr_asprintf(compressor_exe, "gzip"); 267 268 } else if (strstr(tarball_fname, ".lzo")) { 268 mr_asprintf( &compressor_exe, "lzop");269 mr_asprintf(compressor_exe, "lzop"); 269 270 } 270 271 … … 276 277 277 278 if (compressor_exe) { 278 if (!find_home_of_exe(compressor_exe)) { 279 tmp1 = find_home_of_exe(compressor_exe); 280 if (!tmp1) { 281 mr_free(tmp1); 279 282 mr_free(compressor_exe); 280 283 mr_free(archiver_exe); 281 284 fatal_error("(compare_a_tarball) Compression program missing"); 282 285 } 286 mr_free(tmp1); 287 283 288 if (use_star) { 284 289 if (!strcmp(compressor_exe, "bzip2")) { … … 292 297 // afio 293 298 mr_free(compressor_exe); 294 mr_asprintf( &tmp, "%s", compressor_exe);295 mr_asprintf( &compressor_exe, "-P %s -Z", tmp);299 mr_asprintf(tmp, "%s", compressor_exe); 300 mr_asprintf(compressor_exe, "-P %s -Z", tmp); 296 301 mr_free(tmp); 297 302 } … … 303 308 #define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE 304 309 #endif 305 mr_asprintf( &logfile, "/tmp/afio.log.%d", current_tarball_number);310 mr_asprintf(logfile, "/tmp/afio.log.%d", current_tarball_number); 306 311 307 312 if (use_star) { 308 313 // doesn't use compressor_exe 309 mr_asprintf( &command, "%s -diff H=star file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile);310 } else { 311 mr_asprintf( &command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile);314 mr_asprintf(command, "%s -diff H=star file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile); 315 } else { 316 mr_asprintf(command, "%s -r -b %ld -M 16m -c %ld %s %s >> %s 2>> %s", archiver_exe, TAPE_BLOCK_SIZE, BUFSIZE, compressor_exe, tarball_fname, logfile, logfile); 312 317 } 313 318 mr_free(compressor_exe); … … 325 330 326 331 if (length_of_file(logfile) > 5) { 327 mr_asprintf( &command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile);332 mr_asprintf(command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile); 328 333 system(command); 329 334 mr_free(command); … … 365 370 long max_val; 366 371 367 malloc_string(tarball_fname);368 malloc_string(progress_str);369 370 372 assert(bkpinfo != NULL); 371 373 mvaddstr_and_log_it(g_currentY, 0, "Comparing archives"); … … 374 376 mr_free(tmp); 375 377 376 paranoid_free(tmp);377 378 378 mds = media_descriptor_string(bkpinfo->backup_media_type); 379 mr_asprintf( &progress_str, "Comparing with %s #%d ", mds, g_current_media_number);379 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number); 380 380 381 381 open_progress_form("Comparing files", … … 389 389 insist_on_this_cd_number(g_current_media_number); 390 390 update_progress_form(progress_str); 391 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);391 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number); 392 392 393 393 if (!does_file_exist(tarball_fname)) { 394 394 mr_free(tarball_fname); 395 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);395 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number); 396 396 } 397 397 if (!does_file_exist(tarball_fname)) { 398 398 mr_free(tarball_fname); 399 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);399 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number); 400 400 } 401 401 if (!does_file_exist(tarball_fname)) { 402 402 mr_free(tarball_fname); 403 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);403 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number); 404 404 } 405 405 if (!does_file_exist(tarball_fname)) { 406 406 mr_free(tarball_fname); 407 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);407 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number); 408 408 } 409 409 if (!does_file_exist(tarball_fname)) { 410 410 mr_free(tarball_fname); 411 mr_asprintf( &tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);411 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number); 412 412 } 413 413 if (!does_file_exist(tarball_fname)) { … … 424 424 425 425 mr_free(progress_str); 426 mr_asprintf( &progress_str, "Comparing with %s #%d ", mds, g_current_media_number);426 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number); 427 427 log_to_screen(progress_str); 428 428 } else { … … 490 490 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt"); 491 491 if (noof_changed_files) { 492 mr_asprintf( &tmp, "%ld files do not match the backup ", noof_changed_files);492 mr_asprintf(tmp, "%ld files do not match the backup ", noof_changed_files); 493 493 log_to_screen(tmp); 494 494 mr_free(tmp); 495 495 496 mr_asprintf( &command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);496 mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE); 497 497 paranoid_system(command); 498 498 mr_free(command); 499 499 } else { 500 mr_asprintf( &tmp, "All files match the backup ");500 mr_asprintf(tmp, "All files match the backup "); 501 501 mvaddstr_and_log_it(g_currentY++, 0, tmp); 502 502 log_to_screen(tmp); … … 563 563 if (g_text_mode) { 564 564 save_mountlist_to_disk(mountlist, g_mountlist_fname); 565 mr_asprintf( &tmp, "%s %s", find_my_editor(), g_mountlist_fname);565 mr_asprintf(tmp, "%s %s", find_my_editor(), g_mountlist_fname); 566 566 res = system(tmp); 567 567 mr_free(tmp); … … 612 612 } else { 613 613 q = count_lines_in_file(MONDO_CACHE"/changed.files"); 614 mr_asprintf( &tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : "");614 mr_asprintf(tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : ""); 615 615 mvaddstr_and_log_it(g_currentY++, 0, tmp); 616 616 log_to_screen(tmp); 617 617 mr_free(tmp); 618 618 619 mr_asprintf( &tmp, "Type 'less /tmp/changed.files' for a list of non-matching files");619 mr_asprintf(tmp, "Type 'less /tmp/changed.files' for a list of non-matching files"); 620 620 mvaddstr_and_log_it(g_currentY++, 0, tmp); 621 621 log_to_screen(tmp); … … 723 723 getcwd(dir, MAX_STR_LEN); 724 724 chdir(bkpinfo->restore_path); 725 mr_asprintf( &command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);725 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path); 726 726 run_program_and_log_output(command, FALSE); 727 727 mr_free(command);
Note:
See TracChangeset
for help on using the changeset viewer.