Changeset 1770 in MondoRescue for branches/stable/mondo/src/common/libmondo-verify.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-verify.c
r1769 r1770 879 879 880 880 /** 881 * Verify the USB device 882 * @param bkpinfo The backup information structure. Fields used: 883 * - @c bkpinfo->isodir 884 * - @c bkpinfo->media_device 885 * - @c bkpinfo->tmpdir 886 * - @c bkpinfo->verify_data 887 * 888 * @return 0 for success (even if differences are found), nonzero for failure. 889 * @ingroup verifyGroup 890 */ 891 int verify_usb_image() 892 { 893 894 /*@ int ************************************************************ */ 895 int retval = 0; 896 897 /*@ buffers ******************************************************** */ 898 char *mountpoint = NULL; 899 char *tmp = NULL; 900 char *tmp1 = NULL; 901 char *fname = NULL; 902 int ret = 0; 903 #ifdef __FreeBSD__ 904 char mdd[32]; 905 char *mddevice = mdd; 906 int vndev = 2; 907 #else 908 //skip 909 #endif 910 911 assert(bkpinfo != NULL); 912 913 asprintf(&fname, "%s1", bkpinfo->media_device); 914 if (is_this_device_mounted(fname)) { 915 log_msg(1, "USB device mounted. Remounting it at the right place"); 916 asprintf(&tmp, "umount %s", fname); 917 run_program_and_log_output(tmp, FALSE); 918 paranoid_free(tmp); 919 } 920 paranoid_free(fname); 921 922 log_msg(1, "Mounting USB device."); 923 asprintf(&mountpoint, "%s/usb", bkpinfo->tmpdir); 924 asprintf(&tmp, "mkdir -p %s", mountpoint); 925 run_program_and_log_output(tmp, FALSE); 926 paranoid_free(tmp); 927 /* Mindi always create one single parition on the USB dev */ 928 asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint); 929 ret = run_program_and_log_output(tmp, FALSE); 930 paranoid_free(tmp); 931 if (ret) { 932 paranoid_free(mountpoint); 933 return(ret); 934 } 935 936 sync(); 937 log_msg(2, "OK, I've mounted the USB Disk/Key\n"); 938 asprintf(&tmp, "%s/archives/NOT-THE-LAST", mountpoint); 939 if (!does_file_exist(tmp)) { 940 log_msg 941 (2, 942 "This is the last USB device. I am therefore setting bkpinfo->verify_data to FALSE."); 943 bkpinfo->verify_data = FALSE; 944 /* 945 (a) It's an easy way to tell the calling subroutine that we've finished & 946 there are no more device to be verified; (b) It stops the post-backup verifier 947 from running after the per-device verifier has run too. 948 */ 949 } 950 paranoid_free(tmp); 951 verify_afioballs_on_CD(mountpoint); 952 iamhere("before verify_all_slices"); 953 verify_all_slices_on_CD(mountpoint); 954 955 asprintf(&tmp1, "umount %s", mountpoint); 956 #ifdef __FreeBSD__ 957 ret += system(tmp1); 958 ret += kick_vn(mddevice); 959 if (ret) 960 #else 961 if (system(tmp1)) 962 #endif 963 { 964 asprintf(&tmp, "%s failed; unable to unmount USB device\n", tmp1); 965 log_to_screen(tmp); 966 paranoid_free(tmp); 967 retval++; 968 } else { 969 log_msg(2, "OK, I've unmounted the USB device\n"); 970 } 971 paranoid_free(tmp1); 972 paranoid_free(mountpoint); 973 return (retval); 974 } 975 976 977 /** 881 978 * Verify the CD indicated by @c g_current_media_number. 882 979 * @param bkpinfo The backup information structure. Fields used: … … 1084 1181 diffs = count_lines_in_file(changed_files_fname); 1085 1182 if (diffs > 0) { 1086 mr_asprintf(&tmp, "cp -f %s %s/changed.files", changed_files_fname, M INDI_CACHE);1183 mr_asprintf(&tmp, "cp -f %s %s/changed.files", changed_files_fname, MONDO_CACHE); 1087 1184 run_program_and_log_output(tmp, FALSE); 1088 1185 mr_free(tmp); … … 1090 1187 mr_asprintf(&tmp, 1091 1188 "%ld files differed from live filesystem; type less %s or less %s/changed.files to see", 1092 diffs, changed_files_fname, M INDI_CACHE);1189 diffs, changed_files_fname, MONDO_CACHE); 1093 1190 mr_msg(0, tmp); 1094 1191 mr_free(tmp); 1095 1192 1096 1193 log_to_screen 1097 (_("See "M INDI_CACHE"/changed.files for a list of nonmatching files."));1194 (_("See "MONDO_CACHE"/changed.files for a list of nonmatching files.")); 1098 1195 log_to_screen 1099 1196 (_("The files probably changed on filesystem, not on backup media.")); 1100 // retval++;1101 1197 } 1102 1198 mr_free(changed_files_fname);
Note:
See TracChangeset
for help on using the changeset viewer.