Changeset 1663 in MondoRescue for branches/stable/mondo/src/mondoarchive
- Timestamp:
- Sep 27, 2007, 12:21:18 PM (17 years ago)
- Location:
- branches/stable/mondo/src/mondoarchive
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondoarchive/mondo-cli-EXT.h
r1264 r1663 1 1 /* mondo-cli-EXT.h */ 2 2 3 extern int handle_incoming_parameters(int argc, char *argv[], 4 struct s_bkpinfo *bkpinfo); 5 extern int process_the_s_switch(struct s_bkpinfo *bkpinfo, char *value); 6 extern int process_switches(struct s_bkpinfo *bkpinfo, 7 char flag_val[128][MAX_STR_LEN], 3 extern int handle_incoming_parameters(int argc, char *argv[]); 4 extern int process_the_s_switch(char *value); 5 extern int process_switches(char flag_val[128][MAX_STR_LEN], 8 6 bool flag_set[128]); 9 7 extern int retrieve_switches_from_command_line(int argc, char *argv[], -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1639 r1663 25 25 extern bool g_text_mode; 26 26 extern char g_startdir[MAX_STR_LEN]; ///< ????? @bug ????? 27 extern char g_erase_tmpdir_and_scratchdir[MAX_STR_LEN];28 27 extern char g_tmpfs_mountpt[MAX_STR_LEN]; 29 28 extern bool g_sigpipe; … … 44 43 bool g_running_live = FALSE; ///< ????? @bug ????? @ingroup globalGroup 45 44 extern bool g_cd_recovery; 45 46 extern void setup_tmpdir(char *path); 46 47 47 48 /** … … 63 64 char *g_getfacl = NULL; 64 65 char *g_getfattr = NULL; 66 67 /* Reference to global bkpinfo */ 68 extern struct s_bkpinfo *bkpinfo; 65 69 66 70 /** … … 76 80 */ 77 81 int 78 handle_incoming_parameters(int argc, char *argv[], 79 struct s_bkpinfo *bkpinfo) 82 handle_incoming_parameters(int argc, char *argv[]) 80 83 { 81 84 /*@ int *** */ … … 89 92 bool flag_set[128]; 90 93 91 sensibly_set_tmpdir_and_scratchdir( bkpinfo);94 sensibly_set_tmpdir_and_scratchdir(); 92 95 93 96 for (i = 0; i < 128; i++) { … … 99 102 retval += res; 100 103 if (!retval) { 101 res = process_switches( bkpinfo,flag_val, flag_set);104 res = process_switches(flag_val, flag_set); 102 105 retval += res; 103 106 } … … 121 124 mr_free(tmp); 122 125 123 sprintf(bkpinfo->tmpdir + strlen(bkpinfo->tmpdir), "/tmp.mondo.%ld",124 random() % 32767);125 126 sprintf(bkpinfo->scratchdir + strlen(bkpinfo->scratchdir), 126 127 "/mondo.scratch.%ld", random() % 32767); … … 144 145 * @bug Return code not needed. 145 146 */ 146 int process_the_s_switch( struct s_bkpinfo *bkpinfo,char *value)147 int process_the_s_switch(char *value) 147 148 { 148 149 char *tmp = NULL; … … 180 181 */ 181 182 int 182 process_switches(struct s_bkpinfo *bkpinfo, 183 char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 183 process_switches(char flag_val[128][MAX_STR_LEN], bool flag_set[128]) 184 184 { 185 185 … … 425 425 ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway."); 426 426 } 427 if (process_the_s_switch( bkpinfo,flag_val['s'])) {427 if (process_the_s_switch(flag_val['s'])) { 428 428 fatal_error("Bad -s switch"); 429 429 } … … 438 438 } else { /* CD|USB size */ 439 439 if (flag_set['s']) { 440 if (process_the_s_switch( bkpinfo,flag_val['s'])) {440 if (process_the_s_switch(flag_val['s'])) { 441 441 fatal_error("Bad -s switch"); 442 442 } … … 672 672 } 673 673 if (flag_set['T']) { 674 sprintf(bkpinfo->tmpdir, "%s/tmp.mondo.%ld", flag_val['T'], 675 random() % 32768); 674 setup_tmpdir(flag_val['T']); 676 675 mr_asprintf(&tmp2, "touch %s/.foo.dat", flag_val['T']); 677 676 if (run_program_and_log_output(tmp2, 1)) { … … 683 682 mr_free(tmp2); 684 683 685 mr_asprintf(&tmp2, "ln -sf %s/.foo.dat %s/.bar.dat", flag_val['T'], 686 flag_val['T']); 684 mr_asprintf(&tmp2, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir); 687 685 if (run_program_and_log_output(tmp2, 1)) { 688 686 retval++; -
branches/stable/mondo/src/mondoarchive/mondo-cli.h
r1264 r1663 3 3 */ 4 4 5 int handle_incoming_parameters(int argc, char *argv[], 6 struct s_bkpinfo *bkpinfo); 7 int process_the_s_switch(struct s_bkpinfo *bkpinfo, char *value); 8 int process_switches(struct s_bkpinfo *bkpinfo, 9 char flag_val[128][MAX_STR_LEN], bool flag_set[128]); 5 int handle_incoming_parameters(int argc, char *argv[]); 6 int process_the_s_switch(char *value); 7 int process_switches(char flag_val[128][MAX_STR_LEN], bool flag_set[128]); 10 8 int retrieve_switches_from_command_line(int argc, char *argv[], 11 9 char flag_val[128][MAX_STR_LEN], -
branches/stable/mondo/src/mondoarchive/mondoarchive.c
r1639 r1663 62 62 /****************** subroutines used only here ******************/ 63 63 64 /* Reference to global bkpinfo */ 65 struct s_bkpinfo *bkpinfo; 66 67 /****************** subroutines used only by main.c ******************/ 64 68 65 69 /** … … 386 390 int main(int argc, char *argv[]) 387 391 { 388 struct s_bkpinfo *bkpinfo = NULL;389 392 struct stat stbuf; 390 393 char *tmp = NULL; … … 399 402 #endif 400 403 printf(_("Initializing...\n")); 404 405 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo)); 406 reset_bkpinfo(); 401 407 402 408 /* Reference a dummy cleanup function for mr_exit temporarily */ … … 463 469 malloc_libmondo_global_strings(); 464 470 diffs = 0; 465 bkpinfo = mr_malloc(sizeof(struct s_bkpinfo));466 471 if (stat(MONDO_CACHE, &stbuf) != 0) { 467 472 mr_mkdir(MONDO_CACHE,0x755); … … 580 585 } 581 586 582 if (pre_param_configuration( bkpinfo)) {587 if (pre_param_configuration()) { 583 588 fatal_error 584 589 ("Pre-param initialization phase failed. Please review the error messages above, make the specified changes, then try again. Exiting..."); … … 591 596 g_text_mode = FALSE; 592 597 setup_newt_stuff(); 593 res = interactively_obtain_media_parameters_from_user( bkpinfo,TRUE); /* yes, archiving */598 res = interactively_obtain_media_parameters_from_user(TRUE); /* yes, archiving */ 594 599 if (res) { 595 600 fatal_error … … 597 602 } 598 603 } else { 599 res = handle_incoming_parameters(argc, argv , bkpinfo);604 res = handle_incoming_parameters(argc, argv); 600 605 if (res) { 601 606 mr_msg(1, … … 609 614 610 615 /* Finish configuring global structures */ 611 if (post_param_configuration( bkpinfo)) {616 if (post_param_configuration()) { 612 617 fatal_error 613 618 ("Post-param initialization phase failed. Perhaps bad parameters were supplied to mondoarchive? Please review the documentation, error messages and logs. Exiting..."); … … 622 627 /* If we're meant to backup then backup */ 623 628 if (bkpinfo->backup_data) { 624 res = backup_data( bkpinfo);629 res = backup_data(); 625 630 retval += res; 626 631 if (res) { … … 634 639 /* If we're meant to verify then verify */ 635 640 if (bkpinfo->verify_data) { 636 res = verify_data( bkpinfo);641 res = verify_data(); 637 642 if (res < 0) { 638 643 mr_asprintf(&say_at_end2, _("%d difference%c found."), -res, … … 657 662 } 658 663 659 660 if (length_of_file("/tmp/changed.files") > 2) { 664 if (length_of_file(MINDI_CACHE"/changed.files") > 2) { 661 665 if (g_text_mode) { 662 666 log_to_screen 663 (_("Type 'less /tmp/changed.files' to see which files don't match the archives"));667 (_("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives")); 664 668 } else { 665 669 mr_msg(1, 666 _("Type 'less /tmp/changed.files' to see which files don't match the archives"));670 _("Type 'less "MINDI_CACHE"/changed.files' to see which files don't match the archives")); 667 671 mr_msg(2, "Calling popup_changelist_from_file()"); 668 popup_changelist_from_file( "/tmp/changed.files");672 popup_changelist_from_file(MINDI_CACHE"/changed.files"); 669 673 mr_msg(2, "Returned from popup_changelist_from_file()"); 670 674 } 671 675 } else { 672 unlink( "/tmp/changed.files");676 unlink(MINDI_CACHE"/changed.files"); 673 677 } 674 678 log_to_screen(say_at_end); … … 687 691 688 692 system("rm -f /var/cache/mondo-archive/last-backup.aborted"); 689 system("rm -Rf /tmp.mondo.* /mondo.scratch.*");690 693 if (!retval) { 691 694 printf(_("Mondoarchive ran OK.\n")); … … 698 701 chdir("/tmp"); // just in case there's something wrong with g_erase_tmpdir_and_scratchdir 699 702 system(g_erase_tmpdir_and_scratchdir); 703 704 /* assemble command string for deletion of Mondo's tmp directory */ 705 sprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir); 706 700 707 free_libmondo_global_strings(); 701 708 mr_free(bkpinfo); 702 703 unlink("/tmp/filelist.full");704 unlink("/tmp/filelist.full.gz");705 709 706 710 if (!g_cdrom_drive_is_here) { … … 714 718 mr_msg(1, "Time finished: %s", mr_date()); 715 719 mr_msg_close(); 720 721 /* remove Mondo's tmp directory */ 722 system(tmp); 723 paranoid_free(tmp); 716 724 717 725 if (!g_text_mode) {
Note:
See TracChangeset
for help on using the changeset viewer.