Changeset 3882 in MondoRescue for branches/3.3
- Timestamp:
- Mar 10, 2024, 12:46:53 AM (4 months ago)
- Location:
- branches/3.3/mondo/src
- Files:
-
- 15 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."); -
branches/3.3/mondo/src/common/libmondo-cli.c
r3881 r3882 310 310 } 311 311 312 if (g_kernel_version >= 2.6 && !flag_set['d'] && flag_set['c'] && (! bkpinfo->restore_data)) {313 fatal_error("If you are using the 2.6.x kernel, please specify the CD-R(W) device.");314 }315 316 317 312 if (flag_set['J']) { 318 313 if (flag_set['I']) { … … 325 320 326 321 if (flag_set['c'] && (! bkpinfo->restore_data)) { 327 if (system("which cdrecord > /dev/null 2> /dev/null") && system("which dvdrecord > /dev/null 2> /dev/null")) { 328 fatal_error("Please install dvdrecord/cdrecord and try again."); 329 } else { 330 log_msg(3, "flag_val['c'] = %s", flag_val['c']); 331 if (flag_set['c']) { 332 bkpinfo->cdrw_speed = atoi(flag_val['c']); 333 } 322 if (system("which cdrecord > /dev/null 2> /dev/null")) { 323 fatal_error("Please install cdrecord and try again."); 334 324 } 335 325 if (!flag_set['d']) { … … 516 506 if (flag_set['c']) { 517 507 bkpinfo->backup_media_type = optical; 518 }519 if (flag_set['C']) {520 bkpinfo->backup_media_type = cdstream;521 508 } 522 509 if (flag_set['i']) { … … 707 694 } 708 695 709 if (!flag_set['d'] && (flag_set['c'] || flag_set['C'])) { 710 tmp1 = mr_popup_and_get_string("Device", "Please specify the device", bkpinfo->media_device); 711 if (tmp1 == NULL) { 712 retval++; 713 log_to_screen("User opted to cancel."); 714 } else { 715 mr_free(bkpinfo->media_device); 716 bkpinfo->media_device = tmp1; 717 } 696 if (!flag_set['d'] && flag_set['c']) { 697 tmp1 = mr_popup_and_get_string("Device", "Please specify the device", bkpinfo->media_device); 698 if (tmp1 == NULL) { 699 retval++; 700 log_to_screen("User opted to cancel."); 718 701 } else { 719 } 720 721 if ((!flag_set['d'] && !flag_set['n'] && !flag_set['C']) && (! bkpinfo->restore_data)) { 702 mr_free(bkpinfo->media_device); 703 bkpinfo->media_device = tmp1; 704 } 705 } 706 707 if ((!flag_set['d'] && !flag_set['n']) && (! bkpinfo->restore_data)) { 722 708 retval++; 723 709 log_to_screen("Please specify the backup device/directory.\n"); -
branches/3.3/mondo/src/common/libmondo-devices.c
r3881 r3882 715 715 mr_asprintf(output, "%s", "optical"); 716 716 break; 717 case cdstream:718 mr_asprintf(output, "%s", "cdstream");719 break;720 717 case netfs: 721 718 mr_asprintf(output, "%s", "netfs"); … … 2058 2055 } 2059 2056 2060 bkpinfo->compression_level = (bkpinfo->backup_media_type == cdstream) ? 1 :5;2057 bkpinfo->compression_level = 5; 2061 2058 if ((bkpinfo->compression_level = which_compression_level()) == -1) { 2062 2059 log_to_screen("User has chosen not to backup the machine"); 2063 2060 finish(1); 2064 2061 } 2065 bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4; 2066 bkpinfo->use_lzo = (bkpinfo->backup_media_type == cdstream) ? TRUE : FALSE; 2062 bkpinfo->use_lzo = FALSE; 2067 2063 } 2068 2064 mvaddstr_and_log_it(2, 0, " "); … … 2096 2092 2097 2093 if (archiving_to_media) { 2098 if (bkpinfo->backup_media_type == dvd) { 2099 strcpy(tmp1, "1"); 2094 if (bkpinfo->backup_media_type == optical) { 2100 2095 mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB 2101 log_msg(1, "Setting to DVD defaults ");2096 log_msg(1, "Setting to DVD defaults ~4.4GB"); 2102 2097 } else { 2103 strcpy(tmp1, "4"); 2104 mr_asprintf(sz_size, "%d", 650); 2105 log_msg(1, "Setting to CD defaults"); 2106 } 2107 2108 mr_asprintf(comment, "What speed is your %s writer?", mds); 2109 if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) { 2110 if (!popup_and_get_string("Speed", comment, tmp1, 4)) { 2111 log_to_screen("User has chosen not to backup the machine"); 2112 mr_free(comment); 2113 finish(1); 2114 } 2115 } 2116 mr_free(comment); 2117 bkpinfo->cdrw_speed = atoi(tmp1); // if DVD then this shouldn't ever be used anyway :) 2118 2119 strcpy(tmp1, sz_size); 2098 mr_asprintf(sz_size, "%d", 0); // No value for USB 2099 } 2100 2120 2101 mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds); 2121 if (!popup_and_get_string("Size", comment, tmp1, 5)) { 2102 tmp1 = popup_and_get_string("Size", comment, sz_size, 5)) { 2103 if (!tmp1) { 2122 2104 log_to_screen("User has chosen not to backup the machine"); 2123 2105 finish(1); 2124 } 2125 mr_asprintf(sz_size, "%s",tmp1);2126 bkpinfo->media_size = atoi(sz_size);2127 2106 } else { 2107 bkpinfo->media_size = atoi(tmp1); 2108 } 2109 mr_free(tmp1); 2128 2110 if (bkpinfo->media_size <= 0) { 2129 2111 log_to_screen("User has chosen not to backup the machine"); … … 2131 2113 } 2132 2114 } 2133 /* No break because we continue even for usb */2134 case cdstream:2135 2115 2136 2116 // If media_device not found ask … … 2166 2146 } 2167 2147 mr_free(mds); 2168 2169 if (bkpinfo->backup_media_type == cdstream) {2170 bkpinfo->media_size = 650;2171 }2172 2148 break; 2149 2173 2150 case udev: 2174 2151 if (!ask_me_yes_or_no -
branches/3.3/mondo/src/common/libmondo-stream-EXT.h
r3870 r3882 10 10 extern int maintain_collection_of_recent_archives(char *td, 11 11 char *latest_fname); 12 extern int openin_cdstream();13 12 extern int openin_tape(); 14 extern int openout_cdstream(char *cddev, int speed);15 13 extern int openout_tape(); 16 14 extern int read_file_from_stream_to_file( … … 38 36 extern int write_header_block_to_stream(off_t length_of_incoming_file, const char *filename, int control_char); 39 37 extern void wrong_marker(int should_be, int it_is); 40 extern int closein_cdstream();41 38 extern int read_EXAT_files_from_tape( 42 39 long long *ptmp_size, char *tmp_fname, -
branches/3.3/mondo/src/common/libmondo-stream.c
r3879 r3882 53 53 /** 54 54 * The file pointer for the opened tape/CD stream. 55 * Opened and closed by openin_tape(), openin_cdstream(),56 * openout_tape(), openout_cdstream(), closein_tape(), closein_cdstream(),57 * closeout_tape() , and closeout_cdstream().55 * Opened and closed by openin_tape(), 56 * openout_tape(), closein_tape(), 57 * closeout_tape(). 58 58 */ 59 59 FILE *g_tape_stream = NULL; … … 165 165 * @return 0 for success, nonzero for failure. 166 166 * @note This should be called by restore processes only. 167 * @note This function also works for cdstreams for now, but don't count on this behavior.168 167 * @bug @p bkpinfo parameter is unused. 169 168 */ … … 217 216 218 217 219 220 /**221 * Close the global output file descriptor which Mondo has used to read222 * from the CD stream.223 * @param bkpinfo The backup information structure. Passed directly to closein_tape().224 * @return 0 for success, nonzero for failure.225 * @note This should be called by restore processes only.226 */227 int closein_cdstream()228 {229 return (closein_tape());230 }231 218 232 219 /** … … 343 330 log_it("New tape requested."); 344 331 insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too 345 if (bkpinfo->backup_media_type == cdstream) { 346 mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE); 347 log_it("Opening OUT to next CD with the command"); 348 log_it(command); 349 log_it("Let's see what happens, shall we?"); 350 g_tape_stream = popen(command, "w"); 351 mr_free(command); 352 353 if (!g_tape_stream) { 354 log_to_screen("Failed to openout to cdstream (fifo)"); 355 return (1); 356 } 357 } else { 358 log_it("Opening OUT to next tape"); 359 if (!(g_tape_stream = open_device_via_buffer(bkpinfo->media_device, 'w', bkpinfo->internal_tape_block_size))) { 360 log_OS_error(g_tape_fifo); 361 log_to_screen("Cannot openin stream device"); 362 return (1); 363 } 332 log_it("Opening OUT to next tape"); 333 if (!(g_tape_stream = open_device_via_buffer(bkpinfo->media_device, 'w', bkpinfo->internal_tape_block_size))) { 334 log_OS_error(g_tape_fifo); 335 log_to_screen("Cannot openin stream device"); 336 return (1); 364 337 } 365 338 g_tape_posK = 0; … … 1241 1214 * - @c bkpinfo->tmpdir 1242 1215 * @return 0 for success, nonzero for failure. 1243 * @note This will also work with a cdstream for now, but don't count on this behavior.1244 1216 */ 1245 1217 int openin_tape() … … 1372 1344 1373 1345 /** 1374 * Open the CD stream for input.1375 * @param bkpinfo The backup information structure. Passed to openin_tape().1376 * @return 0 for success, nonzero for failure.1377 * @note Equivalent to openin_tape() for now, but don't count on this behavior.1378 */1379 int openin_cdstream()1380 {1381 return (openin_tape());1382 }1383 1384 /**1385 1346 * Return the non-rewinding device when passed the normal one 1386 1347 * @param tapedev The tape device to open for writing. … … 1481 1442 1482 1443 return(res); 1483 }1484 1485 1486 /**1487 * Start writing to a CD stream.1488 * @param cddev The CD device to openout via cdrecord.1489 * @param speed The speed to write at.1490 * @return 0 for success, nonzero for failure.1491 * @note This should be called only from backup processes.1492 */1493 int openout_cdstream(char *cddev, int speed)1494 {1495 /*@ buffers ***************************************************** */1496 char *command = NULL;1497 1498 /*@ end vars *************************************************** */1499 1500 if (cddev == NULL) {1501 log_to_screen("Failed to openout NULL cddev");1502 return (1);1503 }1504 /* add 'dummy' if testing */1505 mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);1506 /* initialise the catalog */1507 g_current_media_number = 1;1508 if (!(g_tapecatalog = malloc(sizeof(struct s_tapecatalog)))) {1509 fatal_error("Cannot alloc mem for tape catalog");1510 }1511 g_tapecatalog->entries = 0;1512 /* log stuff */1513 log_it("Opening OUT cdstream with the command");1514 log_it(command);1515 /* log_it("Let's see what happens, shall we?"); */1516 g_tape_stream = popen(command, "w");1517 mr_free(command);1518 1519 if (g_tape_stream) {1520 return (0);1521 } else {1522 log_to_screen("Failed to openout to cdstream (fifo)");1523 return (1);1524 }1525 1444 } 1526 1445 -
branches/3.3/mondo/src/common/libmondo-string.c
r3881 r3882 982 982 mr_asprintf(type_of_backup, "tape"); 983 983 break; 984 case cdstream:985 mr_asprintf(type_of_backup, "CDR");986 break;987 984 case udev: 988 985 mr_asprintf(type_of_backup, "udev"); -
branches/3.3/mondo/src/common/libmondo-tools.c
r3881 r3882 344 344 * - Used: @c bkpinfo->backup_data 345 345 * - Used: @c bkpinfo->backup_media_type 346 * - Used: @c bkpinfo->cdrw_speed347 346 * - Used: @c bkpinfo->compression_level 348 347 * - Used: @c bkpinfo->include_paths … … 434 433 } 435 434 436 // DVD 437 438 if (bkpinfo->backup_media_type == dvd) { 435 if (bkpinfo->backup_media_type == optical) { 439 436 if ((cdr_exe = find_home_of_exe("growisofs")) == NULL) { 440 437 fatal_error("Please install growisofs."); … … 493 490 if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) { 494 491 if ((cdr_exe = find_home_of_exe("wodim")) == NULL) { 495 if ((cdr_exe = find_home_of_exe("dvdrecord")) == NULL) { 496 fatal_error("Please install either cdrecord, wodim or dvdrecord."); 497 } 492 fatal_error("Please install either cdrecord or wodim."); 498 493 } 499 494 } … … 543 538 } 544 539 log_it("bkpinfo->call_before_iso = %s", bkpinfo->call_before_iso); 545 mr_asprintf(bkpinfo->call_make_iso, "%s %s -v %s fs=4m dev=%s speed=%d %s/"MONDO_TMPISOS, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed, bkpinfo->tmpdir);540 mr_asprintf(bkpinfo->call_make_iso, "%s %s -v %s fs=4m dev=%s %s/"MONDO_TMPISOS, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->tmpdir); 546 541 } else { 547 mr_asprintf(bkpinfo->call_make_iso, "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s speed=%d -", mondo_mkisofs_sz, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device, bkpinfo->cdrw_speed);542 mr_asprintf(bkpinfo->call_make_iso, "%s . 2>> _ERR_ | %s %s %s fs=4m dev=%s -", mondo_mkisofs_sz, cdr_exe, (bkpinfo->please_dont_eject) ? " " : "-eject", extra_cdrom_params, bkpinfo->media_device); 548 543 } 549 544 mr_free(cdr_exe); … … 994 989 bkpinfo->differential = 0; 995 990 bkpinfo->please_dont_eject = FALSE; 996 bkpinfo->cdrw_speed = 0;997 991 bkpinfo->manual_cd_tray = FALSE; 998 992 bkpinfo->nonbootable_backup = FALSE; -
branches/3.3/mondo/src/common/mondostructures.h
r3881 r3882 611 611 */ 612 612 bool please_dont_eject; 613 614 /**615 * The speed of the CD-R[W] drive.616 */617 int cdrw_speed;618 613 619 614 /** -
branches/3.3/mondo/src/common/newt-specific.c
r3881 r3882 1226 1226 * Ask the user which backup media type they would like to use. 1227 1227 * The choices are @p none (exit to shell), @c optical, 1228 * @c tape, @c cdstream, @cudev (only when @p g_text_mode is TRUE), @c netfs,1228 * @c tape, @c udev (only when @p g_text_mode is TRUE), @c netfs, 1229 1229 * and @c iso. 1230 1230 * @param restoring TRUE if we're restoring, FALSE if we're backing up. … … 1240 1240 char *title_sz = NULL; 1241 1241 char *minimsg_sz = NULL; 1242 static t_bkptype possible_bkptypes[] = { none, optical, tape, cdstream,udev, netfs, iso };1243 static char *possible_responses[] = { "none", "optical", "tape", " cdstream", "udev", "netfs", "iso", NULL };1242 static t_bkptype possible_bkptypes[] = { none, optical, tape, udev, netfs, iso }; 1243 static char *possible_responses[] = { "none", "optical", "tape", "udev", "netfs", "iso", NULL }; 1244 1244 char *outstr = NULL; 1245 1245 char *instr = NULL; -
branches/3.3/mondo/src/include/my-stuff.h
r3879 r3882 170 170 * Determine whether @p x (t_bkptype) is a streaming backup. 171 171 */ 172 #define IS_THIS_A_STREAMING_BACKUP(x) (x == tape || x == udev || x == cdstream)172 #define IS_THIS_A_STREAMING_BACKUP(x) (x == tape || x == udev) 173 173 174 174 -
branches/3.3/mondo/src/mondoarchive/mondoarchive.c
r3879 r3882 33 33 extern bool g_text_mode; 34 34 extern char *g_boot_mountpt; 35 extern char *g_cd_drive_is_here;36 static char *g_cdrom_drive_is_here = NULL;37 static char *g_dvd_drive_is_here = NULL;38 35 extern double g_kernel_version; 39 36 … … 430 427 free_libmondo_global_strings(); 431 428 432 433 if (!g_cdrom_drive_is_here) {434 log_msg(10, "FYI, g_cdrom_drive_is_here was never used");435 }436 if (!g_dvd_drive_is_here) {437 log_msg(10, "FYI, g_dvd_drive_is_here was never used");438 }439 440 429 /* finalize log file with time stamp */ 441 430 log_msg(0, "Time finished: %s", mr_date()); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-compare-EXT.h
r1647 r3882 3 3 4 4 extern int compare_to_CD(); 5 extern int compare_to_cdstream();6 5 extern int compare_to_tape(); 7 6 extern int compare_mode(struct mountlist_itself *mountlist, -
branches/3.3/mondo/src/mondorestore/mondo-rstr-compare.c
r3879 r3882 555 555 556 556 /** 557 * Compare all data on a cdstream-based backup.558 * @param bkpinfo The backup information structure. Fields used:559 * - @c bkpinfo->disaster_recovery560 * - @c bkpinfo->media_device561 * - @c bkpinfo->restore_path562 * @return 0 for success, nonzero for failure.563 */564 int compare_to_cdstream()565 {566 int res;567 568 /** needs malloc **/569 char *dir;570 char *command = NULL;571 572 assert(bkpinfo != NULL);573 malloc_string(dir);574 if (getcwd(dir, MAX_STR_LEN)) {575 // FIXME576 }577 if (chdir(bkpinfo->restore_path)) {578 // FIXME579 }580 581 mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);582 run_program_and_log_output(command, FALSE);583 mr_free(command);584 mvaddstr_and_log_it(g_currentY, 0, "Verifying archives against filesystem");585 586 if (bkpinfo->disaster_recovery587 && does_file_exist("/tmp/CDROM-LIVES-HERE")) {588 mr_asprintf(bkpinfo->media_device, "%s", last_line_of_file("/tmp/CDROM-LIVES-HERE"));589 } else {590 bkpinfo->media_device = find_optical_device();591 }592 res = verify_tape_backups();593 if (chdir(dir)) {594 // FIXME595 }596 if (length_of_file(MONDO_CACHE"/changed.txt") > 2597 && length_of_file(MONDO_CACHE"/changed.files") > 2) {598 log_msg(0,599 "Type 'less "MONDO_CACHE"/changed.files' to see which files don't match the archives");600 log_msg(2, "Calling popup_changelist_from_file()");601 popup_changelist_from_file(MONDO_CACHE"/changed.files");602 log_msg(2, "Returned from popup_changelist_from_file()");603 }604 605 mvaddstr_and_log_it(g_currentY++, 74, "Done.");606 paranoid_free(dir);607 return (res);608 }609 610 /**************************************************************************611 *END_COMPARE_CD_STREAM *612 **************************************************************************/613 614 615 616 /**617 557 * Compare all data in the user's backup. 618 558 * This function will mount filesystems, compare afioballs and biggiefiles, … … 682 622 || bkpinfo->backup_media_type == udev) { 683 623 retval += compare_to_tape(); 684 } else if (bkpinfo->backup_media_type == cdstream) {685 retval += compare_to_cdstream();686 624 } else { 687 625 retval += compare_to_CD(); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c
r3881 r3882 940 940 941 941 if (0 == read_cfg_var(cfg_file, "backup-media-type", value)) { 942 if (!strcmp(value, "cdstream")) { 943 bkpinfo->backup_media_type = cdstream; 944 } else if (!strcmp(value, "optical")) { 942 if (!strcmp(value, "optical")) { 945 943 bkpinfo->backup_media_type = optical; 946 944 } else if (!strcmp(value, "usb")) { … … 1008 1006 1009 1007 if (bkpinfo->disaster_recovery) { 1010 if (bkpinfo->backup_media_type == cdstream) { 1011 mr_asprintf(bkpinfo->media_device, "%s", "/dev/cdrom"); 1012 bkpinfo->media_size = 650; /* good guess */ 1013 } else if (bkpinfo->backup_media_type == usb) { 1008 if (bkpinfo->backup_media_type == usb) { 1014 1009 envtmp1 = getenv("MRUSBDEV"); 1015 1010 if (envtmp1 == NULL) { -
branches/3.3/mondo/src/mondorestore/mondorestore.c
r3879 r3882 673 673 /** 674 674 * Restore @p tarball_fname from CD. 675 * @param tarball_fname The filename of the tarball to restore (in /mnt/cdrom).675 * @param tarball_fname The filename of the tarball to restore (in MNT_CDROM). 676 676 * This will be used unmodified. 677 677 * @param current_tarball_number The number (starting from 0) of the fileset … … 1800 1800 mvaddstr_and_log_it(g_currentY++, 0, 1801 1801 "Restoring OS and data from streaming media"); 1802 if (bkpinfo->backup_media_type == cdstream) { 1803 openin_cdstream(); 1804 } else { 1805 assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device); 1806 openin_tape(); 1807 } 1802 assert_string_is_neither_NULL_nor_zerolength(bkpinfo->media_device); 1803 openin_tape(); 1808 1804 resA = restore_all_tarballs_from_stream(filelist); 1809 1805 resB = restore_all_biggiefiles_from_stream(filelist); 1810 if (bkpinfo->backup_media_type == cdstream) { 1811 closein_cdstream(); 1812 } else { 1813 closein_tape(); 1814 } 1806 closein_tape(); 1815 1807 } else { 1816 1808 mount_media(MNT_CDROM); … … 2332 2324 } else { 2333 2325 popup_and_OK("No restoring or comparing will take place today."); 2334 if (is_this_device_mounted( "/mnt/cdrom")) {2335 run_program_and_log_output("umount -d /mnt/cdrom", FALSE);2326 if (is_this_device_mounted(MNT_CDROM)) { 2327 run_program_and_log_output("umount -d "MNT_CDROM, FALSE); 2336 2328 } 2337 2329 if (g_ISO_restore_mode) { … … 2919 2911 2920 2912 if (!bkpinfo->please_dont_eject) { 2921 (void)eject_device("/dev/cdrom"); 2922 } 2923 mvaddstr_and_log_it(g_currentY++, 2924 0, 2925 "Run complete. Please remove media and reboot."); 2913 (void)eject_device(bkpinfo->backup_media_type); 2914 } 2915 mvaddstr_and_log_it(g_currentY++, 0, "Run complete. Please remove media and reboot."); 2926 2916 } 2927 2917 }
Note:
See TracChangeset
for help on using the changeset viewer.