Changeset 1594 in MondoRescue for branches/stable/mondo
- Timestamp:
- Aug 26, 2007, 12:26:06 PM (17 years ago)
- Location:
- branches/stable/mondo
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mondo/distributions/conf/mondo.conf.dist
r1592 r1594 14 14 mondo_iso_burning_cmd="/usr/bin/cdrecord" 15 15 #mondo_iso_burning_cmd="/usr/bin/growisofs" 16 # 17 18 # 19 # If necessary (different from mondo_media_device), 20 # precise the string used as a device by the previous command 21 #mondo_iso_burning_dev="0,0,0" 16 22 17 23 # 18 24 # ISO Burning CLI command options 19 25 mondo_iso_burning_opt="-eject fs=24m driveropts=burnfree" 20 #mondo_iso_burning_opt ions="-J -r -v -p MondoRescue -publisher http://www.mondorescue.org -A MondoRescue -o _ISO_ -V _CD#_ -boot-info-table -no-emul-boot -boot-load-size 4"26 #mondo_iso_burning_opt="-J -r -v -p MondoRescue -publisher http://www.mondorescue.org -A MondoRescue -o _ISO_ -V _CD#_ -boot-info-table -no-emul-boot -boot-load-size 4" 21 27 22 28 # … … 26 32 27 33 # 28 # Default size of media 34 # Erase CLI command to use fir RW media 35 # 36 mondo_rw_erase_cmd="/usr/bin/cdrecord" 37 38 # 39 # Erase CLI command to use fir RW media 40 # 41 mondo_rw_erase_opt="blank=fast" 42 43 # 44 # Default size of media in MiB 29 45 # 30 46 # Use 4480 for DVDs, 650 or 700 for CDs -
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 } -
branches/stable/mondo/src/include/mr_conf.h
r1592 r1594 27 27 /* ISO Burning CLI command to use */ 28 28 char *iso_burning_cmd; 29 /* ISO Burning device to use (optional) */ 30 char *iso_burning_dev; 29 31 /* ISO Burning CLI command options */ 30 32 char *iso_burning_opt; … … 121 123 extern void mr_conf_close(void); 122 124 123 /*read integer number after string str in the current file*/ 124 extern int mr_conf_iread(const char *field_name); 125 /*read integer number (under a string format to be freed later on) after string str in the current file*/ 126 /* use atoi after */ 127 extern char *mr_conf_iread(const char *field_name); 125 128 126 /*read double/float number after string str in the current file*/ 127 extern double mr_conf_fread(const char *field_name); 129 /*read double/float number (under a string format to be freed later on) after string str in the current file*/ 130 /* use atof after */ 131 extern char *mr_conf_fread(const char *field_name); 128 132 129 /*read boolean after string str in the current file*/ 130 extern bool mr_conf_bread(const char *field_name); 133 /*read boolean (under a string format to be freed later on) after string str in the current file*/ 134 /* use mr_atob after */ 135 extern char *mr_conf_bread(const char *field_name); 131 136 132 137 /* -
branches/stable/mondo/src/include/mr_types.h
r1264 r1594 19 19 #endif 20 20 21 extern bool mr_atob(const char *str); 22 21 23 #endif /* MR_TYPES_H */ -
branches/stable/mondo/src/include/my-stuff.h
r1592 r1594 238 238 #define MNT_RESTORING "/mnt/RESTORING" 239 239 240 /** @def VANILLA_SCSI_CDROM The first SCSI CD-ROM in the system (most likely to be the one to write to). */241 240 /** @def VANILLA_SCSI_TAPE The SCSI tape radical on the system (most likely to be the one towrite to. */ 242 241 /** @def DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE A string whose presence in a device name indicates the … … 248 247 /** @def CP_BIN The GNU @c cp binary to use. */ 249 248 #ifdef __FreeBSD__ 250 #define VANILLA_SCSI_CDROM "/dev/cd0"251 249 #define VANILLA_SCSI_TAPE "/dev/sa" 252 #define VANILLA_USB_DEVICE "/dev/tobegivenbyfreebsdguru"253 250 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/vinum/" 254 251 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE … … 258 255 #define CP_BIN "gcp" 259 256 #else 260 #define VANILLA_SCSI_CDROM "/dev/scd0"261 257 #define VANILLA_SCSI_TAPE "/dev/st0" 262 #define VANILLA_USB_DEVICE "/dev/sda"263 258 #define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE "/dev/md" 264 259 #define RAID_DEVICE_STUB DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE … … 299 294 #define log_it(format, args...) mr_msg(2, format, ## args) 300 295 301 #define DEFAULT_DVD_DISK_SIZE 4480 ///< The default size (in MB) of a DVD disk, unless the user says otherwise.302 303 296 #define DEFAULT_DEBUG_LEVEL 4 ///< By default, don't log messages with a loglevel higher than this. 297 #define DEFAULT_MR_LOGLEVEL 4 304 298 305 299 #define SZ_NTFSPROG_VOLSIZE "1048576" // was 4096 … … 309 303 #define MNT_FLOPPY "/mnt/floppy" 310 304 311 #define DEFAULT_MR_LOGLEVEL 4312 313 305 #endif /* _MY_STUFF_H_ */ -
branches/stable/mondo/src/lib/mr_conf.c
r1584 r1594 192 192 193 193 /*read integer number after string str in the current file*/ 194 intmr_conf_iread(const char *field_name) {194 char *mr_conf_iread(const char *field_name) { 195 195 char *p = NULL; /*pointer to the field */ 196 int ret = 0; /*return value*/196 char *p1 = NULL; /*return field */ 197 197 198 198 p = mr_conf_read(field_name); 199 199 if (p != NULL) { 200 ret = atoi(p);201 } 202 return ret;200 mr_asprintf(&p1, "%d", p); 201 } 202 return p1; 203 203 } 204 204 205 205 /*read float/double number after string str in the current file*/ 206 doublemr_conf_fread(const char *field_name) {206 char *mr_conf_fread(const char *field_name) { 207 207 char *p = NULL; /*pointer to the field */ 208 double ret = 0.0; /*return value*/208 char *p1 = NULL; /*return field */ 209 209 210 210 p = mr_conf_read(field_name); 211 211 if (p != NULL) { 212 ret = atof(p);213 } 214 return ret;212 mr_asprintf(&p1, "%f", p); 213 } 214 return p1; 215 215 } 216 216 … … 265 265 266 266 /*read boolean after string str in the current file*/ 267 boolmr_conf_bread(const char *field_name) {267 char *mr_conf_bread(const char *field_name) { 268 268 char *p = NULL; /*pointer to the field */ 269 bool ret = FALSE;269 char *p1 = NULL; /*pointer to the field */ 270 270 271 p = mr_conf_ sread(field_name);271 p = mr_conf_read(field_name); 272 272 if (p != NULL) { 273 273 /* match if yes/true/1 */ … … 275 275 (strncasecmp(p, "t" , (size_t)1) == 0) || 276 276 (strncasecmp(p, "1" , (size_t)1) == 0)) { 277 ret = TRUE; 278 } 279 } 280 return ret; 277 mr_asprintf(&p1, "%d", TRUE); 278 } else { 279 mr_asprintf(&p1, "%d", FALSE); 280 } 281 } 282 return p1; 283 } 284 285 /* Convert a string with decimal value of TRUE/FALSE in boolean */ 286 bool mr_atob(const char *str) { 287 bool ret = FALSE; 288 char *p = NULL; 289 290 mr_asprintf(&p, "%d", FALSE); 291 if (strcmp(str,p) != 0) { 292 ret = TRUE; 293 } 294 mr_free(p); 295 return(ret); 281 296 } 282 297 -
branches/stable/mondo/src/lib/mr_str.c
r1551 r1594 13 13 14 14 /** 15 * Safe alternative to standard function strok() 16 * Build a partition name from a drive and a partition number. 15 * Safe alternative to standard function strtok() 17 16 * @param instr 18 17 * @param delims -
branches/stable/mondo/src/mondoarchive/mondo-cli.c
r1582 r1594 93 93 flag_set[i] = FALSE; 94 94 } 95 bkpinfo->media_size = (long)650; 96 res = 97 retrieve_switches_from_command_line(argc, argv, flag_val, 95 res = retrieve_switches_from_command_line(argc, argv, flag_val, 98 96 flag_set); 99 97 retval += res; … … 152 150 assert(value != NULL); 153 151 154 bkpinfo->media_size = 0L; /* dummy value */155 152 mr_asprintf(&tmp, value); 156 153 q = strchr(tmp, ','); … … 211 208 212 209 /* compulsory */ 213 i = flag_set[' c'] + flag_set['i'] + flag_set['n'] +210 i = flag_set['i'] + flag_set['n'] + 214 211 flag_set['t'] + flag_set['u'] + flag_set['r'] + 215 212 flag_set['w'] + flag_set['C'] + flag_set['U']; … … 316 313 317 314 if (g_kernel_version >= 2.6 && !flag_set['d'] 318 && (flag_set['c'] || flag_set['w'])) {315 && flag_set['w']) { 319 316 fatal_error 320 317 ("If you are using the 2.6.x kernel, please specify the CD-R(W) device."); … … 331 328 } 332 329 333 if (flag_set[' c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) {330 if (flag_set['w'] || flag_set['C'] || flag_set['r']) { 334 331 if (!flag_set['r'] && g_kernel_version <= 2.5 335 332 && strstr(flag_val['d'], "/dev/")) { … … 352 349 ("Please install dvdrecord/cdrecord and try again."); 353 350 } 354 if (flag_set['C']) { 355 bkpinfo->cdrw_speed = atoi(flag_val['C']); 356 if (bkpinfo->cdrw_speed < 1) { 357 fatal_error 358 ("You specified a silly speed for a CD-R[W] drive"); 359 } 360 if (!flag_set['L']) { 361 log_to_screen 362 (_("You must use -L with -C. Therefore I am setting it for you.")); 363 flag_set['L'] = 1; 364 flag_val['L'][0] = '\0'; 365 } 366 } else { 367 mr_msg(3, "flag_val['c'] = %s", flag_val['c']); 351 if (flag_set['w']) { 368 352 mr_msg(3, "flag_val['w'] = %s", flag_val['w']); 369 if (flag_set['c']) { 370 bkpinfo->cdrw_speed = atoi(flag_val['c']); 371 } else if (flag_set['w']) { 372 bkpinfo->cdrw_speed = atoi(flag_val['w']); 373 } else if (flag_set['r']) { 374 bkpinfo->cdrw_speed = 1; /*atoi(flag_val['r']); */ 375 } 376 377 if (bkpinfo->cdrw_speed < 1) { 378 fatal_error 379 ("You specified a silly speed for a CD-R[W] drive"); 380 } 353 bkpinfo->writer_speed = atoi(flag_val['w']); 354 } 355 356 if (bkpinfo->writer_speed < 1) { 357 fatal_error 358 ("You specified a silly speed for a burner"); 381 359 } 382 360 } … … 431 409 fatal_error 432 410 ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag."); 433 }434 if (!flag_set['s']) {435 sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB436 strcat(flag_val['s'], "m");437 log_to_screen438 (_("You did not specify a size (-s) for DVD. I'm guessing %s."),439 flag_val['s']);440 flag_set['s'] = 1;441 411 } 442 412 } … … 457 427 } 458 428 } else if (flag_set['u'] || flag_set['t']) { 429 /* Force autidetection */ 459 430 bkpinfo->media_size = 0L; 460 431 } else { … … 492 463 } 493 464 494 if (flag_set['c']) {495 bkpinfo->backup_media_type = cdr;496 }497 465 if (flag_set['C']) { 498 466 bkpinfo->backup_media_type = cdstream; … … 659 627 strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN); 660 628 } else { /* backup device (if tape/CD-R/CD-RW) */ 661 strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4); 629 mr_asprintf(&tmp2,flag_val['d']); 630 mr_free(bkpinfo->media_device); 631 bkpinfo->media_device = tmp2; 662 632 } 663 633 } … … 678 648 679 649 if (!flag_set['d'] 680 && (flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['U'])) { 681 if (g_kernel_version >= 2.6) { 682 if (popup_and_get_string 683 (_("Device"), _("Please specify the device"), 684 bkpinfo->media_device, MAX_STR_LEN / 4)) { 685 retval++; 686 log_to_screen(_("User opted to cancel.")); 687 } 688 } else if (find_cdrw_device(bkpinfo->media_device)) { 689 retval++; 690 log_to_screen 691 (_("Tried and failed to find CD-R[W] drive automatically.\n")); 650 && (flag_set['w'] || flag_set['C'] || flag_set['U'])) { 651 if (bkpinfo->media_device) { 652 mr_msg(4, "Using device %s", bkpinfo->media_device); 653 strncpy(flag_val['d'], bkpinfo->media_device, MAX_STR_LEN / 4); 654 flag_set['d'] = TRUE; 692 655 } else { 693 flag_set['d'] = TRUE; 694 strncpy(flag_val['d'], bkpinfo->media_device, MAX_STR_LEN / 4); 656 fatal_error(_("No device provided either on command line or in the configuration file")); 695 657 } 696 658 } -
branches/stable/mondo/src/mondoarchive/mondoarchive.c
r1592 r1594 96 96 mr_msg(7, "Seven..."); 97 97 mr_msg(8, "Eight..."); 98 printf( "See %s for details of backup run.\n", MONDO_LOGFILE);98 printf(_("See %s for details of backup run.\n"), MONDO_LOGFILE); 99 99 } 100 100 … … 133 133 } 134 134 135 /* reset/empty the mr_ar_conf structure from mondo's conf file */ 136 static void mr_ar_reset_conf(struct mr_ar_conf *mr_cnf) { 137 138 /* This should correspond to the default conf file */ 139 /* Especially for boolean values */ 140 mr_cnf->iso_creation_cmd = NULL; 141 mr_cnf->iso_creation_opt = NULL; 142 mr_cnf->iso_burning_cmd = NULL; 143 mr_cnf->iso_burning_opt = NULL; 144 mr_cnf->iso_burning_dev = NULL; 145 mr_cnf->iso_burning_speed = 0; 146 mr_cnf->media_size = 0; 147 mr_cnf->media_device = NULL; 148 mr_cnf->iso_burning_dev = NULL; 149 mr_cnf->manual_tray = FALSE; 150 mr_cnf->log_level = 0; 151 mr_cnf->prefix = NULL; 152 mr_cnf->external_tape_blocksize = 0; 153 mr_cnf->internal_tape_blocksize = 0; 154 mr_cnf->slice_size = 0; 155 mr_cnf->deplist_file = NULL; 156 mr_cnf->create_mindi_cd = FALSE; 157 mr_cnf->kernel = NULL; 158 mr_cnf->additional_modules = NULL; 159 mr_cnf->boot_loader = NULL; 160 mr_cnf->differential = FALSE; 161 mr_cnf->compression_tool = NULL; 162 mr_cnf->compression_level = 0; 163 mr_cnf->exclude_paths = NULL; 164 mr_cnf->include_paths = NULL; 165 mr_cnf->ui_mode = NULL; 166 mr_cnf->automatic_restore = FALSE; 167 mr_cnf->scratch_dir = NULL; 168 mr_cnf->tmp_dir = NULL; 169 mr_cnf->images_dir = NULL; 170 } 171 135 172 /* fill the mr_ar_conf structure from mindi's conf file */ 136 173 static void mr_ar_store_conf_mindi(struct mr_ar_conf *mr_cnf) { … … 153 190 char *p = NULL; 154 191 155 mr_asprintf(&p, mr_conf_sread("mondo_iso_burning_cmd")); 156 mr_cnf->iso_burning_cmd = p; 157 p = NULL; 158 159 mr_asprintf(&p, mr_conf_sread("mondo_iso_burning_opt")); 160 mr_cnf->iso_burning_opt = p; 161 p = NULL; 162 163 mr_cnf->iso_burning_speed = mr_conf_iread("mondo_iso_burning_speed"); 164 mr_cnf->media_size = mr_conf_iread("mondo_media_size"); 165 166 mr_asprintf(&p, mr_conf_sread("mondo_media_device")); 167 mr_cnf->media_device = p; 168 p = NULL; 169 170 mr_cnf->manual_tray = mr_conf_bread("mondo_manual_tray"); 171 mr_cnf->log_level = mr_conf_iread("mondo_log_level"); 172 173 mr_asprintf(&p, mr_conf_sread("mondo_prefix")); 174 mr_cnf->prefix = p; 175 p = NULL; 176 177 mr_cnf->external_tape_blocksize = mr_conf_iread("mondo_external_tape_blocksize"); 178 mr_cnf->internal_tape_blocksize = mr_conf_iread("mondo_internal_tape_blocksize"); 179 mr_cnf->slice_size = mr_conf_iread("mondo_slice_size"); 180 181 mr_asprintf(&p, mr_conf_sread("mondo_deplist_file")); 182 mr_cnf->deplist_file = p; 183 p = NULL; 184 185 mr_cnf->create_mindi_cd = mr_conf_bread("mondo_create_mindi_cd"); 186 187 mr_asprintf(&p, mr_conf_sread("mondo_kernel")); 188 mr_cnf->kernel = p; 189 p = NULL; 190 191 mr_asprintf(&p, mr_conf_sread("mondo_additional_modules")); 192 mr_cnf->additional_modules = p; 193 p = NULL; 194 195 mr_asprintf(&p, mr_conf_sread("mondo_boot_loader")); 196 mr_cnf->boot_loader = p; 197 p = NULL; 198 199 mr_cnf->differential = mr_conf_bread("mondo_differential"); 200 201 mr_asprintf(&p, mr_conf_sread("mondo_compression_tool")); 202 mr_cnf->compression_tool = p; 203 p = NULL; 204 205 mr_cnf->compression_level = mr_conf_iread("mondo_compression_level"); 206 207 mr_asprintf(&p, mr_conf_sread("mondo_exclude_paths")); 208 mr_cnf->exclude_paths = p; 209 p = NULL; 210 211 mr_asprintf(&p, mr_conf_sread("mondo_include_paths")); 212 mr_cnf->include_paths = p; 213 p = NULL; 214 215 mr_asprintf(&p, mr_conf_sread("mondo_ui_mode")); 216 mr_cnf->ui_mode = p; 217 p = NULL; 218 219 mr_cnf->automatic_restore = mr_conf_bread("mondo_automatic_restore"); 220 221 mr_asprintf(&p, mr_conf_sread("mondo_scratch_dir")); 222 mr_cnf->scratch_dir = p; 223 p = NULL; 224 225 mr_asprintf(&p, mr_conf_sread("mondo_tmp_dir")); 226 mr_cnf->tmp_dir = p; 227 p = NULL; 228 229 mr_asprintf(&p, mr_conf_sread("mondo_images_dir")); 230 mr_cnf->images_dir = p; 231 p = NULL; 192 p = mr_conf_sread("mondo_iso_burning_cmd"); 193 if (p != NULL) { 194 mr_cnf->iso_burning_cmd = p; 195 } 196 197 p = mr_conf_sread("mondo_iso_burning_opt"); 198 if (p != NULL) { 199 mr_cnf->iso_burning_opt = p; 200 } 201 202 p = mr_conf_sread("mondo_iso_burning_dev"); 203 if (p != NULL) { 204 mr_cnf->iso_burning_dev = p; 205 } 206 207 p = mr_conf_iread("mondo_iso_burning_speed"); 208 if (p != NULL ) { 209 mr_cnf->iso_burning_speed = atoi(p); 210 mr_free(p); 211 } 212 213 p = mr_conf_iread("mondo_media_size"); 214 if (p != NULL ) { 215 mr_cnf->media_size = atoi(p); 216 mr_free(p); 217 } 218 219 p = mr_conf_sread("mondo_media_device"); 220 if (p != NULL) { 221 mr_cnf->media_device = p; 222 } 223 /* If no specific device name for the burning command (a la ATAPI:0,0,0), 224 * then use the normal device name (a la /dev/hda) */ 225 if ((mr_cnf->iso_burning_dev == NULL) && (mr_cnf->media_device != NULL)) { 226 mr_asprintf(&p, mr_cnf->media_device); 227 mr_cnf->iso_burning_dev = p; 228 } 229 230 p = mr_conf_bread("mondo_manual_tray"); 231 if (p != NULL) { 232 mr_cnf->manual_tray = mr_atob(p); 233 mr_free(p); 234 } 235 236 p = mr_conf_iread("mondo_log_level"); 237 if (p != NULL) { 238 mr_cnf->log_level = atoi(p); 239 mr_free(p); 240 } 241 242 p = mr_conf_sread("mondo_prefix"); 243 if (p != NULL) { 244 mr_cnf->prefix = p; 245 } 246 247 p = mr_conf_iread("mondo_external_tape_blocksize"); 248 if (p != NULL) { 249 mr_cnf->external_tape_blocksize = atoi(p); 250 mr_free(p); 251 } 252 253 p = mr_conf_iread("mondo_internal_tape_blocksize"); 254 if (p != NULL) { 255 mr_cnf->internal_tape_blocksize = atoi(p); 256 mr_free(p); 257 } 258 259 p = mr_conf_iread("mondo_slice_size"); 260 if (p != NULL) { 261 mr_cnf->slice_size = atoi(p); 262 mr_free(p); 263 } 264 265 p = mr_conf_sread("mondo_deplist_file"); 266 if (p != NULL) { 267 mr_cnf->deplist_file = p; 268 } 269 270 p = mr_conf_bread("mondo_create_mindi_cd"); 271 if (p != NULL) { 272 mr_cnf->create_mindi_cd = mr_atob(p); 273 mr_free(p); 274 } 275 276 p = mr_conf_sread("mondo_kernel"); 277 if (p != NULL) { 278 mr_cnf->kernel = p; 279 } 280 281 p = mr_conf_sread("mondo_additional_modules"); 282 if (p != NULL) { 283 mr_cnf->additional_modules = p; 284 } 285 286 p = mr_conf_sread("mondo_boot_loader"); 287 if (p != NULL) { 288 mr_cnf->boot_loader = p; 289 } 290 291 p = mr_conf_bread("mondo_differential"); 292 if (p != NULL) { 293 mr_cnf->differential = mr_atob(p); 294 mr_free(p); 295 } 296 297 p = mr_conf_sread("mondo_compression_tool"); 298 if (p != NULL) { 299 mr_cnf->compression_tool = p; 300 } 301 302 p = mr_conf_iread("mondo_compression_level"); 303 if (p != NULL) { 304 mr_cnf->compression_level = atoi(p); 305 mr_free(p); 306 } 307 308 p = mr_conf_sread("mondo_exclude_paths"); 309 if (p != NULL) { 310 mr_cnf->exclude_paths = p; 311 } 312 313 p = mr_conf_sread("mondo_include_paths"); 314 if (p != NULL) { 315 mr_cnf->include_paths = p; 316 } 317 318 p = mr_conf_sread("mondo_ui_mode"); 319 if (p != NULL) { 320 mr_cnf->ui_mode = p; 321 } 322 323 p = mr_conf_bread("mondo_automatic_restore"); 324 if (p != NULL) { 325 mr_cnf->automatic_restore = mr_atob(p); 326 mr_free(p); 327 } 328 329 p = mr_conf_sread("mondo_scratch_dir"); 330 if (p != NULL) { 331 mr_cnf->scratch_dir = p; 332 } 333 334 p = mr_conf_sread("mondo_tmp_dir"); 335 if (p != NULL) { 336 mr_cnf->tmp_dir = p; 337 } 338 339 p = mr_conf_sread("mondo_images_dir"); 340 if (p != NULL) { 341 mr_cnf->images_dir = p; 342 } 232 343 mr_msg(5, "Directory for images is %s", mr_cnf->images_dir); 233 344 } … … 242 353 mr_free(mr_cnf->iso_creation_opt); 243 354 mr_free(mr_cnf->iso_burning_cmd); 355 mr_free(mr_cnf->iso_burning_dev); 244 356 mr_free(mr_cnf->iso_burning_opt); 245 357 mr_free(mr_cnf->media_device); … … 301 413 (void) textdomain("mondo"); 302 414 #endif 303 printf(_("Initializing... "));415 printf(_("Initializing...\n")); 304 416 305 417 /* Reference a dummy cleanup function for mr_exit temporarily */ … … 327 439 328 440 /* Conf file management */ 441 mr_conf = mr_malloc(sizeof(struct mr_ar_conf)); 442 mr_ar_reset_conf(mr_conf); 329 443 /* Check md5 sum before */ 330 444 /* Get content */ … … 332 446 mr_log_exit(-1, "Unable to open "MONDO_CONF_DIR"/mondo.conf.dist"); 333 447 } 334 mr_conf = malloc(sizeof(struct mr_ar_conf));335 448 mr_ar_store_conf(mr_conf); 336 449 /* Reference the right cleanup function for mr_exit now it's allocated */ 337 450 mr_cleanup = &mr_ar_cleanup; 338 339 451 mr_conf_close(); 452 453 if (mr_conf_open(MONDO_CONF_DIR"/mondo.conf") == 0) { 454 mr_ar_store_conf(mr_conf); 455 mr_conf_close(); 456 } 340 457 341 458 /* Check md5 sum before */ -
branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c
r1591 r1594 298 298 if (res) { 299 299 log_OS_error(command); 300 log_msg(2, tmp);300 mr_msg(2, tmp); 301 301 } 302 302 mr_free(command); … … 594 594 595 595 kill_petris(); 596 paranoid_free(new);597 paranoid_free(cwd);596 mr_free(new); 597 mr_free(cwd); 598 598 return (retval); 599 599 } … … 635 635 if (bkpinfo->disaster_recovery 636 636 && does_file_exist("/tmp/CDROM-LIVES-HERE")) { 637 strcpy(bkpinfo->media_device,637 mr_allocstr(bkpinfo->media_device, 638 638 last_line_of_file("/tmp/CDROM-LIVES-HERE")); 639 } else {640 find_cdrom_device(bkpinfo->media_device, FALSE);641 639 } 642 640 res = verify_tape_backups(bkpinfo); -
branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c
r1581 r1594 674 674 if (bkpinfo->disaster_recovery 675 675 && does_file_exist("/tmp/CDROM-LIVES-HERE")) { 676 strcpy(bkpinfo->media_device,676 mr_allocstr(bkpinfo->media_device, 677 677 last_line_of_file("/tmp/CDROM-LIVES-HERE")); 678 } else {679 find_cdrom_device(bkpinfo->media_device, TRUE);680 678 } 681 679 … … 725 723 FALSE); 726 724 if (run_program_and_log_output("ls " MNT_RESTORING " /tmp", FALSE)) { 727 run_program_and_log_output("chmod 1777 " MNT_RESTORING "/tmp", 728 FALSE); 725 chmod(MNT_RESTORING "/tmp",1777 ); 729 726 } 730 727 run_program_and_log_output("mkdir -p " MNT_RESTORING 731 728 "/var/run/console", FALSE); 732 run_program_and_log_output("chmod 777 " MNT_RESTORING "/dev/null", 733 FALSE); 729 chmod(MNT_RESTORING "/dev/null",0777); 734 730 run_program_and_log_output("cd " MNT_RESTORING 735 731 "; for i in `ls home/`; do echo \"Moving $i's spurious files to $i/.disabled\"; mkdir \"$i\"/.disabled ; mv -f \"$i\"/.DCOP* \"$i\"/.MCOP* \"$i\"/.*authority \"$i\"/.kde/tmp* \"$i\"/.kde/socket* \"$i\"/.disabled/ ; done", … … 838 834 if (bkpinfo->disaster_recovery) { 839 835 if (bkpinfo->backup_media_type == cdstream) { 840 strcpy(bkpinfo->media_device, "/dev/cdrom"); 841 bkpinfo->media_size = (long)1999*1024; 836 mr_allocstr(bkpinfo->media_device, "/dev/cdrom"); 842 837 bkpinfo->media_size = (long)650; /* good guess */ 843 838 } else if (bkpinfo->backup_media_type == tape … … 846 841 fatal_error("Cannot get tape device name from cfg file"); 847 842 } 848 strcpy(bkpinfo->media_device, value);843 mr_allocstr(bkpinfo->media_device, value); 849 844 read_cfg_var(cfg_file, "media-size", value); 850 845 bkpinfo->media_size = atol(value); … … 852 847 bkpinfo->media_device); 853 848 } else { 854 strcpy(bkpinfo->media_device, "/dev/cdrom"); /* we don't really need this var */ 855 bkpinfo->media_size = (long)1999*1024; /* 650, probably, but we don't need this var anyway */ 849 mr_allocstr(bkpinfo->media_device, "/dev/cdrom"); /* we don't really need this var */ 856 850 bkpinfo->media_size = (long)1999*1024; /* 650, probably, but we don't need this var anyway */ 857 851 mr_msg(2, "Backup medium is CD-R[W]"); … … 1019 1013 "Unable to mount isodir. Perhaps this is really a CD backup?"); 1020 1014 bkpinfo->backup_media_type = cdr; 1021 strcpy(bkpinfo->media_device, "/dev/cdrom"); /* superfluous */1015 mr_allocstr(bkpinfo->media_device, "/dev/cdrom"); /* superfluous */ 1022 1016 bkpinfo->isodir[0] = '\0'; 1023 1017 mr_free(iso_mnt); … … 2150 2144 2151 2145 if (strlen(bkpinfo->media_device) == 0) { 2152 strcpy(bkpinfo->media_device, "/dev/st0");2146 mr_allocstr(bkpinfo->media_device, "/dev/st0"); 2153 2147 mr_msg(2, "media_device is blank; assuming %s", 2154 2148 bkpinfo->media_device); … … 2157 2151 if (extract_cfg_file_and_mountlist_from_tape_dev 2158 2152 (bkpinfo->media_device)) { 2159 strcpy(bkpinfo->media_device, "/dev/st0");2153 mr_allocstr(bkpinfo->media_device, "/dev/st0"); 2160 2154 if (extract_cfg_file_and_mountlist_from_tape_dev 2161 2155 (bkpinfo->media_device)) { 2162 strcpy(bkpinfo->media_device, "/dev/osst0");2156 mr_allocstr(bkpinfo->media_device, "/dev/osst0"); 2163 2157 if (extract_cfg_file_and_mountlist_from_tape_dev 2164 2158 (bkpinfo->media_device)) { 2165 strcpy(bkpinfo->media_device, "/dev/ht0");2159 mr_allocstr(bkpinfo->media_device, "/dev/ht0"); 2166 2160 if (extract_cfg_file_and_mountlist_from_tape_dev 2167 2161 (bkpinfo->media_device)) { 2168 2162 mr_msg(3, 2169 2163 "I tried lots of devices but none worked."); 2170 strcpy(bkpinfo->media_device, tmp);2164 mr_allocstr(bkpinfo->media_device, tmp); 2171 2165 } 2172 2166 } -
branches/stable/mondo/src/mondorestore/mondorestore.c
r1581 r1594 912 912 } 913 913 interactively_obtain_media_parameters_from_user(bkpinfo, FALSE); 914 if (!bkpinfo->media_device [0]) {914 if (!bkpinfo->media_device) { 915 915 mr_msg(2, "Warning - failed to find media dev"); 916 916 } else { … … 954 954 } 955 955 run_program_and_log_output("umount " MNT_CDROM, FALSE); 956 if ((!bkpinfo->please_dont_eject) && (bkpinfo->media_device != NULL)) {956 if ((!bkpinfo->please_dont_eject) && (bkpinfo->media_device)) { 957 957 eject_device(bkpinfo->media_device); 958 958 } … … 3037 3037 if (argc == 3 && strcmp(argv[1], "--paa") == 0) { 3038 3038 g_current_media_number = atoi(argv[2]); 3039 pause_and_ask_for_cdr(5 , NULL);3039 pause_and_ask_for_cdr(5); 3040 3040 paranoid_MR_finish(0); 3041 3041 } else if (!bkpinfo->disaster_recovery) { // live!
Note:
See TracChangeset
for help on using the changeset viewer.