source: MondoRescue/branches/3.1/mondo/src/mondorestore/mondo-rstr-compare.c@ 3147

Last change on this file since 3147 was 3147, checked in by Bruno Cornec, 11 years ago
  • First pass on svn merge -r 2935:3146 ../3.0
  • Property svn:keywords set to Id
File size: 20.9 KB
Line 
1/***************************************************************************
2 cvsid : $Id: mondo-rstr-compare.c 3147 2013-06-19 06:34:46Z bruno $
3***************************************************************************/
4
5#include <pthread.h>
6#include "my-stuff.h"
7#include "mr_mem.h"
8#include "../common/mondostructures.h"
9#include "../common/libmondo.h"
10//#include "../../config.h"
11#include "mr-externs.h"
12#include "mondo-rstr-compare.h"
13#include "mondo-restore-EXT.h"
14#include "mondo-rstr-tools-EXT.h"
15
16extern char *MONDO_LOGFILE;
17
18/* Reference to global bkpinfo */
19extern struct s_bkpinfo *bkpinfo;
20
21//static char cvsid[] = "$Id: mondo-rstr-compare.c 3147 2013-06-19 06:34:46Z bruno $";
22
23void popup_changelist_from_file(char *);
24
25
26/**
27 * @addtogroup LLcompareGroup
28 * @{
29 */
30/**
31 * Compare biggiefile number @p bigfileno with the filesystem mounted on @p MNT_RESTORING.
32 * @param bkpinfo The backup information structure. Only used in insist_on_this_cd_number().
33 * @param bigfileno The biggiefile number (starting from 0) to compare.
34 * @note This function uses an MD5 checksum.
35 */
36int compare_a_biggiefile(long bigfileno)
37{
38
39 FILE *fin;
40 FILE *fout;
41
42 /** needs malloc *******/
43 char *checksum = NULL;
44 char *original_cksum = NULL;
45 char *bigfile_fname = NULL;
46 char *tmp = NULL;
47 char *command = NULL;
48
49 char *p;
50 int i;
51 int retval = 0;
52
53 struct s_filename_and_lstat_info biggiestruct;
54
55 /*********************************************************************
56 * allocate memory clear test sab 16 feb 2003 *
57 *********************************************************************/
58 assert(bkpinfo != NULL);
59 /** end **/
60
61 if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) {
62 if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
63 insist_on_this_cd_number((++g_current_media_number));
64 } else {
65 log_msg(2, "No CD's left. No biggiefiles left. No prob, Bob.");
66 return (0);
67 }
68 }
69 if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
70 log_to_screen("Cannot open bigfile %ld (NULL)'s info file", bigfileno + 1);
71 return (1);
72 }
73 if (fread((void *) &biggiestruct, 1, sizeof(biggiestruct), fin)) {
74 // FIXME
75 }
76 paranoid_fclose(fin);
77
78 mr_asprintf(checksum, "%s", biggiestruct.checksum);
79 mr_asprintf(bigfile_fname, "%s", biggiestruct.filename);
80
81 log_msg(2, "biggiestruct.filename = %s", biggiestruct.filename);
82 log_msg(2, "biggiestruct.checksum = %s", biggiestruct.checksum);
83
84 if (!g_text_mode) {
85 mr_asprintf(tmp, "Comparing %s", bigfile_fname);
86 newtDrawRootText(0, 22, tmp);
87 paranoid_free(tmp);
88 newtRefresh();
89 }
90 if (!checksum[0]) {
91 log_msg(2, "Warning - %s has no checksum", bigfile_fname);
92 }
93 if (!strncmp(bigfile_fname, "/dev/", 5)) {
94 log_msg(2, "IGNORING %s as begining with /dev", bigfile_fname);
95 mr_free(bigfile_fname);
96 return (1);
97 }
98
99 mr_asprintf(command, "md5sum \"%s%s\" > /tmp/md5sum.txt 2> /tmp/errors", MNT_RESTORING, bigfile_fname);
100 log_msg(2, command);
101 i = system(command);
102 mr_free(command);
103
104 mr_asprintf(tmp, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
105 paranoid_system(tmp);
106 paranoid_free(tmp);
107
108 if (i) {
109 log_OS_error("Warning - command failed");
110 return (1);
111 } else {
112 if (!(fin = fopen("/tmp/md5sum.txt", "r"))) {
113 log_msg(2,
114 "Unable to open /tmp/md5sum.txt; can't get live checksum");
115 mr_free(bigfile_fname);
116 return (1);
117 } else {
118 mr_getline(original_cksum, fin);
119 paranoid_fclose(fin);
120 p = strchr(original_cksum, ' ');
121 if (p) {
122 *p = '\0';
123 }
124 }
125 }
126 mr_asprintf(tmp, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname);
127 if ((original_cksum != NULL) && (strcmp(checksum, original_cksum) == 0)) {
128 mr_strcat(tmp, " ... OK");
129 } else {
130 mr_strcat(tmp, "... changed");
131 retval++;
132 }
133 mr_free(checksum);
134 mr_free(original_cksum);
135
136 log_msg(1, tmp);
137 paranoid_free(tmp);
138
139 if (retval) {
140 if (!(fout = fopen(MONDO_CACHE"/changed.txt", "a"))) {
141 fatal_error("Cannot openout changed.txt");
142 }
143 fprintf(fout, "%s\n", bigfile_fname);
144 paranoid_fclose(fout);
145 }
146 mr_free(bigfile_fname);
147
148 return (retval);
149}
150
151/**************************************************************************
152 *END_COMPARE_A_BIGGIEFILE *
153 **************************************************************************/
154
155
156/**
157 * Compare all biggiefiles in the backup.
158 * @return 0 for success, nonzero for failure.
159 */
160int compare_all_biggiefiles()
161{
162 int retval = 0;
163 int res;
164 long noof_biggiefiles, bigfileno = 0;
165 char *tmp = NULL;
166
167 log_msg(1, "Comparing biggiefiles");
168
169 if (length_of_file(BIGGIELIST) < 6) {
170 log_msg(1,
171 "OK, really teeny-tiny biggielist; not comparing biggiefiles");
172 return (0);
173 }
174 noof_biggiefiles = count_lines_in_file(BIGGIELIST);
175 if (noof_biggiefiles <= 0) {
176 log_msg(1, "OK, no biggiefiles; not comparing biggiefiles");
177 return (0);
178 }
179 mvaddstr_and_log_it(g_currentY, 0,
180 "Comparing large files ");
181 open_progress_form("Comparing large files",
182 "I am now comparing the large files",
183 "against the filesystem. Please wait.", "",
184 noof_biggiefiles);
185 for (bigfileno = 0; bigfileno < noof_biggiefiles; bigfileno++) {
186 mr_asprintf(tmp, "Comparing big file #%ld", bigfileno + 1);
187 log_msg(1, tmp);
188 update_progress_form(tmp);
189 mr_free(tmp);
190
191 res = compare_a_biggiefile(bigfileno);
192 retval += res;
193 g_current_progress++;
194 }
195 close_progress_form();
196 return (0);
197 if (retval) {
198 mvaddstr_and_log_it(g_currentY++, 74, "Errors.");
199 } else {
200 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
201 }
202 return (retval);
203}
204
205/**************************************************************************
206 *END_COMPARE_ALL_BIGGIEFILES *
207 **************************************************************************/
208
209
210/**
211 * Compare afioball @p tarball_fname against the filesystem.
212 * You must be chdir()ed to the directory where the filesystem is mounted
213 * before you call this function.
214 * @param tarball_fname The filename of the tarball to compare.
215 * @param current_tarball_number The fileset number contained in @p tarball_fname.
216 * @return 0 for success, nonzero for failure.
217 */
218int compare_a_tarball(char *tarball_fname, int current_tarball_number)
219{
220 int retval = 0;
221 int res;
222 long archiver_errors;
223 bool use_star;
224
225 /*** needs malloc *********/
226 char *command = NULL;
227 char *tmp = NULL;
228 char *archiver_exe = NULL;
229 char *tmp1 = NULL;
230 char *filelist_name = NULL;
231 char *logfile = NULL;
232 char *compressor_exe = NULL;
233
234 use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
235 assert_string_is_neither_NULL_nor_zerolength(tarball_fname);
236 mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%d", current_tarball_number);
237 noof_lines = count_lines_in_file(filelist_name);
238 mr_free(filelist_name);
239
240 if (strstr(tarball_fname, ".bz2")) {
241 mr_asprintf(compressor_exe, "bzip2");
242 } else if (strstr(tarball_fname, ".lzma")) {
243 mr_asprintf(compressor_exe, "lzma");
244 } else if (strstr(tarball_fname, ".gz")) {
245 mr_asprintf(compressor_exe, "gzip");
246 } else if (strstr(tarball_fname, ".lzo")) {
247 mr_asprintf(compressor_exe, "lzop");
248 }
249
250 if (use_star) {
251 mr_asprintf(archiver_exe, "star");
252 } else {
253 mr_asprintf(archiver_exe, "afio");
254 }
255
256 if (compressor_exe) {
257 tmp1 = find_home_of_exe(compressor_exe);
258 if (!tmp1) {
259 mr_free(tmp1);
260 mr_free(compressor_exe);
261 mr_free(archiver_exe);
262 fatal_error("(compare_a_tarball) Compression program missing");
263 }
264 mr_free(tmp1);
265
266 if (use_star) {
267 if (!strcmp(compressor_exe, "bzip2")) {
268 mr_strcat(archiver_exe, " -bz");
269 } else {
270 mr_free(compressor_exe);
271 mr_free(archiver_exe);
272 fatal_error("(compare_a_tarball) Please use only bzip2 with star");
273 }
274 } else {
275 // afio
276 mr_free(compressor_exe);
277 mr_asprintf(tmp, "%s", compressor_exe);
278 mr_asprintf(compressor_exe, "-P %s -Z", tmp);
279 mr_free(tmp);
280 }
281 }
282
283#ifdef __FreeBSD__
284#define BUFSIZE 512L
285#else
286#define BUFSIZE (1024L*1024L)/TAPE_BLOCK_SIZE
287#endif
288 mr_asprintf(logfile, "/tmp/afio.log.%d", current_tarball_number);
289
290 if (use_star) {
291 // doesn't use compressor_exe
292 mr_asprintf(command, "%s -sparse -diff H=exustar file=%s >> %s 2>> %s", archiver_exe, tarball_fname, logfile, logfile);
293 } else {
294 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);
295 }
296 mr_free(compressor_exe);
297 paranoid_free(archiver_exe);
298
299#undef BUFSIZE
300
301 res = system(command);
302 retval += res;
303 if (res) {
304 log_OS_error(command);
305 log_msg(2, "Warning - afio returned error = %d", res);
306 }
307 mr_free(command);
308
309 if (length_of_file(logfile) > 5) {
310 mr_asprintf(command, "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", logfile);
311 paranoid_system(command);
312 mr_free(command);
313
314 archiver_errors = count_lines_in_file(logfile);
315 } else {
316 archiver_errors = 0;
317 }
318 if (archiver_errors) {
319 log_msg(1, "%ld difference%c in fileset #%d ", archiver_errors, (archiver_errors != 1) ? 's' : ' ', current_tarball_number);
320 }
321 unlink(logfile);
322 mr_free(logfile);
323
324 return (retval);
325}
326
327/**************************************************************************
328 *END_COMPARE_A_TARBALL *
329 **************************************************************************/
330
331
332/**
333 * Compare all afioballs in this backup.
334 * @param bkpinfo The backup media structure. Passed to other functions.
335 * @return 0 for success, nonzero for failure.
336 */
337int compare_all_tarballs()
338{
339 int retval = 0;
340 int current_tarball_number = 0;
341
342 /** needs malloc **********/
343
344 char *tarball_fname = NULL;
345 char *progress_str = NULL;
346 char *tmp = NULL;
347 char *mds = NULL;
348 long max_val;
349
350 assert(bkpinfo != NULL);
351 mvaddstr_and_log_it(g_currentY, 0, "Comparing archives");
352 tmp = read_cfg_var(MINDI_CACHE"/mondorestore.cfg", "last-filelist-number");
353 max_val = atol(tmp);
354 mr_free(tmp);
355
356 mds = media_descriptor_string(bkpinfo->backup_media_type);
357 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
358
359 open_progress_form("Comparing files",
360 "Comparing tarballs against filesystem.",
361 "Please wait. This may take some time.",
362 progress_str, max_val);
363
364 log_to_screen(progress_str);
365
366 for (;;) {
367 insist_on_this_cd_number(g_current_media_number);
368 update_progress_form(progress_str);
369 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.bz2", current_tarball_number);
370
371 if (!does_file_exist(tarball_fname)) {
372 mr_free(tarball_fname);
373 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);
374 }
375 if (!does_file_exist(tarball_fname)) {
376 mr_free(tarball_fname);
377 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzma", current_tarball_number);
378 }
379 if (!does_file_exist(tarball_fname)) {
380 mr_free(tarball_fname);
381 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.gz", current_tarball_number);
382 }
383 if (!does_file_exist(tarball_fname)) {
384 mr_free(tarball_fname);
385 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.", current_tarball_number);
386 }
387 if (!does_file_exist(tarball_fname)) {
388 mr_free(tarball_fname);
389 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.bz2", current_tarball_number);
390 }
391 if (!does_file_exist(tarball_fname)) {
392 mr_free(tarball_fname);
393 mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.star.", current_tarball_number);
394 }
395 if (!does_file_exist(tarball_fname)) {
396 if (!does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST") ||
397 system("find " MNT_CDROM
398 "/archives/slice* > /dev/null 2> /dev/null")
399 == 0) {
400 log_msg(2, "OK, I think I'm done with tarballs...");
401 mr_free(tarball_fname);
402 break;
403 }
404 log_msg(2, "OK, I think it's time for another CD...");
405 g_current_media_number++;
406
407 mr_free(progress_str);
408 mr_asprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
409 log_to_screen(progress_str);
410 } else {
411 retval += compare_a_tarball(tarball_fname, current_tarball_number);
412
413 g_current_progress++;
414 current_tarball_number++;
415 }
416 mr_free(tarball_fname);
417 }
418 mr_free(progress_str);
419 mr_free(mds);
420
421 close_progress_form();
422 if (retval) {
423 mvaddstr_and_log_it(g_currentY++, 74, "Errors.");
424 } else {
425 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
426 }
427 return (retval);
428}
429
430/**************************************************************************
431 *END_COMPARE_ALL_TARBALLS *
432 **************************************************************************/
433
434/* @} - end LLcompareGroup */
435
436
437/**
438 * @addtogroup compareGroup
439 * @{
440 */
441/**
442 * Compare all data on a CD-R/CD-RW/DVD/ISO/NFS-based backup.
443 * @param bkpinfo The backup information structure. Passed to other functions.
444 * @return 0 for success, nonzero for failure.
445 */
446int compare_to_CD()
447{
448 /** needs malloc *********/
449 char *tmp = NULL;
450 char *cwd, *new;
451 char *command = NULL;
452 int resA = 0;
453 int resB = 0;
454 long noof_changed_files;
455
456 malloc_string(cwd);
457 malloc_string(new);
458
459 assert(bkpinfo != NULL);
460
461 if (getcwd(cwd, MAX_STR_LEN - 1)) {
462 // FIXME
463 }
464 if (chdir(bkpinfo->restore_path)) {
465 //FIXME
466 }
467 if (getcwd(new, MAX_STR_LEN - 1)) {
468 // FIXME
469 }
470 insist_on_this_cd_number(g_current_media_number);
471 unlink(MONDO_CACHE"/changed.txt");
472
473 resA = compare_all_tarballs();
474 resB = compare_all_biggiefiles();
475 if (chdir(cwd)) {
476 // FIXME
477 }
478 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt");
479 if (noof_changed_files) {
480 mr_asprintf(tmp, "%ld files do not match the backup ", noof_changed_files);
481 log_to_screen(tmp);
482 mr_free(tmp);
483
484 mr_asprintf(command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE);
485 paranoid_system(command);
486 mr_free(command);
487 } else {
488 mr_asprintf(tmp, "All files match the backup ");
489 mvaddstr_and_log_it(g_currentY++, 0, tmp);
490 log_to_screen(tmp);
491 mr_free(tmp);
492 }
493
494 paranoid_free(cwd);
495 paranoid_free(new);
496
497 return (resA + resB);
498}
499
500/**************************************************************************
501 *END_COMPARE_TO_CD *
502 **************************************************************************/
503
504
505
506
507/**
508 * Compare all data in the user's backup.
509 * This function will mount filesystems, compare afioballs and biggiefiles,
510 * and show the user the differences.
511 * @param bkpinfo The backup information structure. Passed to other functions.
512 * @param mountlist The mountlist containing partitions to mount.
513 * @param raidlist The raidlist containing the user's RAID devices.
514 * @return The number of errors/differences found.
515 */
516int
517compare_mode(struct mountlist_itself *mountlist,
518 struct raidlist_itself *raidlist)
519{
520 int retval = 0;
521 int res = 0;
522 long q;
523 char *tmp = NULL;
524 char *new;
525 char *cwd;
526
527 malloc_string(new);
528 malloc_string(cwd);
529
530 /**************************************************************************
531 * also deletes tmp/filelist.full & biggielist.txt _and_ tries to *
532 * restore them from start of tape, if available *
533 **************************************************************************/
534 assert(bkpinfo != NULL);
535 assert(mountlist != NULL);
536 assert(raidlist != NULL);
537
538 read_cfg_file_into_bkpinfo(MINDI_CACHE"/mondorestore.cfg");
539
540 /* edit_mountlist if wanted */
541 log_it("About to edit mountlist");
542 if (g_text_mode) {
543 save_mountlist_to_disk(mountlist, MINDI_CACHE"/mountlist.txt");
544 mr_asprintf(tmp, "%s %s", find_my_editor(), MINDI_CACHE"/mountlist.txt");
545 res = system(tmp);
546 mr_free(tmp);
547
548 load_mountlist(mountlist, MINDI_CACHE"/mountlist.txt");
549 } else {
550 res = edit_mountlist(MINDI_CACHE"/mountlist.txt", mountlist, raidlist);
551 }
552 log_it("Finished editing mountlist");
553 if (res) {
554 paranoid_MR_finish(1);
555 }
556 save_mountlist_to_disk(mountlist, MINDI_CACHE"/mountlist.txt");
557 save_raidlist_to_raidtab(raidlist, RAIDTAB_FNAME);
558
559 g_current_media_number = 1;
560 mvaddstr_and_log_it(1, 30, "Comparing Automatically");
561 log_it("Pre-MAD");
562 retval = mount_all_devices(mountlist, FALSE);
563 log_it("Post-MAD");
564 if (retval) {
565 unmount_all_devices(mountlist);
566 return (retval);
567 }
568 if (bkpinfo->backup_media_type == tape
569 || bkpinfo->backup_media_type == udev) {
570 retval += compare_to_tape();
571 } else if (bkpinfo->backup_media_type == cdstream) {
572 retval += compare_to_cdstream();
573 } else {
574 retval += compare_to_CD();
575 }
576 if (retval) {
577 mvaddstr_and_log_it(g_currentY++,
578 0,
579 "Warning - differences found during the compare phase");
580 }
581
582 if (count_lines_in_file(MONDO_CACHE"/changed.txt") > 0) {
583 mvaddstr_and_log_it(g_currentY++, 0,
584 "Differences found while files were being compared.");
585 streamline_changes_file(MONDO_CACHE"/changed.files", MONDO_CACHE"/changed.txt");
586 if (count_lines_in_file(MONDO_CACHE"/changed.files") <= 0) {
587 mvaddstr_and_log_it(g_currentY++, 0,
588 "...but they were logfiles and temporary files. Your archives are fine.");
589 log_to_screen
590 ("The differences were logfiles and temporary files. Your archives are fine.");
591 } else {
592 q = count_lines_in_file(MONDO_CACHE"/changed.files");
593 mr_asprintf(tmp, "%ld significant difference%s found.", q, (q != 1) ? "s" : "");
594 mvaddstr_and_log_it(g_currentY++, 0, tmp);
595 log_to_screen(tmp);
596 mr_free(tmp);
597
598 mr_asprintf(tmp, "Type 'less /tmp/changed.files' for a list of non-matching files");
599 mvaddstr_and_log_it(g_currentY++, 0, tmp);
600 log_to_screen(tmp);
601 mr_free(tmp);
602
603 log_msg(2, "calling popup_changelist_from_file()");
604 if (getcwd(cwd, MAX_STR_LEN - 1)) {
605 //FIXME
606 }
607 if (chdir(bkpinfo->restore_path)) {
608 // FIXME
609 }
610 if (getcwd(new, MAX_STR_LEN - 1)) {
611 //FIXME
612 }
613 popup_changelist_from_file(MONDO_CACHE"/changed.files");
614 if (chdir(cwd)) {
615 // FIXME
616 }
617 log_msg(2, "Returning from popup_changelist_from_file()");
618 }
619 } else {
620 log_to_screen
621 ("No significant differences were found. Your backup is perfect.");
622 }
623 retval += unmount_all_devices(mountlist);
624
625 kill_petris();
626 paranoid_free(new);
627 paranoid_free(cwd);
628 return (retval);
629}
630
631/**************************************************************************
632 *END_COMPARE_MODE *
633 **************************************************************************/
634
635/**
636 * Compare all data on a cdstream-based backup.
637 * @param bkpinfo The backup information structure. Fields used:
638 * - @c bkpinfo->disaster_recovery
639 * - @c bkpinfo->media_device
640 * - @c bkpinfo->restore_path
641 * @return 0 for success, nonzero for failure.
642 */
643int compare_to_cdstream()
644{
645 int res;
646
647 /** needs malloc **/
648 char *dir;
649
650 assert(bkpinfo != NULL);
651 malloc_string(dir);
652 if (getcwd(dir, MAX_STR_LEN)) {
653 // FIXME
654 }
655 if (chdir(bkpinfo->restore_path)) {
656 // FIXME
657 }
658
659 mvaddstr_and_log_it(g_currentY,
660 0, "Verifying archives against filesystem");
661
662 mr_free(bkpinfo->media_device);
663 if (bkpinfo->disaster_recovery && does_file_exist(MINDI_CACHE"/CDROM-LIVES-HERE")) {
664 bkpinfo->media_device = last_line_of_file(MINDI_CACHE"/CDROM-LIVES-HERE");
665 } else {
666 bkpinfo->media_device = find_cdrom_device(FALSE);
667 }
668 res = verify_tape_backups();
669 if (chdir(dir)) {
670 // FIXME
671 }
672 if (length_of_file(MONDO_CACHE"/changed.txt") > 2
673 && length_of_file(MONDO_CACHE"/changed.files") > 2) {
674 log_msg(0,
675 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives");
676 log_msg(2, "Calling popup_changelist_from_file()");
677 popup_changelist_from_file(MONDO_CACHE"/changed.files");
678 log_msg(2, "Returned from popup_changelist_from_file()");
679 }
680
681 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
682 paranoid_free(dir);
683 return (res);
684}
685
686/**************************************************************************
687 *END_COMPARE_CD_STREAM *
688 **************************************************************************/
689
690
691/**
692 * Compare all data on a tape-based backup.
693 * @param bkpinfo The backup information structure. Field used: @c bkpinfo->restore_path.
694 * @return 0 for success, nonzero for failure.
695 */
696/**************************************************************************
697 * F@COMPARE_TO_TAPE() *
698 * compare_to_tape() - gots me?? *
699 * *
700 * returns: int *
701 **************************************************************************/
702int compare_to_tape()
703{
704 int res;
705 char *dir;
706
707 assert(bkpinfo != NULL);
708 malloc_string(dir);
709
710 if (getcwd(dir, MAX_STR_LEN)) {
711 // FIXME
712 }
713 if (chdir(bkpinfo->restore_path)) {
714 // FIXME
715 }
716
717 mvaddstr_and_log_it(g_currentY,
718 0, "Verifying archives against filesystem");
719 res = verify_tape_backups();
720 if (chdir(dir)) {
721 // FIXME
722 }
723 if (res) {
724 mvaddstr_and_log_it(g_currentY++, 74, "Failed.");
725 } else {
726 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
727 }
728 paranoid_free(dir);
729 return (res);
730}
731
732/**************************************************************************
733 *END_COMPARE_TO_TAPE *
734 **************************************************************************/
735
736/* @} - end compareGroup */
Note: See TracBrowser for help on using the repository browser.