Changeset 1770 in MondoRescue for branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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");
Note:
See TracChangeset
for help on using the changeset viewer.