Changeset 1594 in MondoRescue for branches/stable/mondo/src/common
- Timestamp:
- Aug 26, 2007, 12:26:06 PM (17 years ago)
- Location:
- branches/stable/mondo/src/common
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/src/common/libmondo-archive-EXT.h
r1152 r1594 24 24 extern int offer_to_write_boot_floppies_to_physical_disks(struct s_bkpinfo 25 25 *bkpinfo); 26 extern void pause_and_ask_for_cdr(int , bool *);26 extern void pause_and_ask_for_cdr(int); 27 27 extern int slice_up_file_etc(struct s_bkpinfo *bkpinfo, 28 28 char *biggie_filename, -
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++) { -
branches/stable/mondo/src/common/libmondo-archive.h
r543 r1594 26 26 int offer_to_write_boot_floppies_to_physical_disks(struct s_bkpinfo 27 27 *bkpinfo); 28 void pause_and_ask_for_cdr(int , bool *);28 void pause_and_ask_for_cdr(int); 29 29 void set_bit_N_of_array(char *array, int N, bool true_or_false); 30 30 int slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename, -
branches/stable/mondo/src/common/libmondo-devices.c
r1581 r1594 22 22 #include "mr_str.h" 23 23 #include "mr_gettext.h" 24 #include "mr_conf.h" 24 25 25 26 #include <sys/ioctl.h> … … 47 48 extern char *g_selfmounted_isodir; 48 49 extern char *MONDO_LOGFILE; 50 extern struct mr_ar_conf *mr_conf; 49 51 50 52 static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = ""; … … 1443 1445 char *prompt = NULL; 1444 1446 int i = 0; 1445 int res = 0;1446 1447 FILE *fin = NULL; 1447 1448 … … 1466 1467 sensibly_set_tmpdir_and_scratchdir(bkpinfo); 1467 1468 } 1468 bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4;1469 1469 bkpinfo->compression_level = 1470 1470 (bkpinfo->backup_media_type == cdstream) ? 1 : 5; … … 1494 1494 mr_asprintf(&comment, _("What speed is your %s (re)writer?"), 1495 1495 bkpinfo->backup_media_string); 1496 if (bkpinfo->backup_media_type == dvd) { 1497 find_dvd_device(bkpinfo->media_device, FALSE); 1498 mr_asprintf(&tmp, "1"); 1499 mr_asprintf(&sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB 1500 mr_msg(1, "Setting to DVD defaults"); 1501 } else if (bkpinfo->backup_media_type == usb) { 1502 strcpy(bkpinfo->media_device, VANILLA_USB_DEVICE); 1503 asprintf(&sz_size, "512"); 1504 } else { 1505 strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM); 1506 mr_asprintf(&tmp, "4"); 1507 mr_asprintf(&sz_size, "650"); 1508 mr_msg(1, "Setting to CD defaults"); 1509 } 1510 if ((bkpinfo->backup_media_type != dvd) && (bkpinfo->backup_media_type != usb)) { 1496 mr_asprintf(&tmp, "%d", mr_conf->iso_burning_speed); 1497 if (bkpinfo->backup_media_type != usb) { 1498 /* BERLIOS: NOW that tmp isn't static anymore it does NOT work */ 1511 1499 if (!popup_and_get_string(_("Speed"), comment, tmp, 4)) { 1512 1500 log_to_screen(_("User has chosen not to backup the PC")); … … 1516 1504 mr_free(comment); 1517 1505 1518 bkpinfo-> cdrw_speed = atoi(tmp); // if DVD then this shouldn't ever be used anyway :)1506 bkpinfo->writer_speed = atoi(tmp); 1519 1507 mr_free(tmp); 1520 1508 1521 mr_asprintf(&comment, 1522 _("How much data (in Megabytes) will each %s store?"), 1523 bkpinfo->backup_media_string); 1524 1525 if (!popup_and_get_string("Size", comment, sz_size, 5)) { 1509 mr_asprintf(&comment, _("What is your media device ?")); 1510 mr_asprintf(&tmp, mr_conf->media_device); 1511 1512 if (!popup_and_get_string("Device", comment, tmp, 5)) { 1526 1513 log_to_screen(_("User has chosen not to backup the PC")); 1527 1514 finish(1); … … 1529 1516 mr_free(comment); 1530 1517 1531 bkpinfo->media_size = atol(sz_size); 1532 mr_free(sz_size); 1533 1534 if (bkpinfo->media_size <= 0L) { 1535 log_to_screen(_("User has chosen not to backup the PC")); 1536 finish(1); 1537 } 1538 } 1539 case cdstream: 1540 if (bkpinfo->disaster_recovery) { 1541 strcpy(bkpinfo->media_device, "/dev/cdrom"); 1542 mr_msg(2, "CD-ROM device assumed to be at %s", 1543 bkpinfo->media_device); 1544 } else if (bkpinfo->restore_data 1545 || bkpinfo->backup_media_type == dvd) { 1546 if (!bkpinfo->media_device[0]) { 1547 strcpy(bkpinfo->media_device, "/dev/cdrom"); 1548 } // just for the heck of it :) 1549 mr_msg(1, "bkpinfo->media_device = %s", 1550 bkpinfo->media_device); 1551 if (bkpinfo->backup_media_type == dvd 1552 || find_cdrom_device(bkpinfo->media_device, FALSE)) { 1553 mr_msg(1, "bkpinfo->media_device = %s", 1554 bkpinfo->media_device); 1555 mr_asprintf(&comment, 1556 _("Please specify your %s drive's /dev entry"), 1557 bkpinfo->backup_media_string); 1558 if (!popup_and_get_string 1559 (_("Device?"), comment, bkpinfo->media_device, MAX_STR_LEN / 4)) { 1518 mr_free(bkpinfo->media_device); 1519 bkpinfo->media_device = tmp; 1520 1521 /* Also adapt the burning device if needed */ 1522 if ((strcmp(bkpinfo->media_device, mr_conf->media_device) != 0) && 1523 (strcmp(mr_conf->media_device,mr_conf->iso_burning_dev) != 0)) { 1524 mr_asprintf(&comment, _("What is your burning media device then ?")); 1525 mr_asprintf(&tmp, mr_conf->iso_burning_dev); 1526 1527 if (!popup_and_get_string("Device", comment, tmp, 5)) { 1560 1528 log_to_screen(_("User has chosen not to backup the PC")); 1561 1529 finish(1); 1562 1530 } 1563 1531 mr_free(comment); 1564 } 1532 1533 /* BCO: We change the mr_conf struct. Check that it doesn't create pb */ 1534 mr_free(bkpinfo->iso_burning_dev); 1535 bkpinfo->iso_burning_dev = tmp; 1536 } 1537 1538 mr_asprintf(&comment, 1539 _("How much data (in Megabytes) will each %s store?"), 1540 bkpinfo->backup_media_string); 1541 mr_asprintf(&sz_size, "%d", mr_conf->media_size); 1542 1543 if (!popup_and_get_string("Size", comment, sz_size, 5)) { 1544 log_to_screen(_("User has chosen not to backup the PC")); 1545 finish(1); 1546 } 1547 mr_free(comment); 1548 1549 bkpinfo->media_size = atol(sz_size); 1550 mr_free(sz_size); 1551 1552 if (bkpinfo->media_size <= 0L) { 1553 log_to_screen(_("User has chosen not to backup the PC")); 1554 finish(1); 1555 } 1556 } 1557 1558 case cdstream: 1559 if (bkpinfo->disaster_recovery) { 1560 mr_allocstr(bkpinfo->media_device, "/dev/cdrom"); 1561 mr_msg(2, "CD-ROM device assumed to be at %s", bkpinfo->media_device); 1562 } else if (bkpinfo->restore_data || bkpinfo->backup_media_type == dvd) { 1563 if (!bkpinfo->media_device) { 1564 mr_allocstr(bkpinfo->media_device, "/dev/cdrom"); 1565 } // just for the heck of it :) 1566 mr_msg(1, "bkpinfo->media_device = %s", bkpinfo->media_device); 1567 mr_asprintf(&comment, 1568 _("Please specify your %s drive's /dev entry"), bkpinfo->backup_media_string); 1569 mr_asprintf(&tmp,"/dev/cdrom"); 1570 if (!popup_and_get_string 1571 (_("Device?"), comment, tmp, MAX_STR_LEN / 4)) { 1572 log_to_screen(_("User has chosen not to backup the PC")); 1573 finish(1); 1574 } 1575 mr_free(comment); 1576 mr_free(bkpinfo->media_device); 1577 bkpinfo->media_device=tmp; 1578 1565 1579 mr_msg(2, "%s device found at %s", 1566 1580 bkpinfo->backup_media_string, 1567 1581 bkpinfo->media_device); 1568 1582 } else { 1569 if (find_cdrw_device(bkpinfo->media_device)) { 1570 bkpinfo->media_device[0] = '\0'; 1571 } 1572 if (bkpinfo->media_device[0]) { 1573 mr_asprintf(&tmp, 1574 _("I think I've found your %s burner at SCSI node %s; Is this correct ? (say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details."), 1575 bkpinfo->backup_media_string, 1576 bkpinfo->media_device); 1577 if (!ask_me_yes_or_no(tmp)) { 1578 bkpinfo->media_device[0] = '\0'; 1579 } 1580 mr_free(tmp); 1581 } else { 1582 if (g_kernel_version < 2.6) { 1583 i = popup_and_get_string("Device node?", 1584 "What is the SCSI node of your CD (re)writer, please?", 1585 bkpinfo->media_device, 1586 MAX_STR_LEN / 4); 1587 } else { 1588 i = popup_and_get_string("/dev entry?", 1589 "What is the /dev entry of your CD (re)writer, please?", 1590 bkpinfo->media_device, 1591 MAX_STR_LEN / 4); 1592 } 1593 if (!i) { 1583 mr_asprintf(&comment, _("What is your media device ?")); 1584 mr_asprintf(&tmp, mr_conf->media_device); 1585 1586 if (!popup_and_get_string("Device", comment, tmp, 5)) { 1587 log_to_screen(_("User has chosen not to backup the PC")); 1588 finish(1); 1589 } 1590 mr_free(comment); 1591 1592 mr_free(bkpinfo->media_device); 1593 bkpinfo->media_device = tmp; 1594 1595 /* Also adapt the burning device if needed */ 1596 if ((strcmp(bkpinfo->media_device, mr_conf->media_device) != 0) && 1597 (strcmp(mr_conf->media_device,mr_conf->iso_burning_dev) != 0)) { 1598 mr_asprintf(&comment, _("What is your burning media device then ?")); 1599 mr_asprintf(&tmp, mr_conf->iso_burning_dev); 1600 1601 if (!popup_and_get_string("Device", comment, tmp, 5)) { 1594 1602 log_to_screen(_("User has chosen not to backup the PC")); 1595 1603 finish(1); 1596 1604 } 1597 } 1598 } 1599 if (bkpinfo->backup_media_type == cdstream) { 1600 bkpinfo->media_size = (long)650; 1601 } 1605 mr_free(comment); 1606 1607 /* BCO: We change the mr_conf struct. Check that it doesn't create pb */ 1608 mr_free(bkpinfo->iso_burning_dev); 1609 bkpinfo->iso_burning_dev = tmp; 1610 } 1611 1612 } 1613 /* BERLIOS: Is it useful ?? */ 1614 bkpinfo->media_size = (long)650; 1602 1615 break; 1616 1603 1617 case udev: 1604 1618 if (!ask_me_yes_or_no … … 1607 1621 finish(1); 1608 1622 } 1623 1609 1624 case tape: 1610 1611 res = find_tape_device_and_size(bkpinfo->media_device, sz_size); 1612 if ((res != 0) && (! bkpinfo->media_device[0])) { 1613 mr_msg(3, "Ok, using vanilla scsi tape."); 1614 strcpy(bkpinfo->media_device, VANILLA_SCSI_TAPE); 1615 if ((fin = fopen(bkpinfo->media_device, "r"))) { 1616 paranoid_fclose(fin); 1617 } else { 1618 mr_msg(2, "Don't know what your tape device is :-("); 1619 } 1620 } 1621 if (bkpinfo->media_device[0]) { 1625 if (bkpinfo->media_device) { 1622 1626 if ((fin = fopen(bkpinfo->media_device, "r"))) { 1623 1627 paranoid_fclose(fin); 1624 1628 } else { 1625 1629 if (does_file_exist("/tmp/mondo-restore.cfg")) { 1630 /* BERLIOS: NOW that bkpinfo->media_device isn't static anymore it does NOT work */ 1626 1631 read_cfg_var("/tmp/mondo-restore.cfg", "media-dev", 1627 1632 bkpinfo->media_device); 1628 1633 } 1629 1634 } 1630 mr_asprintf(& tmp,1635 mr_asprintf(&comment, 1631 1636 _("I think I've found your tape streamer at %s; am I right on the money?"), 1632 1637 bkpinfo->media_device); 1633 if (!ask_me_yes_or_no(tmp)) { 1638 if (!ask_me_yes_or_no(comment)) { 1639 mr_asprintf(&tmp,bkpinfo->media_device); 1634 1640 if (!popup_and_get_string 1635 ( "Device name?",1636 "What is the /dev entry of your tape streamer?",1637 bkpinfo->media_device, MAX_STR_LEN / 4)) {1641 (_("Device name?"), 1642 _("What is the /dev entry of your tape streamer?"), 1643 tmp, MAX_STR_LEN / 4)) { 1638 1644 log_to_screen("User has chosen not to backup the PC"); 1639 1645 finish(1); 1640 1646 } 1641 } 1642 mr_free(tmp); 1647 mr_free(bkpinfo->media_device); 1648 bkpinfo->media_device = tmp; 1649 } 1650 mr_free(comment); 1643 1651 } else { 1652 mr_asprintf(&tmp,bkpinfo->media_device); 1644 1653 if (!popup_and_get_string 1645 ( "Device name?",1646 "What is the /dev entry of your tape streamer?",1647 bkpinfo->media_device, MAX_STR_LEN / 4)) {1654 (_("Device name?"), 1655 _("What is the /dev entry of your tape streamer?"), 1656 tmp, MAX_STR_LEN / 4)) { 1648 1657 log_to_screen("User has chosen not to backup the PC"); 1649 1658 finish(1); 1650 1659 } 1660 mr_free(bkpinfo->media_device); 1661 bkpinfo->media_device = tmp; 1651 1662 } 1652 1663 mr_asprintf(&tmp, "ls -l %s", bkpinfo->media_device); … … 1656 1667 } 1657 1668 mr_free(tmp); 1658 mr_msg(4, "sz_size = %s", sz_size);1659 mr_free(sz_size);1660 1669 bkpinfo->media_size = 0L; 1661 1670 mr_msg(4, "media_size = %ld", bkpinfo->media_size); 1662 if (bkpinfo->media_size <= 0L) {1663 bkpinfo->media_size = 0L;1664 }1665 1671 if (archiving_to_media) { 1666 1672 if ((bkpinfo->compression_level = … … 1797 1803 mr_msg(3, "prefix set to %s", bkpinfo->prefix); 1798 1804 1799 bkpinfo->media_size = (long)650; 1805 if (archiving_to_media) { 1806 if (!popup_and_get_string 1807 ("Size.", 1808 "Please enter how big you want each NFS image to be (in megabytes).", 1809 sz_size, 16)) { 1810 log_to_screen("User has chosen not to backup the PC"); 1811 finish(1); 1812 } 1813 bkpinfo->media_size = atol(sz_size); 1814 if (bkpinfo->media_size <= 0L) { 1815 log_to_screen(_("User has chosen not to backup the PC")); 1816 finish(1); 1817 } 1818 } 1800 1819 mr_msg(3, "Just set nfs_remote_dir to %s", 1801 1820 bkpinfo->nfs_remote_dir); … … 1826 1845 } 1827 1846 bkpinfo->media_size = atol(sz_size); 1847 /* BERLIOS: this should be useless 1848 */ 1828 1849 } else { 1829 1850 bkpinfo->media_size = (long)650; … … 1974 1995 g_ISO_restore_mode = TRUE; 1975 1996 } 1976 #ifdef __Free SD__1997 #ifdef __FreeBSD__ 1977 1998 // skip 1978 1999 #else … … 2156 2177 2157 2178 mr_asprintf(&mountdev, bkpinfo->media_device); 2158 if (!mountdev[0]) {2159 log_it2160 ("(what_number_cd_is_this) Warning - media_device unknown. Finding out...");2161 find_cdrom_device(bkpinfo->media_device, FALSE);2162 }2163 2179 if (!is_this_device_mounted(MNT_CDROM)) { 2164 2180 mount_CDROM_here(mountdev, MNT_CDROM); -
branches/stable/mondo/src/common/libmondo-files.c
r1543 r1594 1271 1271 { 1272 1272 FILE *fout = NULL; 1273 char *tmp = NULL;1274 1273 int retval = 0; 1275 1274 … … 1279 1278 paranoid_fclose(fout); 1280 1279 mr_msg(2, "Created %s", outfile); 1281 mr_asprintf(&tmp, "chmod +x %s", outfile); 1282 paranoid_system(tmp); 1283 mr_free(tmp); 1284 1280 chmod(outfile,0755); 1285 1281 retval = 0; 1286 1282 } else { -
branches/stable/mondo/src/common/libmondo-fork.c
r1592 r1594 119 119 midway_call = mr_malloc(1200); 120 120 121 mr_msg(5,"isofile: %s - cd_number_str: %d", isofile, cd_number_str); 121 122 mr_asprintf(&cd_number_str, "%d", cd_no); 122 123 resolve_naff_tokens(midway_call, basic_call, isofile, "_ISO_"); … … 152 153 } 153 154 if (retval) { 154 mr_msg(2, " Basic call '%s' returned an error.", basic_call);155 mr_msg(2, "Ultimate call '%s' returned an error.", ultimate_call); 155 156 popup_and_OK(_("Press ENTER to continue.")); 156 157 popup_and_OK -
branches/stable/mondo/src/common/libmondo-stream.c
r1574 r1594 329 329 log_it("At this point, dev = %s and res = %d", dev, res); 330 330 331 strcpy(tmp, call_program_and_get_last_line_of_output("\ 332 cdrecord -scanbus 2> /dev/null | tr -s '\t' ' ' | \ 333 grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | \ 334 awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'")); 331 mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | awk '{for(i=1; i<NF; i++) { if (index($i, \"GB\")>0) { print $i;};};};'", cdr_exe); 332 strcpy(tmp, call_program_and_get_last_line_of_output(command)); 333 mr_free(command); 335 334 336 335 siz[0] = '\0'; … … 1296 1295 mr_asprintf(&command, 1297 1296 "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", 1298 bkpinfo-> media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE,1297 bkpinfo->iso_burning_dev, bkpinfo->writer_speed, MONDO_LOGFILE, 1299 1298 MONDO_LOGFILE); 1300 1299 log_it("Opening OUT to next CD with the command"); -
branches/stable/mondo/src/common/libmondo-tools.c
r1592 r1594 329 329 * - Used: @c bkpinfo->backup_data 330 330 * - Used: @c bkpinfo->backup_media_type 331 * - Used: @c bkpinfo-> cdrw_speed331 * - Used: @c bkpinfo->writer_speed 332 332 * - Used: @c bkpinfo->compression_level 333 333 * - Used: @c bkpinfo->include_paths … … 485 485 } 486 486 if (bkpinfo->manual_cd_tray) { 487 if (strstr(mr_conf-> mondo_iso_burning_cmd,"growisofs") == NULL) {487 if (strstr(mr_conf->iso_burning_cmd,"growisofs") != NULL) { 488 488 fatal_error("Unable to use manual CD tray with growisofs"); 489 489 } … … 502 502 sprintf(bkpinfo->call_make_iso, 503 503 "%s %s %s dev=%s speed=%d %s/temporary.iso", 504 mr_conf-> mondo_iso_burning_cmd,504 mr_conf->iso_burning_cmd, 505 505 extra_cdrom_params, 506 mr_conf-> mondo_iso_burning_opt,507 bkpinfo-> media_device,508 bkpinfo-> cdrw_speed,506 mr_conf->iso_burning_opt, 507 bkpinfo->iso_burning_dev, 508 bkpinfo->writer_speed, 509 509 bkpinfo->tmpdir); 510 510 } else { 511 if (strstr(mr_conf->mondo_iso_burning_cmd,"growisofs") == NULL) { 512 if (getenv ("SUDO_COMMAND")) { 513 mr_asprintf(&command, "strings `which growisofs` | grep -c SUDO_COMMAND"); 514 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 515 fatal_error("Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 511 if (bkpinfo->backup_media_type == iso) { 512 sprintf(bkpinfo->call_make_iso, 513 "%s %s . 2>> %s", 514 mr_conf->iso_creation_cmd, 515 mondo_mkisofs_sz, 516 MONDO_LOGFILE); 517 } else { 518 if (strstr(mr_conf->iso_burning_cmd,"growisofs") != NULL) { 519 if (getenv ("SUDO_COMMAND")) { 520 mr_asprintf(&command, "strings %s | grep -c SUDO_COMMAND", mr_conf->iso_burning_cmd); 521 if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) { 522 fatal_error("Can't write DVDs as sudo because growisofs doesn't support this - see the growisofs manpage for details."); 523 } 524 mr_free(command); 516 525 } 517 mr_free(command); 526 sprintf(bkpinfo->call_make_iso, 527 "%s %s %s %s -Z %s -speed=%d . 2>> %s", 528 mr_conf->iso_burning_cmd, 529 mondo_mkisofs_sz, 530 extra_cdrom_params, 531 mr_conf->iso_burning_opt, 532 bkpinfo->iso_burning_dev, 533 bkpinfo->writer_speed, 534 MONDO_LOGFILE); 535 } else { 536 sprintf(bkpinfo->call_make_iso, 537 "%s %s . 2>> %s | %s %s %s dev=%s speed=%d -", 538 mr_conf->iso_creation_cmd, 539 mondo_mkisofs_sz, 540 MONDO_LOGFILE, 541 mr_conf->iso_burning_cmd, 542 extra_cdrom_params, 543 mr_conf->iso_burning_opt, 544 bkpinfo->iso_burning_dev, 545 bkpinfo->writer_speed); 518 546 } 519 sprintf(bkpinfo->call_make_iso, 520 "%s %s %s %s -Z %s -speed=%d . 2>> %s", 521 mr_conf->mondo_iso_burning_cmd, 522 mondo_mkisofs_sz, 523 extra_cdrom_params, 524 mr_conf->mondo_iso_burning_opt, 525 bkpinfo->media_device, 526 bkpinfo->cdrw_speed, 527 MONDO_LOGFILE); 528 } else { 529 sprintf(bkpinfo->call_make_iso, 530 "%s %s . 2>> %s | %s %s %s dev=%s speed=%d -", 531 mr_conf->iso_creation_cmd, 532 mondo_mkisofs_sz, 533 MONDO_LOGFILE, 534 mr_conf->mondo_iso_burning_cmd, 535 extra_cdrom_params, 536 mr_conf->mondo_iso_burning_opt, 537 bkpinfo->media_device, 538 bkpinfo->cdrw_speed); 547 mr_free(mondo_mkisofs_sz); 548 mr_free(extra_cdrom_params); 539 549 } 540 550 } 541 mr_free(mondo_mkisofs_sz);542 mr_free(extra_cdrom_params);543 551 } // end of CD code 544 552 … … 684 692 void reset_bkpinfo(struct s_bkpinfo *bkpinfo) 685 693 { 694 char *tmp = NULL; 695 686 696 mr_msg(1, "Hi"); 687 697 … … 692 702 bkpinfo->manual_cd_tray = FALSE; 693 703 bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE; 694 bkpinfo->media_device[0] = '\0'; 695 bkpinfo->media_size = 0L; 704 mr_asprintf(&tmp,mr_conf->media_device); 705 bkpinfo->media_device = tmp; 706 mr_asprintf(&tmp,mr_conf->iso_burning_dev); 707 bkpinfo->iso_burning_dev = tmp; 708 709 bkpinfo->media_size = mr_conf->iso_burning_speed; 696 710 bkpinfo->boot_loader = '\0'; 697 711 bkpinfo->boot_device[0] = '\0'; … … 732 746 bkpinfo->wipe_media_first = FALSE; 733 747 bkpinfo->differential = FALSE; 734 bkpinfo-> cdrw_speed = 0;748 bkpinfo->writer_speed = mr_conf->iso_burning_speed; 735 749 // patch by Herman Kuster 736 750 bkpinfo->differential = 0; … … 848 862 } 849 863 #endif 850 retval += whine_if_not_found(mr_conf-> mr_iso_creation_cmd);851 retval += whine_if_not_found(mr_conf-> mondo_iso_burning_cmd);864 retval += whine_if_not_found(mr_conf->iso_creation_cmd); 865 retval += whine_if_not_found(mr_conf->iso_burning_cmd); 852 866 retval += whine_if_not_found(MKE2FS_OR_NEWFS); 853 867 retval += whine_if_not_found("bzip2"); -
branches/stable/mondo/src/common/mondostructures.h
r1592 r1594 308 308 * If backup_media_type is anything else, this should be blank. 309 309 */ 310 char media_device[MAX_STR_LEN / 4]; 310 char *media_device; 311 312 /* SCSI node (a la 0,0,0) or NULL if we use the media_device */ 313 char *iso_burning_dev; 311 314 312 315 /** … … 566 569 * The speed of the CD-R[W] drive. 567 570 */ 568 int cdrw_speed;571 int writer_speed; 569 572 570 573 /** -
branches/stable/mondo/src/common/newt-specific.c
r1549 r1594 698 698 699 699 /*@ buffers ********************************************************** */ 700 char *blurb = NULL;701 char *original_contents = NULL;702 700 bool ret = TRUE; 701 size_t n = 0; 703 702 704 703 assert_string_is_neither_NULL_nor_zerolength(title); … … 706 705 assert(output != NULL); 707 706 707 n = strlen(output) + 1; 708 708 if (g_text_mode) { 709 709 printf 710 710 ("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n--> ", 711 711 title, b); 712 (void) fgets(output, maxsize, stdin);713 if ( output[strlen(output) - 1] == '\n')712 mr_getline(&output, &n, stdin); 713 if ((strlen(output) > 1) && (output[strlen(output) - 1] == '\n')) { 714 714 output[strlen(output) - 1] = '\0'; 715 } 715 716 return(ret); 716 717 } 717 mr_asprintf(&blurb, b); 718 text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0); 719 mr_asprintf(&original_contents, output); 720 output[0] = '\0'; 718 719 text = newtTextboxReflowed(2, 1, b, 48, 5, 5, 0); 721 720 type_here = 722 721 newtEntry(2, newtTextboxGetNumLines(text) + 2, 723 original_contents, 50, 724 #ifdef __cplusplus 725 0, NEWT_FLAG_RETURNEXIT 726 #else 722 output, 50, 727 723 (void *) &entry_value, NEWT_FLAG_RETURNEXIT 728 #endif729 724 ); 730 725 b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, _(" OK ")); … … 736 731 center_string(blurb, 80); 737 732 */ 738 newtPushHelpLine(blurb); 739 mr_free(blurb); 733 newtPushHelpLine(b); 740 734 741 735 b_res = newtRunForm(myForm); 742 strcpy(output, entry_value);743 736 newtPopHelpLine(); 744 737 if (b_res == b_2) { 745 strcpy(output, original_contents);746 738 ret = FALSE; 739 } else { 740 mr_allocstr(output, newtEntryGetValue(entry_value)); 747 741 } 748 742 newtFormDestroy(myForm); 749 743 newtPopWindow(); 750 mr_free(original_contents);751 744 return(ret); 752 745 }
Note:
See TracChangeset
for help on using the changeset viewer.