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

Last change on this file since 1670 was 1670, checked in by Bruno Cornec, 17 years ago
  • Try to fix the issue with large exclude list (> 1000 chars) Some variables created after exclude_path (indirectly) were not sized big enough to handle them.
  • Remove useless .keep file
  • remove temporary.iso name remaining and suppress a warning in log trying to remove it in the tmpdir
  • missing extern bkpinfo in newt-specific.c
  • Attempt to fix #191 (allow edition of mountlist in compare mode)

(merge -r1662:1669 $SVN_M/branches/2.2.5)

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