Changeset 3874 in MondoRescue for branches/3.3/mondo/src
- Timestamp:
- Mar 7, 2024, 7:23:09 PM (14 months ago)
- Location:
- branches/3.3/mondo/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-archive.c
r3870 r3874 680 680 case cdr: 681 681 mr_asprintf(value, "cdr"); 682 break;683 case cdrw:684 mr_asprintf(value, "cdrw");685 682 break; 686 683 case cdstream: … … 1771 1768 } 1772 1769 1773 if (bkpinfo->backup_media_type == cdr 1774 || bkpinfo->backup_media_type == cdrw) { 1770 if (bkpinfo->backup_media_type == cdr) { 1775 1771 if (is_this_device_mounted(bkpinfo->media_device)) { 1776 1772 log_msg(2, "Warning - %s mounted. I'm unmounting it before I burn to it.", bkpinfo->media_device); … … 2457 2453 /** 2458 2454 * Make sure the user has a valid CD-R(W) in the CD drive. 2459 * @param cd rw_dev Set to the CD-R(W) device checked.2455 * @param cd_dev Set to the CD-R(W) device checked. 2460 2456 * @param keep_looping If TRUE, keep pestering user until they insist 2461 2457 * or insert a correct CD; if FALSE, only check once. 2462 2458 * @return 0 (there was an OK CD in the drive) or 1 (there wasn't). 2463 2459 */ 2464 int interrogate_disk_currently_in_cd rw_drive(char *cdrw_dev,2460 int interrogate_disk_currently_in_cddrive(char *cd_dev, 2465 2461 bool keep_looping) 2466 2462 { … … 2469 2465 char *cdrecord = NULL; 2470 2466 2471 mr_asprintf(bkp, "%s", cdrw_dev); 2472 if (find_cdrw_device(cdrw_dev)) { 2473 strcpy(cdrw_dev, bkp); 2474 } else { 2467 mr_asprintf(bkp, "%s", cd_dev); 2468 if ((cd_dev = find_dvd_device()) != NULL) { 2475 2469 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 2476 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd rw_dev);2470 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd_dev); 2477 2471 } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) { 2478 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd rw_dev);2472 mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cd_dev); 2479 2473 } else { 2480 2474 log_msg(2, "Oh well. I guess I'll just pray then."); … … 2516 2510 char *tmp = NULL; 2517 2511 char *cdrom_dev = NULL; 2518 char *cd rw_dev = NULL;2512 char *cd_dev = NULL; 2519 2513 char *our_serial_str = NULL; 2520 2514 bool ok_go_ahead_burn_it; … … 2527 2521 char *mds = NULL; 2528 2522 2529 malloc_string(cd rw_dev);2523 malloc_string(cd_dev); 2530 2524 2531 2525 mds = media_descriptor_string(g_backup_media_type); … … 2604 2598 log_msg(2, 2605 2599 "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", mds); 2606 if (interrogate_disk_currently_in_cd rw_drive(cdrw_dev, FALSE)) {2600 if (interrogate_disk_currently_in_cddrive(cd_dev, FALSE)) { 2607 2601 ok_go_ahead_burn_it = FALSE; 2608 2602 log_to_screen("There isn't a writable %s in the drive.", mds); … … 2633 2627 2634 2628 mr_free(cdrom_dev); 2635 paranoid_free(cd rw_dev);2629 paranoid_free(cd_dev); 2636 2630 mr_free(mtpt); 2637 2631 if (pmountable) { … … 3101 3095 } 3102 3096 if (g_current_media_number == 1 && !res 3103 && (bkpinfo->backup_media_type == cdr 3104 || bkpinfo->backup_media_type == cdrw)) { 3097 && (bkpinfo->backup_media_type == cdr)) { 3105 3098 if ((tmp = find_cdrom_device()) == NULL) { // make sure find_cdrom_device() finds, records CD-R's loc 3106 3099 log_msg(3, "*Sigh* Mike, I hate your computer."); … … 3204 3197 mvaddstr_and_log_it(g_currentY++, 74, "Done."); 3205 3198 } else if (bkpinfo->backup_data) 3206 // bkpinfo->backup_media_type == cdrw ||bkpinfo->backup_media_type == cdr))3199 // bkpinfo->backup_media_type == cdr)) 3207 3200 { 3208 3201 log_msg(2, -
branches/3.3/mondo/src/common/libmondo-cli.c
r3873 r3874 534 534 if (flag_set['u']) { 535 535 bkpinfo->backup_media_type = udev; 536 }537 if (flag_set['w']) {538 bkpinfo->backup_media_type = cdrw;539 536 } 540 537 if (flag_set['U']) { -
branches/3.3/mondo/src/common/libmondo-devices-EXT.h
r3872 r3874 25 25 extern int kick_vn(char *vn); 26 26 extern char which_boot_loader(char *which_device); 27 28 29 30 extern int find_cdrw_device(char *cdrw_device);31 32 27 33 28 extern int interactively_obtain_media_parameters_from_user(bool); -
branches/3.3/mondo/src/common/libmondo-devices.c
r3872 r3874 55 55 extern char *call_program_and_get_last_line_of_output(const char *); 56 56 57 static char g_cd rw_drive_is_here[MAX_STR_LEN / 4] = "";57 static char g_cd_drive_is_here[MAX_STR_LEN / 4] = ""; 58 58 static char g_cdrom_drive_is_here[MAX_STR_LEN / 4] = ""; 59 59 static char g_dvd_drive_is_here[MAX_STR_LEN / 4] = ""; … … 105 105 if (strlen(g_dvd_drive_is_here) > 0) { 106 106 inject_device(g_dvd_drive_is_here); 107 }108 if (strlen(g_cdrw_drive_is_here) > 0) {109 inject_device(g_cdrw_drive_is_here);110 107 } 111 108 } … … 188 185 case cdr: 189 186 strcpy(output, "cdr"); 190 break;191 case cdrw:192 strcpy(output, "cdrw");193 187 break; 194 188 case cdstream: … … 501 495 } 502 496 return (res); 503 }504 505 506 507 508 509 510 /**511 * Locate a CD-R/W writer's SCSI node.512 * @param cdrw_device SCSI node will be placed here.513 * @return 0 for success, nonzero for failure.514 */515 int find_cdrw_device(char *cdrw_device)516 {517 /*@ buffers ************************ */518 char *tmp = NULL;519 char *cdr_exe = NULL;520 char *command = NULL;521 522 if (g_cdrw_drive_is_here[0]) {523 strcpy(cdrw_device, g_cdrw_drive_is_here);524 log_msg(3, "Been there, done that. Returning %s", cdrw_device);525 return (0);526 }527 if (g_backup_media_type == dvd) {528 log_msg(1, "This is dumb. You're calling find_cdrw_device() but you're backing up to DVD. WTF?");529 return (1);530 }531 run_program_and_log_output("insmod ide-scsi", -1);532 if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) {533 if ((cdr_exe = find_home_of_exe("wodim")) == NULL) {534 cdr_exe = find_home_of_exe("dvdrecord");535 }536 }537 if (cdr_exe != NULL) {538 mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1", cdr_exe);539 tmp = call_program_and_get_last_line_of_output(command);540 mr_free(command);541 }542 if ((tmp == NULL) || (strlen(tmp) < 2)) {543 mr_free(tmp);544 mr_free(cdr_exe);545 return (1);546 } else {547 strcpy(cdrw_device, tmp);548 log_it("Found CDRW device - %s", cdrw_device);549 strcpy(g_cdrw_drive_is_here, cdrw_device);550 mr_free(tmp);551 mr_free(cdr_exe);552 return (0);553 }554 497 } 555 498 … … 786 729 (found_it = 787 730 set_dev_to_this_if_rx_OK(output, 788 g_cd rw_drive_is_here)))731 g_cd_drive_is_here))) 789 732 { 790 733 retval = 1; … … 837 780 } 838 781 839 mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep -E \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cd rw_drive_is_here);782 mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep -E \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cd_drive_is_here); 840 783 841 784 log_msg(1, "command=%s", command); … … 2249 2192 switch (bkpinfo->backup_media_type) { 2250 2193 case cdr: 2251 case cdrw:2252 2194 case dvd: 2253 2195 case usb: … … 2338 2280 log_msg(2, "%s device found at %s", mds, bkpinfo->media_device); 2339 2281 } else { 2340 if ((find_cdr w_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {2282 if ((find_cdrom_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) { 2341 2283 mr_free(bkpinfo->media_device); 2342 2284 } -
branches/3.3/mondo/src/common/libmondo-files.c
r3871 r3874 19 19 #include "libmondo-fork-EXT.h" 20 20 #include "libmondo-string-EXT.h" 21 #include " libmondo-newt-specific-EXT.h"21 #include "newt-specific-EXT.h" 22 22 23 23 /*@unused@*/ -
branches/3.3/mondo/src/common/libmondo-string.c
r3871 r3874 1040 1040 mr_asprintf(type_of_backup, "CDR"); 1041 1041 break; 1042 case cdrw:1043 mr_asprintf(type_of_backup, "CDRW");1044 break;1045 1042 case tape: 1046 1043 mr_asprintf(type_of_backup, "tape"); -
branches/3.3/mondo/src/common/libmondo-tools.c
r3871 r3874 486 486 487 487 // CD-R or CD-RW 488 if (bkpinfo->backup_media_type == cdrw 489 || bkpinfo->backup_media_type == cdr) { 488 if (bkpinfo->backup_media_type == cdr) { 490 489 if (!bkpinfo->manual_cd_tray) { 491 490 mr_asprintf(extra_cdrom_params, "-waiti "); 492 491 } 493 if (bkpinfo->backup_media_type == cdrw) { 494 mr_asprintf(extra_cdrom_params, "blank=fast "); 495 } 496 if (extra_cdrom_params == NULL) { 497 // If not initialized earlier, do it now 498 mr_asprintf(extra_cdrom_params, " "); 499 } 492 mr_asprintf(extra_cdrom_params, "%s", "blank=fast "); 500 493 if ((cdr_exe = find_home_of_exe("cdrecord")) == NULL) { 501 494 if ((cdr_exe = find_home_of_exe("wodim")) == NULL) { -
branches/3.3/mondo/src/common/mondostructures.h
r3856 r3874 173 173 iso, ///< Back up to ISO images. 174 174 cdr, ///< Back up to recordable CDs (do not erase them). 175 cdrw, ///< Back up to CD-RWs and blank them first.176 175 dvd, ///< Back up to DVD+R[W] or DVD-R[W] disks. 177 176 cdstream, ///< Back up to recordable CDs but treat them like a tape streamer. … … 339 338 /** 340 339 * The device we're backing up to. 341 * If backup_media_type is @b cdr, @b cdrw,or @b cdstream, this should be the SCSI node (e.g. 0,1,0).340 * If backup_media_type is @b cdr, or @b cdstream, this should be the SCSI node (e.g. 0,1,0). 342 341 * If backup_media_type is @b dvd, @b tape, @b usb or @b udev, this should be a /dev entry. 343 342 * If backup_media_type is anything else, this should be blank. -
branches/3.3/mondo/src/common/newt-specific.c
r3871 r3874 1225 1225 /** 1226 1226 * Ask the user which backup media type they would like to use. 1227 * The choices are @p none (exit to shell), @c cdr, @c cdrw, @cdvd,1227 * The choices are @p none (exit to shell), @c cdr, @c dvd, 1228 1228 * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c netfs, 1229 1229 * and @c iso. … … 1240 1240 char *title_sz = NULL; 1241 1241 char *minimsg_sz = NULL; 1242 static t_bkptype possible_bkptypes[] = { none, cdr, cdrw,dvd, tape, cdstream, udev, netfs, iso };1243 static char *possible_responses[] = { "none", "cdr", " cdrw", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };1242 static t_bkptype possible_bkptypes[] = { none, cdr, dvd, tape, cdstream, udev, netfs, iso }; 1243 static char *possible_responses[] = { "none", "cdr", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL }; 1244 1244 char *outstr = NULL; 1245 1245 char *instr = NULL; … … 1289 1289 newtCenteredWindow(34, 17, minimsg_sz); 1290 1290 b1 = newtButton(1, 1, "CD-R disks "); 1291 b2 = newtButton(17, 1, "CD-RW disks");1292 1291 b3 = newtButton(1, 9, "Tape drive "); 1293 1292 b4 = newtButton(17, 5, "USB Key/Disk"); … … 1297 1296 b8 = newtButton(17, 13, " Exit "); 1298 1297 myForm = newtForm(NULL, NULL, 0); 1299 newtFormAddComponents(myForm, b1, b5, b3, b7, b 2, b4, b6, b8, NULL);1298 newtFormAddComponents(myForm, b1, b5, b3, b7, b4, b6, b8, NULL); 1300 1299 b_res = newtRunForm(myForm); 1301 1300 newtFormDestroy(myForm); … … 1303 1302 if (b_res == b1) { 1304 1303 output = cdr; 1305 } else if (b_res == b2) {1306 output = cdrw;1307 1304 } else if (b_res == b3) { 1308 1305 output = tape; -
branches/3.3/mondo/src/mondoarchive/mondoarchive.c
r3872 r3874 27 27 extern bool g_text_mode; 28 28 extern char *g_boot_mountpt; 29 extern char *g_cd rw_drive_is_here;29 extern char *g_cd_drive_is_here; 30 30 static char *g_cdrom_drive_is_here = NULL; 31 31 static char *g_dvd_drive_is_here = NULL; … … 281 281 g_loglevel = 10; 282 282 setup_newt_stuff(); 283 malloc_string(tmp); 284 if (find_cdrw_device(tmp)) { 283 if ((tmp = find_cdrom_device()) == NULL) { 285 284 printf("Failed to find CDR-RW drive\n"); 286 285 } else { 287 286 printf("CD-RW is at %s\n", tmp); 288 }289 tmp[0] = '\0';290 if (find_cdrom_device(tmp, atoi(argv[2]))) {291 printf("Failed to find CD-ROM drive\n");292 } else {293 printf("CD-ROM is at %s\n", tmp);294 287 } 295 288 mr_free(tmp); -
branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c
r3873 r3874 671 671 } else if (!strcmp(value, "cdr")) { 672 672 bkpinfo->backup_media_type = cdr; 673 } else if (!strcmp(value, "cdrw")) {674 bkpinfo->backup_media_type = cdrw;675 673 } else if (!strcmp(value, "dvd")) { 676 674 bkpinfo->backup_media_type = dvd;
Note:
See TracChangeset
for help on using the changeset viewer.