Changeset 1594 in MondoRescue for branches/stable/mondo/src/common/libmondo-archive.c
- Timestamp:
- Aug 26, 2007, 12:26:06 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive.c
r1592 r1594 54 54 struct seminfo *__buf; 55 55 }; 56 #endif 56 57 #endif /* __FreeBSD__ */ 57 58 … … 1218 1219 * @param bkpinfo The backup information structure. Fields used: 1219 1220 * - @c backup_media_type 1220 * - @c cdrw_speed1221 * - @c writer_speed 1221 1222 * - @c prefix 1222 1223 * - @c isodir … … 1258 1259 if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) { 1259 1260 if (bkpinfo->backup_media_type == cdstream) { 1260 openout_cdstream(bkpinfo->media_device, bkpinfo-> cdrw_speed);1261 openout_cdstream(bkpinfo->media_device, bkpinfo->writer_speed); 1261 1262 } else { 1262 1263 openout_tape(bkpinfo->media_device, bkpinfo->internal_tape_block_size); /* sets g_tape_stream */ … … 1582 1583 char *tmp = NULL; 1583 1584 char *old_pwd; 1584 char *result_sz = NULL;1585 1585 char *message_to_screen = NULL; 1586 1586 char *sz_blank_disk = NULL; 1587 1587 char *tmp2 = NULL; 1588 1588 char *tmp3 = NULL; 1589 bool cd_is_mountable;1590 1589 1591 1590 malloc_string(old_pwd); … … 1608 1607 mr_free(tmp); 1609 1608 1610 if (bkpinfo->backup_media_type == iso && bkpinfo->manual_cd_tray) {1609 if (bkpinfo->backup_media_type != iso && bkpinfo->manual_cd_tray) { 1611 1610 popup_and_OK(_("Please insert new media and press Enter.")); 1612 1611 } … … 1616 1615 /* BERLIOS: Do not ignore getcwd result */ 1617 1616 (void) getcwd(old_pwd, MAX_STR_LEN - 1); 1618 mr_asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir); 1619 run_program_and_log_output(tmp, FALSE); 1620 mr_free(tmp); 1617 chmod(bkpinfo->scratchdir,0755); 1621 1618 chdir(bkpinfo->scratchdir); 1622 1619 … … 1643 1640 1644 1641 /* if g_current_media_number >= 2 then pause & ask */ 1645 pause_and_ask_for_cdr(2, &cd_is_mountable); 1642 if (bkpinfo->backup_media_type != iso) { 1643 pause_and_ask_for_cdr(2); 1644 } 1646 1645 if (retval) { 1647 1646 log_to_screen … … 1649 1648 } else { 1650 1649 res = eval_call_to_make_ISO(bkpinfo, bkpinfo->call_make_iso, 1651 bkpinfo->scratchdir, 1652 g_current_media_number, 1650 destfile, g_current_media_number, 1653 1651 MONDO_LOGFILE, message_to_screen); 1654 1652 if (res) { … … 1712 1710 res = 1713 1711 eval_call_to_make_ISO(bkpinfo, bkpinfo->call_make_iso, 1714 bkpinfo->scratchdir,1712 destfile, 1715 1713 g_current_media_number, 1716 1714 MONDO_LOGFILE, … … 2469 2467 bool keep_looping) 2470 2468 { 2471 char *tmp;2472 2469 int res = 0; 2473 char *bkp; 2474 char *cdrecord; 2475 2476 malloc_string(tmp); 2470 char *bkp = NULL; 2471 char *cdrecord = NULL; 2472 2477 2473 malloc_string(bkp); 2478 malloc_string(cdrecord);2479 2474 strcpy(bkp, cdrw_dev); 2480 2475 if (find_cdrw_device(cdrw_dev)) { … … 2482 2477 } else { 2483 2478 if (!system("which cdrecord > /dev/null 2> /dev/null")) { 2484 sprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);2479 mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev); 2485 2480 } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) { 2486 sprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);2481 mr_asprintf(&cdrecord, "dvdrecord dev=%s -atip", cdrw_dev); 2487 2482 } else { 2488 cdrecord[0] = '\0';2489 2483 mr_msg(2, "Oh well. I guess I'll just pray then."); 2490 2484 } 2491 if (cdrecord [0]) {2485 if (cdrecord != NULL) { 2492 2486 if (!keep_looping) { 2493 2487 retract_CD_tray_and_defeat_autorun(); … … 2505 2499 } 2506 2500 } 2501 mr_free(cdrecord); 2507 2502 } 2508 2503 // retract_CD_tray_and_defeat_autorun(); 2509 mr_free(tmp);2510 mr_free(cdrecord);2511 2504 mr_free(bkp); 2512 2505 return (res); … … 2517 2510 * Asks the user to put a CD-R(W) in the drive. 2518 2511 * @param ask_for_one_if_more_than_this (unused) 2519 * @param pmountable If non-NULL, pointed-to value is set to TRUE if the CD is mountable, FALSE otherwise.2520 2512 */ 2521 2513 void 2522 pause_and_ask_for_cdr(int ask_for_one_if_more_than_this , bool * pmountable)2514 pause_and_ask_for_cdr(int ask_for_one_if_more_than_this) 2523 2515 { 2524 2516 … … 2537 2529 char *szunmount = NULL; 2538 2530 2539 malloc_string(tmp);2540 2531 malloc_string(szmsg); 2541 2532 malloc_string(cdrom_dev); … … 2566 2557 retract_CD_tray_and_defeat_autorun(); 2567 2558 */ 2568 sprintf(tmp, "umount %s", cdrom_dev);2559 mr_asprintf(&tmp, "umount %s", cdrom_dev); 2569 2560 run_program_and_log_output(tmp, 1); 2561 mr_free(tmp); 2570 2562 sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt); 2571 2563 sprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt); … … 2573 2565 cd_number = -1; 2574 2566 our_serial_str[0] = '\0'; 2575 sprintf(tmp, "mount %s %s", cdrom_dev, mtpt); 2576 if ((attempt_to_mount_returned_this = 2577 run_program_and_log_output(tmp, 1))) { 2567 mr_asprintf(&tmp, "mount %s %s", cdrom_dev, mtpt); 2568 attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1); 2569 mr_free(tmp); 2570 if (attempt_to_mount_returned_this) { 2578 2571 mr_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt); 2579 2572 log_to_screen("If there's a CD/DVD in the drive, it's blank."); 2580 /*2581 if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE))2582 {2583 ok_go_ahead_burn_it = FALSE;2584 log_to_screen("There isn't a writable CD/DVD in the drive.");2585 }2586 else2587 {2588 log_to_screen("Confirmed. There is a blank CD/DVD in the drive.");2589 }2590 */2591 2573 } else if (!does_file_exist(szcdno) 2592 2574 || !does_file_exist(szserfname)) { … … 2598 2580 media_descriptor_string(g_backup_media_type)); 2599 2581 cd_number = atoi(last_line_of_file(szcdno)); 2600 sprintf(tmp, "cat %s 2> /dev/null", szserfname);2582 mr_asprintf(&tmp, "cat %s 2> /dev/null", szserfname); 2601 2583 strcpy(our_serial_str, 2602 2584 call_program_and_get_last_line_of_output(tmp)); 2585 mr_free(tmp); 2603 2586 // FIXME - should be able to use last_line_of_file(), surely? 2604 2587 } … … 2634 2617 } 2635 2618 2636 /*2637 if (g_current_media_number > ask_for_one_if_more_than_this)2638 {2639 ok_go_ahead_burn_it = FALSE;2640 log_it("paafcd: %d > %d, so I'll definitely pause.", g_current_media_number > ask_for_one_if_more_than_this);2641 }2642 */2643 2644 2619 if (!ok_go_ahead_burn_it) { 2645 2620 eject_device(cdrom_dev); 2646 sprintf(tmp,2621 mr_asprintf(&tmp, 2647 2622 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", 2648 2623 media_descriptor_string(g_backup_media_type), … … 2650 2625 media_descriptor_string(g_backup_media_type)); 2651 2626 popup_and_OK(tmp); 2627 mr_free(tmp); 2652 2628 goto gotos_make_me_puke; 2653 2629 } else { … … 2663 2639 log_to_screen("Proceeding w/ %s in drive.", 2664 2640 media_descriptor_string(g_backup_media_type)); 2665 mr_free(tmp);2666 2641 mr_free(szmsg); 2667 2642 mr_free(cdrom_dev); … … 2672 2647 mr_free(our_serial_str); 2673 2648 mr_free(szunmount); 2674 if (pmountable) {2675 if (attempt_to_mount_returned_this) {2676 *pmountable = FALSE;2677 } else {2678 *pmountable = TRUE;2679 }2680 }2681 2682 2649 } 2683 2650 … … 3300 3267 mvaddstr_and_log_it(g_currentY, 0, 3301 3268 "Verifying archives against live filesystem"); 3302 if (bkpinfo->backup_media_type == cdstream) {3303 strcpy(bkpinfo->media_device, "/dev/cdrom");3304 }3305 3269 verify_tape_backups(bkpinfo); 3306 3270 mvaddstr_and_log_it(g_currentY++, 74, "Done."); … … 3314 3278 } else { 3315 3279 g_current_media_number = cdno; 3316 if (bkpinfo->backup_media_type != iso) {3317 find_cdrom_device(bkpinfo->media_device, FALSE); // replace 0,0,0 with /dev/cdrom3318 }3319 3280 chdir("/"); 3320 3281 for (cdno = 1; cdno < 99 && bkpinfo->verify_data; cdno++) {
Note:
See TracChangeset
for help on using the changeset viewer.