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

Last change on this file since 1663 was 1663, checked in by Bruno Cornec, 17 years ago
  • Fix bug #197 (based on an initial patch of Scott Cummings)
  • Fix a bug where df was using locale to print messages and wasn't filtered correctly
  • mkdtemp checked in configure
  • reset_bkpinfo called as early as possible by both main program.
  • It creates a tmpdir cleanly with mkdtemp in setup_tmpdir subfunction, which takes in account TMPIR and TMP env var. Remains to see what tmpfs does and tests
  • configure.in should also be filtered.
  • Remove g_bkpinfo_DONTUSETHIS
  • remove bkpinfo also from header files
  • Render bkpinfo global (potential issue on thread, but should not be a problem as that structure is indeed static during archive)
  • Apply patch from Andree Leidenfrost, modified a bit to use bkpinfo->tmpdir instead of /tmp or MINDI_CACHE when appropriate. Fix security issues in mondo. Thanks al ot Andree for catching all those issues.
  • /tmp => /var/log for mondorestore.log in mindi
  • Update linux terminfo to fix a color issue (Andree Leidenfrost)
  • Removes useless log file (Andree Leidenfrost)
  • replace vi with find_my_editor during restore (Andree Leidenfrost)
  • sync in bg in mindi (VMWare issue to look at)
  • mindi/mindi-busybox have a different version than mondo for pb
  • PB-SUF also added to spec file
  • Fix a bug for pb build (omission of PB-SUF declaration)

(merge -r1631:1662 $SVN_M/branches/2.2.5)

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