source: MondoRescue/branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c@ 1591

Last change on this file since 1591 was 1591, checked in by Bruno Cornec, 17 years ago
  • Improve tape support doc (Tilman Schmidt <tilman_at_imap.cc>)
  • mdadm.conf files added to deplist
  • Fix gentoo issues again (Francesco Talamona ti.liame_at_email.it)
  • Fix bug #187 (Scott Cummings rsc_at_usfamily.net)

(merge -r1579:1590 $SVN_M/branches/2.2.5)

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