Changeset 1663 in MondoRescue for branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c
- Timestamp:
- Sep 27, 2007, 12:21:18 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c
r1638 r1663 19 19 extern char *MONDO_LOGFILE; 20 20 21 /* Reference to global bkpinfo */ 22 extern struct s_bkpinfo *bkpinfo; 23 21 24 //static char cvsid[] = "$Id$"; 22 25 … … 34 37 * @note This function uses an MD5 checksum. 35 38 */ 36 int compare_a_biggiefile( struct s_bkpinfo *bkpinfo,long bigfileno)39 int compare_a_biggiefile(long bigfileno) 37 40 { 38 41 … … 58 61 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) { 59 62 if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) { 60 insist_on_this_cd_number( bkpinfo,(++g_current_media_number));63 insist_on_this_cd_number((++g_current_media_number)); 61 64 } else { 62 65 mr_msg(2, "No CD's left. No biggiefiles left. No problem."); … … 133 136 134 137 if (retval) { 135 if (!(fout = fopen( "/tmp/changed.txt", "a"))) {138 if (!(fout = fopen(MINDI_CACHE"/changed.txt", "a"))) { 136 139 fatal_error("Cannot openout changed.txt"); 137 140 } … … 151 154 /** 152 155 * Compare all biggiefiles in the backup. 153 * @param bkpinfo The backup information structure. Used only in compare_a_biggiefile().154 156 * @return 0 for success, nonzero for failure. 155 157 */ 156 int compare_all_biggiefiles( struct s_bkpinfo *bkpinfo)158 int compare_all_biggiefiles() 157 159 { 158 160 int retval = 0; … … 161 163 char *tmp = NULL; 162 164 163 assert(bkpinfo != NULL);164 165 mr_msg(1, "Comparing biggiefiles"); 165 166 … … 187 188 mr_free(tmp); 188 189 189 res = compare_a_biggiefile(b kpinfo, bigfileno);190 res = compare_a_biggiefile(bigfileno); 190 191 retval += res; 191 192 g_current_progress++; … … 303 304 if (length_of_file(logfile) > 5) { 304 305 mr_asprintf(&command, 305 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> /tmp/changed.txt",306 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MINDI_CACHE"/changed.txt", 306 307 logfile); 307 308 system(command); … … 330 331 * @return 0 for success, nonzero for failure. 331 332 */ 332 int compare_all_tarballs( struct s_bkpinfo *bkpinfo)333 int compare_all_tarballs() 333 334 { 334 335 int retval = 0; … … 361 362 362 363 for (;;) { 363 insist_on_this_cd_number( bkpinfo,g_current_media_number);364 insist_on_this_cd_number(g_current_media_number); 364 365 update_progress_form(progress_str); 365 366 mr_asprintf(&tarball_fname, … … 441 442 * @return 0 for success, nonzero for failure. 442 443 */ 443 int compare_to_CD( struct s_bkpinfo *bkpinfo)444 int compare_to_CD() 444 445 { 445 446 /** needs malloc *********/ … … 460 461 chdir(bkpinfo->restore_path); 461 462 getcwd(new, MAX_STR_LEN - 1); 462 insist_on_this_cd_number( bkpinfo,g_current_media_number);463 unlink( "/tmp/changed.txt");464 465 resA = compare_all_tarballs( bkpinfo);466 resB = compare_all_biggiefiles( bkpinfo);463 insist_on_this_cd_number(g_current_media_number); 464 unlink(MINDI_CACHE"/changed.txt"); 465 466 resA = compare_all_tarballs(); 467 resB = compare_all_biggiefiles(); 467 468 chdir(cwd); 468 noof_changed_files = count_lines_in_file( "/tmp/changed.txt");469 noof_changed_files = count_lines_in_file(MINDI_CACHE"/changed.txt"); 469 470 if (noof_changed_files) { 470 471 log_to_screen(_("%ld files do not match the backup "), 471 472 noof_changed_files); 472 mr_asprintf(&command, "cat /tmp/changed.txt >> %s", MONDO_LOGFILE);473 mr_asprintf(&command, "cat "MINDI_CACHE"/changed.txt >> %s", MONDO_LOGFILE); 473 474 paranoid_system(command); 474 475 mr_free(command); … … 501 502 */ 502 503 int 503 compare_mode(struct s_bkpinfo *bkpinfo, 504 struct mountlist_itself *mountlist, 504 compare_mode(struct mountlist_itself *mountlist, 505 505 struct raidlist_itself *raidlist) 506 506 { … … 522 522 assert(raidlist != NULL); 523 523 524 while (get_cfg_file_from_archive( bkpinfo)) {524 while (get_cfg_file_from_archive()) { 525 525 if (!ask_me_yes_or_no 526 526 (_ … … 529 529 fatal_error("Unable to find config file/archives. Aborting."); 530 530 } 531 interactively_obtain_media_parameters_from_user( bkpinfo,FALSE);532 } 533 534 read_cfg_file_into_bkpinfo(g_mondo_cfg_file , bkpinfo);531 interactively_obtain_media_parameters_from_user(FALSE); 532 } 533 534 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 535 535 g_current_media_number = 1; 536 536 mvaddstr_and_log_it(1, 30, _("Comparing Automatically")); … … 544 544 if (bkpinfo->backup_media_type == tape 545 545 || bkpinfo->backup_media_type == udev) { 546 retval += compare_to_tape( bkpinfo);546 retval += compare_to_tape(); 547 547 } else if (bkpinfo->backup_media_type == cdstream) { 548 retval += compare_to_cdstream( bkpinfo);549 } else { 550 retval += compare_to_CD( bkpinfo);548 retval += compare_to_cdstream(); 549 } else { 550 retval += compare_to_CD(); 551 551 } 552 552 if (retval) { … … 557 557 } 558 558 559 if (count_lines_in_file( "/tmp/changed.txt") > 0) {559 if (count_lines_in_file(MINDI_CACHE"/changed.txt") > 0) { 560 560 mvaddstr_and_log_it(g_currentY++, 0, 561 561 _ 562 562 ("Differences found while files were being compared.")); 563 streamline_changes_file( "/tmp/changed.files", "/tmp/changed.txt");564 if (count_lines_in_file( "/tmp/changed.files") <= 0) {563 streamline_changes_file(MINDI_CACHE"/changed.files", MINDI_CACHE"/changed.txt"); 564 if (count_lines_in_file(MINDI_CACHE"/changed.files") <= 0) { 565 565 mvaddstr_and_log_it(g_currentY++, 0, 566 566 _ … … 569 569 ("The differences were logfiles and temporary files. Your archives are fine.")); 570 570 } else { 571 q = count_lines_in_file( "/tmp/changed.files");571 q = count_lines_in_file(MINDI_CACHE"/changed.files"); 572 572 mr_asprintf(&tmp, _("%ld significant difference%s found."), q, 573 573 (q != 1) ? "s" : ""); … … 586 586 chdir(bkpinfo->restore_path); 587 587 getcwd(new, MAX_STR_LEN - 1); 588 popup_changelist_from_file( "/tmp/changed.files");588 popup_changelist_from_file(MINDI_CACHE"/changed.files"); 589 589 mr_msg(2, "Returning from popup_changelist_from_file()"); 590 590 chdir(cwd); … … 616 616 * @return 0 for success, nonzero for failure. 617 617 */ 618 int compare_to_cdstream( struct s_bkpinfo *bkpinfo)618 int compare_to_cdstream() 619 619 { 620 620 int res; … … 642 642 last_line_of_file("/tmp/CDROM-LIVES-HERE")); 643 643 } 644 res = verify_tape_backups( bkpinfo);644 res = verify_tape_backups(); 645 645 chdir(dir); 646 if (length_of_file( "/tmp/changed.txt") > 2647 && length_of_file( "/tmp/changed.files") > 2) {646 if (length_of_file(MINDI_CACHE"/changed.txt") > 2 647 && length_of_file(MINDI_CACHE"/changed.files") > 2) { 648 648 mr_msg(0, 649 "Type 'less /tmp/changed.files' to see which files don't match the archives");649 "Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives"); 650 650 mr_msg(2, "Calling popup_changelist_from_file()"); 651 popup_changelist_from_file( "/tmp/changed.files");651 popup_changelist_from_file(MINDI_CACHE"/changed.files"); 652 652 mr_msg(2, "Returned from popup_changelist_from_file()"); 653 653 } … … 674 674 * returns: int * 675 675 **************************************************************************/ 676 int compare_to_tape( struct s_bkpinfo *bkpinfo)676 int compare_to_tape() 677 677 { 678 678 int res = 0; … … 692 692 mvaddstr_and_log_it(g_currentY, 693 693 0, _("Verifying archives against filesystem")); 694 res = verify_tape_backups( bkpinfo);694 res = verify_tape_backups(); 695 695 chdir(dir); 696 696 if (res) {
Note:
See TracChangeset
for help on using the changeset viewer.