Changeset 3882 in MondoRescue for branches/3.3/mondo/src/common/libmondo-archive.c
- Timestamp:
- Mar 10, 2024, 12:46:53 AM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-archive.c
r3881 r3882 34 34 #include <unistd.h> 35 35 36 #define DVDRWFORMAT 137 38 36 /** 39 37 * Maximum number of filesets allowed in this function. … … 496 494 if ((cd_dev = find_optical_device()) != NULL) { 497 495 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 498 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd_dev);499 } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) {500 496 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd_dev); 501 497 } else { … … 759 755 ("Serious error(s) occurred already. I shan't try to write to media."); 760 756 } else { 761 res = 762 eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen); 757 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen); 763 758 if (res) { 764 759 log_to_screen("%s...failed to write", message_to_screen); … … 773 768 } 774 769 retval += res; 775 #ifdef DVDRWFORMAT 776 mr_asprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE); 777 if (g_backup_media_type == dvd 778 && (res || !run_program_and_log_output(tmp, 1))) { 779 log_to_screen 780 ("Failed to write to disk. I shall blank it and then try again."); 781 sleep(5); 782 /* reset error counter before trying to blank DVD */ 783 retval -= res; 784 sync(); 785 pause_for_N_seconds(5, "Letting DVD drive settle"); 786 787 // dvd+rw-format --- OPTION 2 788 if (!bkpinfo->please_dont_eject) { 789 log_to_screen("Ejecting media to clear drive status."); 790 eject_device(bkpinfo->media_device); 791 inject_device(bkpinfo->media_device); 770 if (bkpinfo->wipe_media_first) { 771 mr_asprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE); 772 if (g_backup_media_type == optical && (res || !run_program_and_log_output(tmp, 1))) { 773 log_to_screen("Failed to write to disk. I shall blank it and then try again."); 774 sleep(5); 775 /* reset error counter before trying to blank media */ 776 retval -= res; 777 sync(); 778 pause_for_N_seconds(5, "Letting DVD drive settle"); 779 780 if (!bkpinfo->please_dont_eject) { 781 log_to_screen("Ejecting media to clear drive status."); 782 eject_device(bkpinfo->media_device); 783 inject_device(bkpinfo->media_device); 784 } 785 pause_for_N_seconds(5, "Letting optical drive settle"); 786 787 // dvd+rw-format --- OPTION 2 788 if (bkpinfo->media_device) { 789 mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device); 790 } else { 791 mr_asprintf(sz_blank_disk, "dvd+rw-format"); 792 } 793 log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk); 794 res = run_external_binary_with_percentage_indicator_NEW("Blanking optical disk", sz_blank_disk); 795 if (res) { 796 log_to_screen("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath..."); 797 pause_for_N_seconds(5, "Letting optical drive settle... and trying again."); 798 res = run_external_binary_with_percentage_indicator_NEW("Blanking optical disk", sz_blank_disk); 799 if (res) { 800 log_to_screen("Format failed a second time."); 801 } 802 } else { 803 log_to_screen 804 ("Format succeeded. Sleeping for 5 seconds to take a breath..."); 805 } 806 mr_free(sz_blank_disk); 807 pause_for_N_seconds(5, "Letting optical drive settle"); 808 if (!bkpinfo->please_dont_eject) { 809 log_to_screen("Ejecting media to clear drive status."); 810 eject_device(bkpinfo->media_device); 811 inject_device(bkpinfo->media_device); 812 } 813 pause_for_N_seconds(5, "Letting optical drive settle"); 814 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen); 815 retval += res; 816 if (!bkpinfo->please_dont_eject) { 817 log_to_screen("Ejecting media."); 818 eject_device(bkpinfo->media_device); 819 } 820 if (res) { 821 log_to_screen("Dagnabbit. It still failed."); 822 } else { 823 log_to_screen 824 ("OK, this time I successfully backed up to DVD."); 825 } 792 826 } 793 pause_for_N_seconds(5, "Letting DVD drive settle"); 794 if (bkpinfo->media_device) { 795 mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device); 796 } else { 797 mr_asprintf(sz_blank_disk, "dvd+rw-format"); 798 } 799 log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk); 800 res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk); 801 if (res) { 802 log_to_screen("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath..."); 803 pause_for_N_seconds(5, "Letting DVD drive settle... and trying again."); 804 res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk); 805 if (res) { 806 log_to_screen("Format failed a second time."); 807 } 808 } else { 809 log_to_screen 810 ("Format succeeded. Sleeping for 5 seconds to take a breath..."); 811 } 812 mr_free(sz_blank_disk); 813 pause_for_N_seconds(5, "Letting DVD drive settle"); 814 if (!bkpinfo->please_dont_eject) { 815 log_to_screen("Ejecting media to clear drive status."); 816 eject_device(bkpinfo->media_device); 817 inject_device(bkpinfo->media_device); 818 } 819 pause_for_N_seconds(5, "Letting DVD drive settle"); 820 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen); 821 retval += res; 822 if (!bkpinfo->please_dont_eject) { 823 log_to_screen("Ejecting media."); 824 eject_device(bkpinfo->media_device); 825 } 826 if (res) { 827 log_to_screen("Dagnabbit. It still failed."); 828 } else { 829 log_to_screen 830 ("OK, this time I successfully backed up to DVD."); 831 } 832 } 833 mr_free(tmp); 834 #endif 835 if (g_backup_media_type == dvd && !bkpinfo->please_dont_eject) { 827 mr_free(tmp); 828 } 829 if (g_backup_media_type == optical && !bkpinfo->please_dont_eject) { 836 830 eject_device(bkpinfo->media_device); 837 831 } … … 1221 1215 log_msg(1, "Closing tape/CD/USB ... "); 1222 1216 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1223 /* write tape /cdstream*/1217 /* write tape */ 1224 1218 closeout_tape(); 1225 1219 } else { … … 2494 2488 * @param bkpinfo The backup information structure. Fields used: 2495 2489 * - @c backup_media_type 2496 * - @c cdrw_speed2497 2490 * - @c prefix 2498 2491 * - @c isodir … … 2531 2524 mvaddstr_and_log_it(g_currentY, 0, "Preparing to archive your data"); 2532 2525 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 2533 if (bkpinfo->backup_media_type == cdstream) { 2534 openout_cdstream(bkpinfo->media_device, bkpinfo->cdrw_speed); 2535 } else { 2536 openout_tape(); /* sets g_tape_stream */ 2537 } 2526 openout_tape(); /* sets g_tape_stream */ 2538 2527 if (!g_tape_stream) { 2539 2528 fatal_error("Cannot open backup (streaming) device"); … … 2545 2534 log_msg(1, "Backing up to USB's"); 2546 2535 } else { 2547 log_msg(1, "Backing up to CD's");2536 log_msg(1, "Backing up to optical drive's"); 2548 2537 } 2549 2538 } … … 2850 2839 case optical: 2851 2840 mr_asprintf(value, "optical"); 2852 break;2853 case cdstream:2854 mr_asprintf(value, "cdstream");2855 2841 break; 2856 2842 case tape: … … 3077 3063 assert(bkpinfo != NULL); 3078 3064 3079 if (bkpinfo->backup_media_type == dvd) { 3080 #ifdef DVDRWFORMAT 3081 if ((tmp = find_home_of_exe("dvd+rw-format")) == NULL) { 3065 if (bkpinfo->backup_media_type == optical) { 3066 if (bkpinfo->wipe_media_first) { 3067 if ((tmp = find_home_of_exe("dvd+rw-format")) == NULL) { 3068 mr_free(tmp); 3069 fatal_error("Cannot find dvd+rw-format. Please install it or fix your PATH."); 3070 } 3082 3071 mr_free(tmp); 3083 fatal_error("Cannot find dvd+rw-format. Please install it or fix your PATH."); 3084 } 3085 mr_free(tmp); 3086 #endif 3072 } 3087 3073 if ((tmp = find_home_of_exe("growisofs")) == NULL) { 3088 3074 mr_free(tmp); … … 3158 3144 // FIXME 3159 3145 } 3160 mvaddstr_and_log_it(g_currentY, 0, 3161 "Verifying archives against live filesystem"); 3162 if (bkpinfo->backup_media_type == cdstream) { 3163 strcpy(bkpinfo->media_device, "/dev/cdrom"); 3164 } 3146 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against live filesystem"); 3165 3147 verify_tape_backups(); 3166 3148 mvaddstr_and_log_it(g_currentY++, 74, "Done.");
Note:
See TracChangeset
for help on using the changeset viewer.