Changeset 59 in MondoRescue for trunk/mondo/mondo/common/libmondo-verify.c
- Timestamp:
- Oct 11, 2005, 1:34:31 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/mondo/mondo/common/libmondo-verify.c
r49 r59 74 74 log_msg(1, "Now scanning log file for 'afio: ' stuff"); 75 75 asprintf(&command, 76 "cat %s | grep \"afio: \" | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s",77 stderr_fname, afio_found_changes);76 "cat %s | grep \"afio: \" | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s", 77 stderr_fname, afio_found_changes); 78 78 log_msg(2, command); 79 79 res = system(command); … … 85 85 log_msg(1, "Now scanning log file for 'star: ' stuff"); 86 86 asprintf(&command, 87 "cat %s | grep \"star: \" | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s",88 stderr_fname, afio_found_changes);87 "cat %s | grep \"star: \" | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s", 88 stderr_fname, afio_found_changes); 89 89 log_msg(2, command); 90 90 res = system(command); … … 96 96 afio_diffs = count_lines_in_file(afio_found_changes); 97 97 asprintf(&command, 98 "cat %s %s %s | sort | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s",99 ignorefiles_fname, afio_found_changes, afio_found_changes,100 changedfiles_fname);98 "cat %s %s %s | sort | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", 99 ignorefiles_fname, afio_found_changes, afio_found_changes, 100 changedfiles_fname); 101 101 log_msg(2, command); 102 102 paranoid_system(command); … … 150 150 retval++; 151 151 asprintf(&tmp, "Warning - missing set(s) between %d and %d\n", 152 g_last_afioball_number, set_number - 1);152 g_last_afioball_number, set_number - 1); 153 153 log_to_screen(tmp); 154 154 paranoid_free(tmp); … … 156 156 } 157 157 asprintf(&tmp, "Verifying %s #%d's tarballs", 158 media_descriptor_string(bkpinfo->backup_media_type),159 g_current_media_number);158 media_descriptor_string(bkpinfo->backup_media_type), 159 g_current_media_number); 160 160 open_evalcall_form(tmp); 161 161 paranoid_free(tmp); … … 177 177 verify_an_afioball_from_CD(bkpinfo, 178 178 vfy_tball_fname(bkpinfo, mountpoint, 179 set_number));179 set_number)); 180 180 } 181 181 g_last_afioball_number = set_number - 1; … … 253 253 iamhere("before vsbf"); 254 254 asprintf(&tmp, "Verifying %s#%d's big files", 255 media_descriptor_string(bkpinfo->backup_media_type),256 g_current_media_number);255 media_descriptor_string(bkpinfo->backup_media_type), 256 g_current_media_number); 257 257 open_evalcall_form(tmp); 258 258 paranoid_free(tmp); … … 293 293 } 294 294 asprintf(&tmp, "%s/%s", bkpinfo->restore_path, 295 biggiestruct.filename);295 biggiestruct.filename); 296 296 log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp); 297 297 if (!(forig = fopen(tmp, "r"))) { … … 314 314 if (bkpinfo->compression_level > 0) { 315 315 asprintf(&command, "cat %s | %s -dc 2>> %s", 316 slice_fname(bigfile_num, slice_num, mountpoint,317 bkpinfo->zip_suffix), sz_exe,318 MONDO_LOGFILE);316 slice_fname(bigfile_num, slice_num, mountpoint, 317 bkpinfo->zip_suffix), sz_exe, 318 MONDO_LOGFILE); 319 319 } else { 320 320 asprintf(&command, "cat %s", 321 slice_fname(bigfile_num, slice_num, mountpoint,322 bkpinfo->zip_suffix));321 slice_fname(bigfile_num, slice_num, mountpoint, 322 bkpinfo->zip_suffix)); 323 323 } 324 324 if ((pin = popen(command, "r"))) { … … 437 437 if (strstr(tarball_fname, ".bz2")) 438 438 asprintf(&command, 439 "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s",440 tarball_fname,441 (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog,442 outlog);439 "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s", 440 tarball_fname, 441 (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog, 442 outlog); 443 443 } else { 444 444 bkpinfo->use_star = FALSE; 445 445 asprintf(&command, "afio -r -P %s -Z %s >> %s 2>> %s", 446 bkpinfo->zip_exe, tarball_fname, outlog, outlog);446 bkpinfo->zip_exe, tarball_fname, outlog, outlog); 447 447 } 448 448 log_msg(6, "command=%s", command); … … 454 454 } else { 455 455 asprintf(&command, "cat %s | cut -d':' -f%d | sort | uniq", outlog, 456 (bkpinfo->use_star) ? 1 : 2);456 (bkpinfo->use_star) ? 1 : 2); 457 457 pin = popen(command, "r"); 458 458 if (pin) { … … 569 569 asprintf(&tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p); 570 570 /* BERLIOS : useless 571 asprintf(&tmp, "Temporarily copying file from tape to '%s'",572 573 log_it(tmp);574 paranoid_free(tmp);575 */571 asprintf(&tmp, "Temporarily copying file from tape to '%s'", 572 tarball_fname); 573 log_it(tmp); 574 paranoid_free(tmp); 575 */ 576 576 read_file_from_stream_to_file(bkpinfo, tarball_fname, size); 577 577 res = verify_a_tarball(bkpinfo, tarball_fname); 578 578 if (res) { 579 579 asprintf(&tmp, 580 "Afioball '%s' no longer matches your live filesystem", p); 580 "Afioball '%s' no longer matches your live filesystem", 581 p); 581 582 log_msg(0, tmp); 582 583 paranoid_free(tmp); … … 632 633 asprintf(&test_file, "%s/temporary-%s", bkpinfo->tmpdir, p); 633 634 /* BERLIOS: useless 634 asprintf(&tmp, 635 "Temporarily copying biggiefile %s's slices from tape to '%s'", 636 p, test_file); 637 log_it(tmp); 638 paranoid_free(tmp); 639 */ 640 for (res = read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr); 635 asprintf(&tmp, 636 "Temporarily copying biggiefile %s's slices from tape to '%s'", 637 p, test_file); 638 log_it(tmp); 639 paranoid_free(tmp); 640 */ 641 for (res = 642 read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr); 641 643 ctrl_chr != BLK_STOP_A_BIGGIE; 642 res = read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr)) { 644 res = 645 read_header_block_from_stream(&slice_siz, slice_fnam, 646 &ctrl_chr)) { 643 647 if (ctrl_chr != BLK_START_AN_AFIO_OR_SLICE) { 644 648 wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr); … … 646 650 res = read_file_from_stream_to_file(bkpinfo, test_file, slice_siz); 647 651 unlink(test_file); 648 res = read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr); 652 res = 653 read_header_block_from_stream(&slice_siz, slice_fnam, 654 &ctrl_chr); 649 655 if (ctrl_chr != BLK_STOP_AN_AFIO_OR_SLICE) { 650 656 log_msg(2, "test_file = %s", test_file); … … 663 669 if (strcmp(biggie_cksum, orig_cksum)) { 664 670 asprintf(&tmp, "orig cksum=%s; curr cksum=%s", biggie_cksum, 665 orig_cksum);671 orig_cksum); 666 672 log_msg(2, tmp); 667 673 paranoid_free(tmp); 668 674 669 675 asprintf(&tmp, "%s has changed on live filesystem", 670 biggie_fname);676 biggie_fname); 671 677 log_to_screen(tmp); 672 678 paranoid_free(tmp); 673 679 674 680 asprintf(&tmp, "echo \"%s\" >> /tmp/biggies.changed", 675 biggie_fname);681 biggie_fname); 676 682 system(tmp); 677 683 paranoid_free(tmp); … … 715 721 716 722 asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, 717 bkpinfo->tmpdir);723 bkpinfo->tmpdir); 718 724 asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, 719 bkpinfo->tmpdir);725 bkpinfo->tmpdir); 720 726 log_to_screen("Verifying regular archives on tape"); 721 727 total_afioballs = get_last_filelist_number(bkpinfo) + 1; … … 745 751 res = read_header_block_from_stream(&size, fname, &ctrl_chr)) { 746 752 asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, 747 bkpinfo->tmpdir, current_afioball_number);753 bkpinfo->tmpdir, current_afioball_number); 748 754 asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, 749 bkpinfo->tmpdir, current_afioball_number);755 bkpinfo->tmpdir, current_afioball_number); 750 756 if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) { 751 757 iamhere("Reading EXAT files from tape"); … … 769 775 if (res) { 770 776 asprintf(&tmp, "Afioball %ld differs from live filesystem", 771 current_afioball_number);777 current_afioball_number); 772 778 log_to_screen(tmp); 773 779 paranoid_free(tmp); … … 824 830 825 831 asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, 826 bkpinfo->tmpdir);832 bkpinfo->tmpdir); 827 833 asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, 828 bkpinfo->tmpdir);834 bkpinfo->tmpdir); 829 835 asprintf(&comment, "Verifying all bigfiles."); 830 836 log_to_screen(comment); 831 837 /* 832 asprintf(&tmp, "%s/biggielist.txt", bkpinfo->tmpdir);833 noof_biggiefiles = count_lines_in_file (tmp); // pointless834 paranoid_free(tmp);835 */838 asprintf(&tmp, "%s/biggielist.txt", bkpinfo->tmpdir); 839 noof_biggiefiles = count_lines_in_file (tmp); // pointless 840 paranoid_free(tmp); 841 */ 836 842 res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr); 837 843 if (ctrl_chr != BLK_START_BIGGIEFILES) { … … 872 878 } 873 879 asprintf(&comment, "Verifying bigfile #%ld (%ld K)", 874 current_biggiefile_number, (long) size >> 10);880 current_biggiefile_number, (long) size >> 10); 875 881 update_progress_form(comment); 876 882 paranoid_free(comment); 877 883 878 asprintf(&logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname); 879 res = verify_a_biggiefile_from_stream(bkpinfo, logical_fname, size); 884 asprintf(&logical_fname, "%s/%s", bkpinfo->restore_path, 885 orig_fname); 886 res = 887 verify_a_biggiefile_from_stream(bkpinfo, logical_fname, size); 880 888 paranoid_free(logical_fname); 881 889 retval += res; … … 929 937 asprintf(&mountpoint, "%s/cdrom", bkpinfo->tmpdir); 930 938 asprintf(&fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, 931 bkpinfo->nfs_remote_dir, g_current_media_number);939 bkpinfo->nfs_remote_dir, g_current_media_number); 932 940 933 941 mkdir(mountpoint, 1777); … … 935 943 if (!does_file_exist(fname)) { 936 944 asprintf(&tmp, 937 "%s not found; assuming you backed up to CD; verifying CD...",938 fname);945 "%s not found; assuming you backed up to CD; verifying CD...", 946 fname); 939 947 log_msg(2, tmp); 940 948 paranoid_free(tmp); … … 957 965 if (ret) { 958 966 asprintf(&tmp, "make_vn of %s failed; unable to verify ISO\n", 959 fname);967 fname); 960 968 log_to_screen(tmp); 961 969 paranoid_free(tmp); … … 965 973 #else 966 974 asprintf(&command, "mount -o loop,ro -t iso9660 %s %s", fname, 967 mountpoint);975 mountpoint); 968 976 #endif 969 977 if (run_program_and_log_output(command, FALSE)) { 970 978 asprintf(&tmp, "%s failed; unable to mount ISO image\n", 971 command);979 command); 972 980 log_to_screen(tmp); 973 981 paranoid_free(tmp); … … 1008 1016 #endif 1009 1017 { 1010 asprintf(&tmp, "%s failed; unable to unmount ISO image\n", command); 1018 asprintf(&tmp, "%s failed; unable to unmount ISO image\n", 1019 command); 1011 1020 log_to_screen(tmp); 1012 1021 paranoid_free(tmp); … … 1073 1082 ("rm -f /tmp/biggies.changed /tmp/changed.files.[0-9]* 2> /dev/null"); 1074 1083 asprintf(&changed_files_fname, "/tmp/changed.files.%d", 1075 (int) (random() % 32767));1084 (int) (random() % 32767)); 1076 1085 asprintf(&tmp, 1077 "cat %s | grep -x \"%s:.*\" | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\" > %s",1078 MONDO_LOGFILE, (bkpinfo->use_star) ? "star" : "afio",1079 changed_files_fname);1086 "cat %s | grep -x \"%s:.*\" | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\" > %s", 1087 MONDO_LOGFILE, (bkpinfo->use_star) ? "star" : "afio", 1088 changed_files_fname); 1080 1089 log_msg(2, "Running command to derive list of changed files"); 1081 1090 log_msg(2, tmp); … … 1099 1108 if (diffs > 0) { 1100 1109 asprintf(&tmp, "cp -f %s %s", changed_files_fname, 1101 "/tmp/changed.files");1110 "/tmp/changed.files"); 1102 1111 run_program_and_log_output(tmp, FALSE); 1103 1112 paranoid_free(tmp); 1104 1113 1105 1114 asprintf(&tmp, 1106 "%ld files differed from live filesystem; type less %s or less %s to see",1107 diffs, changed_files_fname, "/tmp/changed.files");1115 "%ld files differed from live filesystem; type less %s or less %s to see", 1116 diffs, changed_files_fname, "/tmp/changed.files"); 1108 1117 log_msg(0, tmp); 1109 1118 paranoid_free(tmp); … … 1138 1147 assert_string_is_neither_NULL_nor_zerolength(mountpoint); 1139 1148 asprintf(&output, "%s/archives/%d.star.%s", mountpoint, setno, 1140 bkpinfo->zip_suffix);1149 bkpinfo->zip_suffix); 1141 1150 if (!does_file_exist(output)) { 1142 1151 paranoid_free(output); 1143 1152 asprintf(&output, "%s/archives/%d.afio.%s", mountpoint, setno, 1144 bkpinfo->zip_suffix);1153 bkpinfo->zip_suffix); 1145 1154 } 1146 1155 return (output);
Note:
See TracChangeset
for help on using the changeset viewer.