Changeset 3879 in MondoRescue for branches/3.3/mondo/src/mondorestore/mondo-rstr-compare.c
- Timestamp:
- Mar 9, 2024, 3:10:04 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/mondorestore/mondo-rstr-compare.c
r3875 r3879 7 7 #include "mr_mem.h" 8 8 #include "mr_file.h" 9 #include "../common/mondostructures.h" 10 #include "../common/libmondo.h" 11 //#include "../../config.h" 12 #include "mr-externs.h" 13 #include "mondo-rstr-compare.h" 14 #include "mondorestore-EXT.h" 9 #include "mr_sys.h" 10 #include "mondostructures.h" 15 11 #include "mondo-rstr-tools-EXT.h" 12 #include "libmondo-string-EXT.h" 13 #include "libmondo-verify-EXT.h" 14 #include "libmondo-files-EXT.h" 15 #include "libmondo-tools-EXT.h" 16 #include "libmondo-fork-EXT.h" 17 #include "libmondo-devices-EXT.h" 18 #include "libmondo-string-EXT.h" 19 #include "libmondo-mountlist-EXT.h" 20 #include "libmondo-raid-EXT.h" 21 #include "newt-specific-EXT.h" 16 22 17 23 extern char *MONDO_LOGFILE; … … 21 27 22 28 extern char *g_mountlist_fname; 29 extern int g_current_media_number; 30 extern bool g_text_mode; 31 extern int g_currentY; 32 extern long g_current_progress; 33 extern char *g_mondo_cfg_file; 34 35 // in mondo-rstr-newt.c 36 extern int edit_mountlist(char *, struct mountlist_itself *, struct raidlist_itself *); 23 37 24 38 //static char cvsid[] = "$Id$"; … … 63 77 64 78 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { 65 if (does_file_exist( MNT_CDROM "/archives/NOT-THE-LAST")) {79 if (does_file_exist(ARCHIVES_PATH "/NOT-THE-LAST")) { 66 80 insist_on_this_cd_number((++g_current_media_number)); 67 81 } else { … … 368 382 insist_on_this_cd_number(g_current_media_number); 369 383 update_progress_form(progress_str); 370 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);384 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.bz2", current_tarball_number); 371 385 372 386 if (!does_file_exist(tarball_fname)) { 373 387 mr_free(tarball_fname); 374 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);388 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.lzo", current_tarball_number); 375 389 } 376 390 if (!does_file_exist(tarball_fname)) { 377 391 mr_free(tarball_fname); 378 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzma", current_tarball_number);392 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.lzma", current_tarball_number); 379 393 } 380 394 if (!does_file_exist(tarball_fname)) { 381 395 mr_free(tarball_fname); 382 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);396 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.gz", current_tarball_number); 383 397 } 384 398 if (!does_file_exist(tarball_fname)) { 385 399 mr_free(tarball_fname); 386 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);400 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.afio.", current_tarball_number); 387 401 } 388 402 if (!does_file_exist(tarball_fname)) { 389 403 mr_free(tarball_fname); 390 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);404 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.star.bz2", current_tarball_number); 391 405 } 392 406 if (!does_file_exist(tarball_fname)) { 393 407 mr_free(tarball_fname); 394 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);408 mr_asprintf(tarball_fname, ARCHIVES_PATH "/%d.star.", current_tarball_number); 395 409 } 396 410 if (!does_file_exist(tarball_fname)) { 397 if (!does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST") || 398 system("find " MNT_CDROM 399 "/archives/slice* > /dev/null 2> /dev/null") 411 if (!does_file_exist(ARCHIVES_PATH "/NOT-THE-LAST") || 412 system("find " ARCHIVES_PATH "/slice* > /dev/null 2> /dev/null") 400 413 == 0) { 401 414 log_msg(2, "OK, I think I'm done with tarballs..."); … … 492 505 **************************************************************************/ 493 506 507 /** 508 * Compare all data on a tape-based backup. 509 * @param bkpinfo The backup information structure. Field used: @c bkpinfo->restore_path. 510 * @return 0 for success, nonzero for failure. 511 */ 512 /************************************************************************** 513 * F@COMPARE_TO_TAPE() * 514 * compare_to_tape() - gots me?? * 515 * * 516 * returns: int * 517 **************************************************************************/ 518 int compare_to_tape() 519 { 520 int res; 521 char *dir; 522 char *command = NULL; 523 524 assert(bkpinfo != NULL); 525 malloc_string(dir); 526 527 if (getcwd(dir, MAX_STR_LEN)) { 528 // FIXME 529 } 530 if (chdir(bkpinfo->restore_path)) { 531 // FIXME 532 } 533 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path); 534 run_program_and_log_output(command, FALSE); 535 mr_free(command); 536 537 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem"); 538 res = verify_tape_backups(); 539 if (chdir(dir)) { 540 // FIXME 541 } 542 if (res) { 543 mvaddstr_and_log_it(g_currentY++, 74, "Failed."); 544 } else { 545 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 546 } 547 paranoid_free(dir); 548 return (res); 549 } 550 551 /************************************************************************** 552 *END_COMPARE_TO_TAPE * 553 **************************************************************************/ 554 555 556 /** 557 * Compare all data on a cdstream-based backup. 558 * @param bkpinfo The backup information structure. Fields used: 559 * - @c bkpinfo->disaster_recovery 560 * - @c bkpinfo->media_device 561 * - @c bkpinfo->restore_path 562 * @return 0 for success, nonzero for failure. 563 */ 564 int compare_to_cdstream() 565 { 566 int res; 567 568 /** needs malloc **/ 569 char *dir; 570 char *command = NULL; 571 572 assert(bkpinfo != NULL); 573 malloc_string(dir); 574 if (getcwd(dir, MAX_STR_LEN)) { 575 // FIXME 576 } 577 if (chdir(bkpinfo->restore_path)) { 578 // FIXME 579 } 580 581 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path); 582 run_program_and_log_output(command, FALSE); 583 mr_free(command); 584 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem"); 585 586 if (bkpinfo->disaster_recovery 587 && does_file_exist("/tmp/CDROM-LIVES-HERE")) { 588 mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE")); 589 } else { 590 bkpinfo->media_device = find_optical_device(); 591 } 592 res = verify_tape_backups(); 593 if (chdir(dir)) { 594 // FIXME 595 } 596 if (length_of_file(MONDO_CACHE"/changed.txt") > 2 597 && length_of_file(MONDO_CACHE"/changed.files") > 2) { 598 log_msg(0, 599 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives"); 600 log_msg(2, "Calling popup_changelist_from_file()"); 601 popup_changelist_from_file(MONDO_CACHE"/changed.files"); 602 log_msg(2, "Returned from popup_changelist_from_file()"); 603 } 604 605 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 606 paranoid_free(dir); 607 return (res); 608 } 609 610 /************************************************************************** 611 *END_COMPARE_CD_STREAM * 612 **************************************************************************/ 494 613 495 614 … … 620 739 *END_COMPARE_MODE * 621 740 **************************************************************************/ 622 623 /**624 * Compare all data on a cdstream-based backup.625 * @param bkpinfo The backup information structure. Fields used:626 * - @c bkpinfo->disaster_recovery627 * - @c bkpinfo->media_device628 * - @c bkpinfo->restore_path629 * @return 0 for success, nonzero for failure.630 */631 int compare_to_cdstream()632 {633 int res;634 635 /** needs malloc **/636 char *dir;637 char *command = NULL;638 639 assert(bkpinfo != NULL);640 malloc_string(dir);641 if (getcwd(dir, MAX_STR_LEN)) {642 // FIXME643 }644 if (chdir(bkpinfo->restore_path)) {645 // FIXME646 }647 648 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);649 run_program_and_log_output(command, FALSE);650 mr_free(command);651 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");652 653 if (bkpinfo->disaster_recovery654 && does_file_exist("/tmp/CDROM-LIVES-HERE")) {655 mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE"));656 } else {657 bkpinfo->media_device = find_optical_device();658 }659 res = verify_tape_backups();660 if (chdir(dir)) {661 // FIXME662 }663 if (length_of_file(MONDO_CACHE"/changed.txt") > 2664 && length_of_file(MONDO_CACHE"/changed.files") > 2) {665 log_msg(0,666 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives");667 log_msg(2, "Calling popup_changelist_from_file()");668 popup_changelist_from_file(MONDO_CACHE"/changed.files");669 log_msg(2, "Returned from popup_changelist_from_file()");670 }671 672 mvaddstr_and_log_it(g_currentY++, 74, "Done.");673 paranoid_free(dir);674 return (res);675 }676 677 /**************************************************************************678 *END_COMPARE_CD_STREAM *679 **************************************************************************/680 681 682 /**683 * Compare all data on a tape-based backup.684 * @param bkpinfo The backup information structure. Field used: @c bkpinfo->restore_path.685 * @return 0 for success, nonzero for failure.686 */687 /**************************************************************************688 * F@COMPARE_TO_TAPE() *689 * compare_to_tape() - gots me?? *690 * *691 * returns: int *692 **************************************************************************/693 int compare_to_tape()694 {695 int res;696 char *dir;697 char *command = NULL;698 699 assert(bkpinfo != NULL);700 malloc_string(dir);701 702 if (getcwd(dir, MAX_STR_LEN)) {703 // FIXME704 }705 if (chdir(bkpinfo->restore_path)) {706 // FIXME707 }708 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);709 run_program_and_log_output(command, FALSE);710 mr_free(command);711 712 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");713 res = verify_tape_backups();714 if (chdir(dir)) {715 // FIXME716 }717 if (res) {718 mvaddstr_and_log_it(g_currentY++, 74, "Failed.");719 } else {720 mvaddstr_and_log_it(g_currentY++, 74, "Done.");721 }722 paranoid_free(dir);723 return (res);724 }725 726 /**************************************************************************727 *END_COMPARE_TO_TAPE *728 **************************************************************************/729 730 741 /* @} - end compareGroup */
Note:
See TracChangeset
for help on using the changeset viewer.