Changeset 1770 in MondoRescue for branches/stable/mondo/src/mondorestore
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- Location:
- branches/stable/mondo/src/mondorestore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/mondorestore/mondo-prep.c
r1555 r1770 2250 2250 strcpy(program, "mkfs.jfs"); 2251 2251 } else if (strcmp(format, "ext3") == 0) { 2252 strcpy(program, "mkfs -t ext 2 -F -j-q");2252 strcpy(program, "mkfs -t ext3 -F -q"); 2253 2253 } else if (strcmp(format, "minix") == 0) { 2254 2254 strcpy(program, "mkfs.minix"); -
branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c
r1670 r1770 138 138 139 139 if (retval) { 140 if (!(fout = fopen(M INDI_CACHE"/changed.txt", "a"))) {140 if (!(fout = fopen(MONDO_CACHE"/changed.txt", "a"))) { 141 141 fatal_error("Cannot openout changed.txt"); 142 142 } … … 306 306 if (length_of_file(logfile) > 5) { 307 307 mr_asprintf(&command, 308 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "M INDI_CACHE"/changed.txt",308 "sed s/': \\\"'/\\|/ %s | sed s/'\\\": '/\\|/ | cut -d'|' -f2 | sort -u | grep -vE \"^dev/.*\" >> "MONDO_CACHE"/changed.txt", 309 309 logfile); 310 310 system(command); … … 464 464 getcwd(new, MAX_STR_LEN - 1); 465 465 insist_on_this_cd_number(g_current_media_number); 466 unlink(M INDI_CACHE"/changed.txt");466 unlink(MONDO_CACHE"/changed.txt"); 467 467 468 468 resA = compare_all_tarballs(); 469 469 resB = compare_all_biggiefiles(); 470 470 chdir(cwd); 471 noof_changed_files = count_lines_in_file(M INDI_CACHE"/changed.txt");471 noof_changed_files = count_lines_in_file(MONDO_CACHE"/changed.txt"); 472 472 if (noof_changed_files) { 473 473 log_to_screen(_("%ld files do not match the backup "), 474 474 noof_changed_files); 475 mr_asprintf(&command, "cat "M INDI_CACHE"/changed.txt >> %s", MONDO_LOGFILE);475 mr_asprintf(&command, "cat "MONDO_CACHE"/changed.txt >> %s", MONDO_LOGFILE); 476 476 paranoid_system(command); 477 477 mr_free(command); … … 579 579 } 580 580 581 if (count_lines_in_file(M INDI_CACHE"/changed.txt") > 0) {581 if (count_lines_in_file(MONDO_CACHE"/changed.txt") > 0) { 582 582 mvaddstr_and_log_it(g_currentY++, 0, 583 583 _ 584 584 ("Differences found while files were being compared.")); 585 streamline_changes_file(M INDI_CACHE"/changed.files", MINDI_CACHE"/changed.txt");586 if (count_lines_in_file(M INDI_CACHE"/changed.files") <= 0) {585 streamline_changes_file(MONDO_CACHE"/changed.files", MONDO_CACHE"/changed.txt"); 586 if (count_lines_in_file(MONDO_CACHE"/changed.files") <= 0) { 587 587 mvaddstr_and_log_it(g_currentY++, 0, 588 588 _ … … 591 591 ("The differences were logfiles and temporary files. Your archives are fine.")); 592 592 } else { 593 q = count_lines_in_file(M INDI_CACHE"/changed.files");593 q = count_lines_in_file(MONDO_CACHE"/changed.files"); 594 594 mr_asprintf(&tmp, _("%ld significant difference%s found."), q, 595 595 (q != 1) ? "s" : ""); … … 608 608 chdir(bkpinfo->restore_path); 609 609 getcwd(new, MAX_STR_LEN - 1); 610 popup_changelist_from_file(M INDI_CACHE"/changed.files");610 popup_changelist_from_file(MONDO_CACHE"/changed.files"); 611 611 mr_msg(2, "Returning from popup_changelist_from_file()"); 612 612 chdir(cwd); … … 666 666 res = verify_tape_backups(); 667 667 chdir(dir); 668 if (length_of_file(M INDI_CACHE"/changed.txt") > 2669 && length_of_file(M INDI_CACHE"/changed.files") > 2) {668 if (length_of_file(MONDO_CACHE"/changed.txt") > 2 669 && length_of_file(MONDO_CACHE"/changed.files") > 2) { 670 670 mr_msg(0, 671 "Type 'less "M INDI_CACHE"/changed.files' to see which files don't match the archives");671 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives"); 672 672 mr_msg(2, "Calling popup_changelist_from_file()"); 673 popup_changelist_from_file(M INDI_CACHE"/changed.files");673 popup_changelist_from_file(MONDO_CACHE"/changed.files"); 674 674 mr_msg(2, "Returned from popup_changelist_from_file()"); 675 675 } -
branches/stable/mondo/src/mondorestore/mondo-rstr-newt.c
r1663 r1770 182 182 mr_asprintf(&format_str, "ufs"); 183 183 #else 184 mr_asprintf(&format_str, "ext 2");184 mr_asprintf(&format_str, "ext3"); 185 185 #endif 186 186 newtOpenWindow(20, 5, 48, 10, _("Add entry")); -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools-EXT.h
r1663 r1770 8 8 extern int iso_fiddly_bits(bool nuke_me_please); 9 9 extern void kill_petris(void); 10 extern int mount_ cdrom();10 extern int mount_media(); 11 11 extern int mount_all_devices(struct mountlist_itself *, bool); 12 12 extern void protect_against_braindead_sysadmins(void); -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
r1769 r1770 342 342 } 343 343 if (!IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 344 mount_ cdrom();344 mount_media(); 345 345 } 346 346 i = what_number_cd_is_this(); /* has the side-effect of calling mount_cdrom() */ … … 439 439 mr_msg(2, "command='%s'", command); 440 440 } 441 mr_free(additional_parameters);442 443 441 res = run_program_and_log_output(command, TRUE); 444 if (res && (strstr(command, "xattr") || strstr(command, "acl"))) {445 mr_msg(1, "Re-trying without the fancy extra parameters");446 mr_free(command);447 448 mr_asprintf(&command, "mount -t %s %s %s 2>> %s", format, device,449 mountdir, MONDO_LOGFILE);450 res = run_program_and_log_output(command, TRUE);451 }452 442 if (res) { 453 443 mr_msg(1, "Unable to mount device %s (type %s) at %s", device, … … 533 523 534 524 mr_asprintf(&format, mountlist->el[lino].format); 525 /* BERLIOS: removed as it doen't make sens to not mount ext3 partitions as ext3 535 526 if (!strcmp(format, "ext3")) { 536 527 mr_free(format); 537 528 mr_asprintf(&format, "ext2"); 538 529 } 530 */ 539 531 res = mount_device(mountlist->el[lino].device, 540 532 mountlist->el[lino].mountpoint, … … 593 585 594 586 595 /* *596 * Mount the CD-ROMdevice at /mnt/cdrom.597 598 599 600 601 602 603 604 int mount_ cdrom()587 /* 588 * Mount the CD-ROM or USB device at /mnt/cdrom. 589 * @param bkpinfo The backup information structure. Fields used: 590 * - @c bkpinfo->backup_media_type 591 * - @c bkpinfo->disaster_recovery 592 * - @c bkpinfo->isodir 593 * - @c bkpinfo->media_device 594 * @return 0 for success, nonzero for failure. 595 */ 596 int mount_media() 605 597 { 606 598 char *mount_cmd = NULL; … … 614 606 if (bkpinfo->backup_media_type == tape 615 607 || bkpinfo->backup_media_type == udev) { 616 mr_msg(8, "Tape/udev. Therefore, no need to mount CDROM.");608 mr_msg(8, "Tape/udev. Therefore, no need to mount a media."); 617 609 return 0; 618 610 } 619 611 620 612 if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) { 621 mr_msg(2, "mount_ cdrom() - CDalready mounted. Fair enough.");613 mr_msg(2, "mount_media() - media already mounted. Fair enough."); 622 614 return (0); 623 615 } … … 661 653 MNT_CDROM); 662 654 #endif 655 } else if (bkpinfo->backup_media_type == usb) { 656 mr_asprintf(&mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM); 663 657 } else if (strstr(bkpinfo->media_device, "/dev/")) 664 658 #ifdef __FreeBSD__ … … 679 673 mr_allocstr(bkpinfo->media_device, 680 674 last_line_of_file("/tmp/CDROM-LIVES-HERE")); 675 } else { 676 find_cdrom_device(bkpinfo->media_device, TRUE); 681 677 } 682 678 683 679 #ifdef __FreeBSD__ 684 680 mr_asprintf(&mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, 685 681 MNT_CDROM); 686 682 #else 687 683 mr_asprintf(&mount_cmd, "mount %s -t iso9660 -o ro %s", 688 684 bkpinfo->media_device, MNT_CDROM); 689 685 #endif 690 691 } 692 mr_msg(2, "(mount_ cdrom) --- command = %s", mount_cmd);686 } 687 688 mr_msg(2, "(mount_media) --- command = %s", mount_cmd); 693 689 for (i = 0; i < 2; i++) { 694 690 res = run_program_and_log_output(mount_cmd, FALSE); … … 706 702 mr_msg(2, "Failed, despite %d attempts", i); 707 703 } else { 708 mr_msg(2, "Mounted CD-ROM driveOK");704 mr_msg(2, "Mounted media OK"); 709 705 } 710 706 return (res); 711 707 } 708 712 709 /************************************************************************** 713 *END_MOUNT_CDROM * 714 **************************************************************************/ 710 *END_MOUNT_CDROM * 711 **************************************************************************/ 712 715 713 716 714 … … 784 782 } else if (!strcmp(value, "dvd")) { 785 783 bkpinfo->backup_media_type = dvd; 784 } else if (!strcmp(value, "usb")) { 785 bkpinfo->backup_media_type = usb; 786 bkpinfo->please_dont_eject = TRUE; 786 787 } else if (!strcmp(value, "iso")) { 787 788 // Patch by Conor Daly - 2004/07/12 … … 824 825 mr_allocstr(bkpinfo->prefix,envtmp1); 825 826 } 826 827 } else if (bkpinfo->backup_media_type == usb) { 828 if (read_cfg_var(cfg_file, "usb-dev", value)) { 829 fatal_error("Cannot get USB device name from cfg file"); 830 } 831 mr_asprintf(&tmp, "%s1", value); 832 mr_allocstr(bkpinfo->media_device, tmp); 833 mr_free(tmp); 834 835 mr_asprintf(&tmp, "Backup medium is USB --- dev=%s", bkpinfo->media_device); 836 log_msg(2, tmp); 837 mr_free(tmp); 827 838 } else if (!strcmp(value, "tape")) { 828 839 bkpinfo->backup_media_type = tape; … … 908 919 bkpinfo->differential = TRUE; 909 920 } 921 910 922 mr_msg(2, "differential var = '%s'", value); 911 923 if (bkpinfo->differential) { … … 913 925 } else { 914 926 mr_msg(2, "This is a regular (full) backup"); 915 }916 927 917 928 read_cfg_var(g_mondo_cfg_file, "please-dont-eject", tmp); … … 1023 1034 mr_free(iso_path); 1024 1035 } 1036 /* bkpinfo->isodir should now be the true path to prefix-1.iso etc... */ 1037 if (bkpinfo->backup_media_type == iso) { 1038 sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path); 1039 } 1025 1040 } 1026 1041 … … 1043 1058 return (0); 1044 1059 } 1060 1045 1061 /************************************************************************** 1046 1062 *END_READ_CFG_FILE_INTO_BKPINFO * … … 2111 2127 } else { 2112 2128 mr_msg(2, "gcffa --- calling mount_cdrom now :)"); 2113 if (!mount_ cdrom()) {2129 if (!mount_media()) { 2114 2130 mr_msg(2, 2115 2131 "gcffa --- managed to mount CD; so, no need for Plan B"); -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.h
r1663 r1770 8 8 int iso_fiddly_bits(bool nuke_me_please); 9 9 void kill_petris(void); 10 int mount_ cdrom();10 int mount_media(); 11 11 int mount_device(char *, char *, char *, bool); 12 12 int mount_all_devices(struct mountlist_itself *, bool); -
branches/stable/mondo/src/mondorestore/mondorestore.c
r1769 r1770 437 437 read_cfg_file_into_bkpinfo(g_mondo_cfg_file); 438 438 iamhere("Done loading config file; resizing ML"); 439 mr_asprintf(&tmp,bkpinfo->prefix); 440 if (popup_and_get_string 441 ("Prefix", "Prefix of your ISO images ?", tmp, MAX_STR_LEN / 4)) { 442 mr_free(bkpinfo->prefix); 443 bkpinfo->prefix = tmp; 444 mr_msg(1, "Prefix set to %s",bkpinfo->prefix); 439 if (bkpinfo->backup_media_type != usb) { 440 mr_asprintf(&tmp,bkpinfo->prefix); 441 if (popup_and_get_string 442 ("Prefix", "Prefix of your ISO images ?", tmp, MAX_STR_LEN / 4)) { 443 mr_free(bkpinfo->prefix); 444 bkpinfo->prefix = tmp; 445 mr_msg(1, "Prefix set to %s",bkpinfo->prefix); 446 } 445 447 } 446 448 … … 924 926 if (!g_restoring_live_from_cd) { 925 927 popup_and_OK 926 (_("Please insert tape/CD , then hit 'OK' to continue."));928 (_("Please insert tape/CD/USB key, then hit 'OK' to continue.")); 927 929 sleep(1); 928 930 } … … 2588 2590 mvaddstr_and_log_it(g_currentY, 0, _("Preparing to read your archives")); 2589 2591 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2590 mount_ cdrom();2592 mount_media(); 2591 2593 mvaddstr_and_log_it(g_currentY++, 0, 2592 2594 _("Restoring OS and data from streaming media")); … … 2606 2608 } else { 2607 2609 mvaddstr_and_log_it(g_currentY++, 0, 2608 _("Restoring OS and data from CD 2609 mount_ cdrom();2610 _("Restoring OS and data from CD/USB ")); 2611 mount_media(); 2610 2612 resA = restore_all_tarballs_from_CD(filelist); 2611 2613 resB = restore_all_biggiefiles_from_CD(filelist); … … 2876 2878 } 2877 2879 mkdir(MNT_CDROM, 0x770); 2880 make_hole_for_dir(MONDO_CACHE); 2878 2881 2879 2882 /* Backup original mountlist.txt */ … … 3155 3158 /* clean up at the end */ 3156 3159 if (retval) { 3157 if (does_file_exist(M INDI_CACHE"/changed.files")) {3160 if (does_file_exist(MONDO_CACHE"/changed.files")) { 3158 3161 log_to_screen 3159 (_("See "M INDI_CACHE"/changed.files for list of files that have changed."));3162 (_("See "MONDO_CACHE"/changed.files for list of files that have changed.")); 3160 3163 } 3161 3164 mvaddstr_and_log_it(g_currentY++,
Note:
See TracChangeset
for help on using the changeset viewer.