Changeset 1594 in MondoRescue for branches/stable


Ignore:
Timestamp:
Aug 26, 2007, 12:26:06 PM (17 years ago)
Author:
Bruno Cornec
Message:

Use of conf file entries (iso_burning_*, media_device, media_size)
and adapatation of the rest of the code to that (including bkpinfo)

Location:
branches/stable
Files:
1 deleted
22 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo-doc/mondoarchive.8

    r1581 r1594  
    7878
    7979.TP
    80 .BI "-c " speed
    81 Use CD-R drive as backup device and its (write-once) disks as backup media.
    82 
    83 .TP
    8480.BI "-w " speed
    85 Use CD-RW drive as backup device and its (write/rewrite) disks as backup media.
     81Specify the speed to use for the writer (CR-RW|DVD-+RW|...).
    8682Mondo will wipe media before writing to them.
    8783
    8884.TP
    8985.BI "-r "
    90 Use DVD drive as backup device and its disks as backup media. Growisofs decides
    91 on the best speed for your drive. Note that calling mondoarchive
     86Use DVD drive as backup device and its disks as backup media.
     87Note that calling mondoarchive
    9288.B using sudo when writing to DVDs will fail
    9389because growisofs does not support this - see the growisofs manpage for
     
    9591
    9692.TP
    97 .BI "-C " speed
     93.BI "-C "
    9894Use CD-R drive as a streaming device, almost like a tape streamer. Use
    9995write-once disks as backup media.
  • branches/stable/mondo/distributions/conf/mondo.conf.dist

    r1592 r1594  
    1414mondo_iso_burning_cmd="/usr/bin/cdrecord"
    1515#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"
    1622
    1723#
    1824# ISO Burning CLI command options
    1925mondo_iso_burning_opt="-eject fs=24m driveropts=burnfree"
    20 #mondo_iso_burning_options="-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"
    2127
    2228#
     
    2632
    2733#
    28 # Default size of media
     34# Erase CLI command to use fir RW media
     35#
     36mondo_rw_erase_cmd="/usr/bin/cdrecord"
     37
     38#
     39# Erase CLI command to use fir RW media
     40#
     41mondo_rw_erase_opt="blank=fast"
     42
     43#
     44# Default size of media in MiB
    2945#
    3046# Use 4480 for DVDs, 650 or 700 for CDs
  • branches/stable/mondo/src/common/libmondo-archive-EXT.h

    r1152 r1594  
    2424extern int offer_to_write_boot_floppies_to_physical_disks(struct s_bkpinfo
    2525                                                          *bkpinfo);
    26 extern void pause_and_ask_for_cdr(int, bool *);
     26extern void pause_and_ask_for_cdr(int);
    2727extern int slice_up_file_etc(struct s_bkpinfo *bkpinfo,
    2828                             char *biggie_filename,
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1592 r1594  
    5454    struct seminfo *__buf;
    5555};
     56#endif
    5657#endif                          /* __FreeBSD__ */
    5758
     
    12181219 * @param bkpinfo The backup information structure. Fields used:
    12191220 * - @c backup_media_type
    1220  * - @c cdrw_speed
     1221 * - @c writer_speed
    12211222 * - @c prefix
    12221223 * - @c isodir
     
    12581259    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    12591260        if (bkpinfo->backup_media_type == cdstream) {
    1260             openout_cdstream(bkpinfo->media_device, bkpinfo->cdrw_speed);
     1261            openout_cdstream(bkpinfo->media_device, bkpinfo->writer_speed);
    12611262        } else {
    12621263            openout_tape(bkpinfo->media_device, bkpinfo->internal_tape_block_size); /* sets g_tape_stream */
     
    15821583    char *tmp = NULL;
    15831584    char *old_pwd;
    1584     char *result_sz = NULL;
    15851585    char *message_to_screen = NULL;
    15861586    char *sz_blank_disk = NULL;
    15871587    char *tmp2 = NULL;
    15881588    char *tmp3 = NULL;
    1589     bool cd_is_mountable;
    15901589
    15911590    malloc_string(old_pwd);
     
    16081607    mr_free(tmp);
    16091608
    1610     if (bkpinfo->backup_media_type == iso && bkpinfo->manual_cd_tray) {
     1609    if (bkpinfo->backup_media_type != iso && bkpinfo->manual_cd_tray) {
    16111610        popup_and_OK(_("Please insert new media and press Enter."));
    16121611    }
     
    16161615    /* BERLIOS: Do not ignore getcwd result */
    16171616    (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);
    16211618    chdir(bkpinfo->scratchdir);
    16221619
     
    16431640
    16441641        /* 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        }
    16461645        if (retval) {
    16471646            log_to_screen
     
    16491648        } else {
    16501649            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,
    16531651                                        MONDO_LOGFILE, message_to_screen);
    16541652            if (res) {
     
    17121710                res =
    17131711                    eval_call_to_make_ISO(bkpinfo, bkpinfo->call_make_iso,
    1714                                           bkpinfo->scratchdir,
     1712                                          destfile,
    17151713                                          g_current_media_number,
    17161714                                          MONDO_LOGFILE,
     
    24692467                                             bool keep_looping)
    24702468{
    2471     char *tmp;
    24722469    int res = 0;
    2473     char *bkp;
    2474     char *cdrecord;
    2475 
    2476     malloc_string(tmp);
     2470    char *bkp = NULL;
     2471    char *cdrecord = NULL;
     2472
    24772473    malloc_string(bkp);
    2478     malloc_string(cdrecord);
    24792474    strcpy(bkp, cdrw_dev);
    24802475    if (find_cdrw_device(cdrw_dev)) {
     
    24822477    } else {
    24832478        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);
    24852480        } 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);
    24872482        } else {
    2488             cdrecord[0] = '\0';
    24892483            mr_msg(2, "Oh well. I guess I'll just pray then.");
    24902484        }
    2491         if (cdrecord[0]) {
     2485        if (cdrecord != NULL) {
    24922486            if (!keep_looping) {
    24932487                retract_CD_tray_and_defeat_autorun();
     
    25052499            }
    25062500        }
     2501        mr_free(cdrecord);
    25072502    }
    25082503//  retract_CD_tray_and_defeat_autorun();
    2509     mr_free(tmp);
    2510     mr_free(cdrecord);
    25112504    mr_free(bkp);
    25122505    return (res);
     
    25172510 * Asks the user to put a CD-R(W) in the drive.
    25182511 * @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.
    25202512 */
    25212513void
    2522 pause_and_ask_for_cdr(int ask_for_one_if_more_than_this, bool * pmountable)
     2514pause_and_ask_for_cdr(int ask_for_one_if_more_than_this)
    25232515{
    25242516
     
    25372529    char *szunmount = NULL;
    25382530
    2539     malloc_string(tmp);
    25402531    malloc_string(szmsg);
    25412532    malloc_string(cdrom_dev);
     
    25662557      retract_CD_tray_and_defeat_autorun();
    25672558*/
    2568         sprintf(tmp, "umount %s", cdrom_dev);
     2559        mr_asprintf(&tmp, "umount %s", cdrom_dev);
    25692560        run_program_and_log_output(tmp, 1);
     2561        mr_free(tmp);
    25702562        sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
    25712563        sprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt);
     
    25732565        cd_number = -1;
    25742566        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) {
    25782571            mr_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt);
    25792572            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                else
    2587                {
    2588                log_to_screen("Confirmed. There is a blank CD/DVD in the drive.");
    2589                }
    2590              */
    25912573        } else if (!does_file_exist(szcdno)
    25922574                   || !does_file_exist(szserfname)) {
     
    25982580                          media_descriptor_string(g_backup_media_type));
    25992581            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);
    26012583            strcpy(our_serial_str,
    26022584                   call_program_and_get_last_line_of_output(tmp));
     2585            mr_free(tmp);
    26032586            // FIXME - should be able to use last_line_of_file(), surely?
    26042587        }
     
    26342617    }
    26352618
    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 
    26442619    if (!ok_go_ahead_burn_it) {
    26452620        eject_device(cdrom_dev);
    2646         sprintf(tmp,
     2621        mr_asprintf(&tmp,
    26472622                "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
    26482623                media_descriptor_string(g_backup_media_type),
     
    26502625                media_descriptor_string(g_backup_media_type));
    26512626        popup_and_OK(tmp);
     2627        mr_free(tmp);
    26522628        goto gotos_make_me_puke;
    26532629    } else {
     
    26632639    log_to_screen("Proceeding w/ %s in drive.",
    26642640                  media_descriptor_string(g_backup_media_type));
    2665     mr_free(tmp);
    26662641    mr_free(szmsg);
    26672642    mr_free(cdrom_dev);
     
    26722647    mr_free(our_serial_str);
    26732648    mr_free(szunmount);
    2674     if (pmountable) {
    2675         if (attempt_to_mount_returned_this) {
    2676             *pmountable = FALSE;
    2677         } else {
    2678             *pmountable = TRUE;
    2679         }
    2680     }
    2681 
    26822649}
    26832650
     
    33003267        mvaddstr_and_log_it(g_currentY, 0,
    33013268                            "Verifying archives against live filesystem");
    3302         if (bkpinfo->backup_media_type == cdstream) {
    3303             strcpy(bkpinfo->media_device, "/dev/cdrom");
    3304         }
    33053269        verify_tape_backups(bkpinfo);
    33063270        mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     
    33143278    } else {
    33153279        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/cdrom
    3318         }
    33193280        chdir("/");
    33203281        for (cdno = 1; cdno < 99 && bkpinfo->verify_data; cdno++) {
  • branches/stable/mondo/src/common/libmondo-archive.h

    r543 r1594  
    2626int offer_to_write_boot_floppies_to_physical_disks(struct s_bkpinfo
    2727                                                   *bkpinfo);
    28 void pause_and_ask_for_cdr(int, bool *);
     28void pause_and_ask_for_cdr(int);
    2929void set_bit_N_of_array(char *array, int N, bool true_or_false);
    3030int slice_up_file_etc(struct s_bkpinfo *bkpinfo, char *biggie_filename,
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1581 r1594  
    2222#include "mr_str.h"
    2323#include "mr_gettext.h"
     24#include "mr_conf.h"
    2425
    2526#include <sys/ioctl.h>
     
    4748extern char *g_selfmounted_isodir;
    4849extern char *MONDO_LOGFILE;
     50extern struct mr_ar_conf *mr_conf;
    4951
    5052static char g_cdrw_drive_is_here[MAX_STR_LEN / 4] = "";
     
    14431445    char *prompt = NULL;
    14441446    int i = 0;
    1445     int res = 0;
    14461447    FILE *fin = NULL;
    14471448
     
    14661467        sensibly_set_tmpdir_and_scratchdir(bkpinfo);
    14671468    }
    1468     bkpinfo->cdrw_speed = (bkpinfo->backup_media_type == cdstream) ? 2 : 4;
    14691469    bkpinfo->compression_level =
    14701470        (bkpinfo->backup_media_type == cdstream) ? 1 : 5;
     
    14941494            mr_asprintf(&comment, _("What speed is your %s (re)writer?"),
    14951495                    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 */
    15111499                if (!popup_and_get_string(_("Speed"), comment, tmp, 4)) {
    15121500                    log_to_screen(_("User has chosen not to backup the PC"));
     
    15161504            mr_free(comment);
    15171505
    1518             bkpinfo->cdrw_speed = atoi(tmp);    // if DVD then this shouldn't ever be used anyway :)
     1506            bkpinfo->writer_speed = atoi(tmp);
    15191507            mr_free(tmp);
    15201508
    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)) {
    15261513                log_to_screen(_("User has chosen not to backup the PC"));
    15271514                finish(1);
     
    15291516            mr_free(comment);
    15301517
    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)) {
    15601528                    log_to_screen(_("User has chosen not to backup the PC"));
    15611529                    finish(1);
    15621530                }
    15631531                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
    15651579            mr_msg(2, "%s device found at %s",
    15661580                    bkpinfo->backup_media_string,
    15671581                    bkpinfo->media_device);
    15681582        } 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)) {
    15941602                    log_to_screen(_("User has chosen not to backup the PC"));
    15951603                    finish(1);
    15961604                }
    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;
    16021615        break;
     1616
    16031617    case udev:
    16041618        if (!ask_me_yes_or_no
     
    16071621            finish(1);
    16081622        }
     1623
    16091624    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) {
    16221626            if ((fin = fopen(bkpinfo->media_device, "r"))) {
    16231627                paranoid_fclose(fin);
    16241628            } else {
    16251629                if (does_file_exist("/tmp/mondo-restore.cfg")) {
     1630                    /* BERLIOS: NOW that bkpinfo->media_device isn't static anymore it does NOT work */
    16261631                    read_cfg_var("/tmp/mondo-restore.cfg", "media-dev",
    16271632                                 bkpinfo->media_device);
    16281633                }
    16291634            }
    1630             mr_asprintf(&tmp,
     1635            mr_asprintf(&comment,
    16311636                    _("I think I've found your tape streamer at %s; am I right on the money?"),
    16321637                    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);
    16341640                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)) {
    16381644                    log_to_screen("User has chosen not to backup the PC");
    16391645                    finish(1);
    16401646                }
    1641             }
    1642             mr_free(tmp);
     1647                mr_free(bkpinfo->media_device);
     1648                bkpinfo->media_device = tmp;
     1649            }
     1650            mr_free(comment);
    16431651        } else {
     1652            mr_asprintf(&tmp,bkpinfo->media_device);
    16441653            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)) {
    16481657                log_to_screen("User has chosen not to backup the PC");
    16491658                finish(1);
    16501659            }
     1660            mr_free(bkpinfo->media_device);
     1661            bkpinfo->media_device = tmp;
    16511662        }
    16521663        mr_asprintf(&tmp, "ls -l %s", bkpinfo->media_device);
     
    16561667        }
    16571668        mr_free(tmp);
    1658         mr_msg(4, "sz_size = %s", sz_size);
    1659         mr_free(sz_size);
    16601669        bkpinfo->media_size = 0L;
    16611670        mr_msg(4, "media_size = %ld", bkpinfo->media_size);
    1662         if (bkpinfo->media_size <= 0L) {
    1663             bkpinfo->media_size = 0L;
    1664         }
    16651671        if (archiving_to_media) {
    16661672            if ((bkpinfo->compression_level =
     
    17971803        mr_msg(3, "prefix set to %s", bkpinfo->prefix);
    17981804
    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        }
    18001819        mr_msg(3, "Just set nfs_remote_dir to %s",
    18011820                bkpinfo->nfs_remote_dir);
     
    18261845                }
    18271846                bkpinfo->media_size = atol(sz_size);
     1847            /* BERLIOS: this should be useless
     1848            */
    18281849            } else {
    18291850                bkpinfo->media_size = (long)650;
     
    19741995        g_ISO_restore_mode = TRUE;
    19751996    }
    1976 #ifdef __FreeSD__
     1997#ifdef __FreeBSD__
    19771998// skip
    19781999#else
     
    21562177
    21572178    mr_asprintf(&mountdev, bkpinfo->media_device);
    2158     if (!mountdev[0]) {
    2159         log_it
    2160             ("(what_number_cd_is_this) Warning - media_device unknown. Finding out...");
    2161         find_cdrom_device(bkpinfo->media_device, FALSE);
    2162     }
    21632179    if (!is_this_device_mounted(MNT_CDROM)) {
    21642180        mount_CDROM_here(mountdev, MNT_CDROM);
  • branches/stable/mondo/src/common/libmondo-files.c

    r1543 r1594  
    12711271{
    12721272    FILE *fout = NULL;
    1273     char *tmp = NULL;
    12741273    int retval = 0;
    12751274
     
    12791278        paranoid_fclose(fout);
    12801279        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);
    12851281        retval = 0;
    12861282    } else {
  • branches/stable/mondo/src/common/libmondo-fork.c

    r1592 r1594  
    119119    midway_call = mr_malloc(1200);
    120120
     121    mr_msg(5,"isofile: %s - cd_number_str: %d", isofile, cd_number_str);
    121122    mr_asprintf(&cd_number_str, "%d", cd_no);
    122123    resolve_naff_tokens(midway_call, basic_call, isofile, "_ISO_");
     
    152153        }
    153154        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);
    155156            popup_and_OK(_("Press ENTER to continue."));
    156157            popup_and_OK
  • branches/stable/mondo/src/common/libmondo-stream.c

    r1574 r1594  
    329329    log_it("At this point, dev = %s and res = %d", dev, res);
    330330
    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);
    335334
    336335    siz[0] = '\0';
     
    12961295        mr_asprintf(&command,
    12971296                 "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,
    12991298                 MONDO_LOGFILE);
    13001299        log_it("Opening OUT to next CD with the command");
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1592 r1594  
    329329 * - Used: @c bkpinfo->backup_data
    330330 * - Used: @c bkpinfo->backup_media_type
    331  * - Used: @c bkpinfo->cdrw_speed
     331 * - Used: @c bkpinfo->writer_speed
    332332 * - Used: @c bkpinfo->compression_level
    333333 * - Used: @c bkpinfo->include_paths
     
    485485        }
    486486        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) {
    488488                fatal_error("Unable to use manual CD tray with growisofs");
    489489            }
     
    502502            sprintf(bkpinfo->call_make_iso,
    503503                    "%s %s %s dev=%s speed=%d %s/temporary.iso",
    504                     mr_conf->mondo_iso_burning_cmd,
     504                    mr_conf->iso_burning_cmd,
    505505                    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,
    509509                    bkpinfo->tmpdir);
    510510        } 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);
    516525                    }
    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);
    518546                }
    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);
    539549            }
    540550        }
    541         mr_free(mondo_mkisofs_sz);
    542         mr_free(extra_cdrom_params);
    543551    }                           // end of CD code
    544552
     
    684692void reset_bkpinfo(struct s_bkpinfo *bkpinfo)
    685693{
     694    char *tmp = NULL;
     695
    686696    mr_msg(1, "Hi");
    687697
     
    692702    bkpinfo->manual_cd_tray = FALSE;
    693703    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;
    696710    bkpinfo->boot_loader = '\0';
    697711    bkpinfo->boot_device[0] = '\0';
     
    732746    bkpinfo->wipe_media_first = FALSE;
    733747    bkpinfo->differential = FALSE;
    734     bkpinfo->cdrw_speed = 0;
     748    bkpinfo->writer_speed = mr_conf->iso_burning_speed;
    735749// patch by Herman Kuster 
    736750    bkpinfo->differential = 0;
     
    848862    }
    849863#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);
    852866    retval += whine_if_not_found(MKE2FS_OR_NEWFS);
    853867    retval += whine_if_not_found("bzip2");
  • branches/stable/mondo/src/common/mondostructures.h

    r1592 r1594  
    308308   * If backup_media_type is anything else, this should be blank.
    309309   */
    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;
    311314
    312315  /**
     
    566569   * The speed of the CD-R[W] drive.
    567570   */
    568     int cdrw_speed;
     571    int writer_speed;
    569572
    570573  /**
  • branches/stable/mondo/src/common/newt-specific.c

    r1549 r1594  
    698698
    699699    /*@ buffers ********************************************************** */
    700     char *blurb = NULL;
    701     char *original_contents = NULL;
    702700    bool ret = TRUE;
     701    size_t n = 0;
    703702
    704703    assert_string_is_neither_NULL_nor_zerolength(title);
     
    706705    assert(output != NULL);
    707706
     707    n = strlen(output) + 1;
    708708    if (g_text_mode) {
    709709        printf
    710710            ("---promptstring---1--- %s\n---promptstring---2--- %s\n---promptstring---Q---\n-->  ",
    711711             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')) {
    714714            output[strlen(output) - 1] = '\0';
     715        }
    715716        return(ret);
    716717    }
    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);
    721720    type_here =
    722721        newtEntry(2, newtTextboxGetNumLines(text) + 2,
    723                   original_contents, 50,
    724 #ifdef __cplusplus
    725                   0, NEWT_FLAG_RETURNEXIT
    726 #else
     722                  output, 50,
    727723                  (void *) &entry_value, NEWT_FLAG_RETURNEXIT
    728 #endif
    729724        );
    730725    b_1 = newtButton(6, newtTextboxGetNumLines(text) + 4, _("  OK  "));
     
    736731    center_string(blurb, 80);
    737732    */
    738     newtPushHelpLine(blurb);
    739     mr_free(blurb);
     733    newtPushHelpLine(b);
    740734
    741735    b_res = newtRunForm(myForm);
    742     strcpy(output, entry_value);
    743736    newtPopHelpLine();
    744737    if (b_res == b_2) {
    745         strcpy(output, original_contents);
    746738        ret = FALSE;
     739    } else {
     740        mr_allocstr(output, newtEntryGetValue(entry_value));
    747741    }
    748742    newtFormDestroy(myForm);
    749743    newtPopWindow();
    750     mr_free(original_contents);
    751744    return(ret);
    752745}
  • branches/stable/mondo/src/include/mr_conf.h

    r1592 r1594  
    2727    /* ISO Burning CLI command to use */
    2828    char *iso_burning_cmd;
     29    /* ISO Burning device to use (optional) */
     30    char *iso_burning_dev;
    2931    /* ISO Burning CLI command options */
    3032    char *iso_burning_opt;
     
    121123extern void mr_conf_close(void);
    122124
    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 */
     127extern char *mr_conf_iread(const char *field_name);
    125128
    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 */
     131extern char *mr_conf_fread(const char *field_name);
    128132
    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 */
     135extern char *mr_conf_bread(const char *field_name);
    131136
    132137/*
  • branches/stable/mondo/src/include/mr_types.h

    r1264 r1594  
    1919#endif
    2020
     21extern bool mr_atob(const char *str);
     22
    2123#endif                          /* MR_TYPES_H */
  • branches/stable/mondo/src/include/my-stuff.h

    r1592 r1594  
    238238#define MNT_RESTORING "/mnt/RESTORING"
    239239
    240 /** @def VANILLA_SCSI_CDROM The first SCSI CD-ROM in the system (most likely to be the one to write to). */
    241240/** @def VANILLA_SCSI_TAPE  The SCSI tape radical on the system (most likely to be the one towrite to. */
    242241/** @def DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE A string whose presence in a device name indicates the
     
    248247/** @def CP_BIN The GNU @c cp binary to use. */
    249248#ifdef __FreeBSD__
    250 #define VANILLA_SCSI_CDROM  "/dev/cd0"
    251249#define VANILLA_SCSI_TAPE   "/dev/sa"
    252 #define VANILLA_USB_DEVICE  "/dev/tobegivenbyfreebsdguru"
    253250#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/vinum/"
    254251#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
     
    258255#define CP_BIN      "gcp"
    259256#else
    260 #define VANILLA_SCSI_CDROM  "/dev/scd0"
    261257#define VANILLA_SCSI_TAPE   "/dev/st0"
    262 #define VANILLA_USB_DEVICE  "/dev/sda"
    263258#define DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE  "/dev/md"
    264259#define RAID_DEVICE_STUB    DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE
     
    299294#define log_it(format, args...) mr_msg(2, format, ## args)
    300295
    301 #define DEFAULT_DVD_DISK_SIZE 4480  ///< The default size (in MB) of a DVD disk, unless the user says otherwise.
    302 
    303296#define DEFAULT_DEBUG_LEVEL 4   ///< By default, don't log messages with a loglevel higher than this.
     297#define DEFAULT_MR_LOGLEVEL 4
    304298
    305299#define SZ_NTFSPROG_VOLSIZE "1048576"   // was 4096
     
    309303#define MNT_FLOPPY "/mnt/floppy"
    310304
    311 #define DEFAULT_MR_LOGLEVEL 4
    312 
    313305#endif                          /* _MY_STUFF_H_ */
  • branches/stable/mondo/src/lib/mr_conf.c

    r1584 r1594  
    192192
    193193/*read integer number after string str in the current file*/
    194 int mr_conf_iread(const char *field_name) {
     194char *mr_conf_iread(const char *field_name) {
    195195    char *p = NULL;             /*pointer to the field */
    196     int ret = 0;                /*return value */
     196    char *p1 = NULL;            /*return field */
    197197
    198198    p = mr_conf_read(field_name);
    199199    if (p != NULL) {
    200         ret = atoi(p);
    201         }
    202     return ret;
     200        mr_asprintf(&p1, "%d", p);
     201        }
     202    return p1;
    203203}
    204204
    205205/*read float/double number after string str in the current file*/
    206 double mr_conf_fread(const char *field_name) {
     206char *mr_conf_fread(const char *field_name) {
    207207    char *p = NULL;             /*pointer to the field */
    208     double ret = 0.0;               /*return value */
     208    char *p1 = NULL;            /*return field */
    209209
    210210    p = mr_conf_read(field_name);
    211211    if (p != NULL) {
    212         ret = atof(p);
    213     }
    214     return ret;
     212        mr_asprintf(&p1, "%f", p);
     213    }
     214    return p1;
    215215}
    216216
     
    265265
    266266/*read boolean after string str in the current file*/
    267 bool mr_conf_bread(const char *field_name) {
     267char *mr_conf_bread(const char *field_name) {
    268268    char *p = NULL;             /*pointer to the field */
    269     bool ret = FALSE;
     269    char *p1 = NULL;                /*pointer to the field */
    270270   
    271     p = mr_conf_sread(field_name);
     271    p = mr_conf_read(field_name);
    272272    if (p != NULL) {
    273273        /* match if yes/true/1 */
     
    275275            (strncasecmp(p, "t" , (size_t)1) == 0) ||
    276276            (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 */
     286bool 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);
    281296}
    282297
  • branches/stable/mondo/src/lib/mr_str.c

    r1551 r1594  
    1313 
    1414/**
    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()
    1716 * @param instr
    1817 * @param delims
  • branches/stable/mondo/src/mondoarchive/mondo-cli.c

    r1582 r1594  
    9393        flag_set[i] = FALSE;
    9494    }
    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,
    9896                                            flag_set);
    9997    retval += res;
     
    152150    assert(value != NULL);
    153151
    154     bkpinfo->media_size = 0L;   /* dummy value */
    155152    mr_asprintf(&tmp, value);
    156153    q = strchr(tmp, ',');
     
    211208
    212209    /* compulsory */
    213     i = flag_set['c'] + flag_set['i'] + flag_set['n'] +
     210    i = flag_set['i'] + flag_set['n'] +
    214211        flag_set['t'] + flag_set['u'] + flag_set['r'] +
    215212        flag_set['w'] + flag_set['C'] + flag_set['U'];
     
    316313
    317314    if (g_kernel_version >= 2.6 && !flag_set['d']
    318         && (flag_set['c'] || flag_set['w'])) {
     315        && flag_set['w']) {
    319316        fatal_error
    320317            ("If you are using the 2.6.x kernel, please specify the CD-R(W) device.");
     
    331328    }
    332329
    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']) {
    334331        if (!flag_set['r'] && g_kernel_version <= 2.5
    335332            && strstr(flag_val['d'], "/dev/")) {
     
    352349                ("Please install dvdrecord/cdrecord and try again.");
    353350        }
    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']) {
    368352            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");
    381359        }
    382360    }
     
    431409            fatal_error
    432410                ("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 MB
    436             strcat(flag_val['s'], "m");
    437             log_to_screen
    438                 (_("You did not specify a size (-s) for DVD. I'm guessing %s."),
    439                  flag_val['s']);
    440             flag_set['s'] = 1;
    441411        }
    442412    }
     
    457427                }
    458428            } else if (flag_set['u'] || flag_set['t']) {
     429                /* Force autidetection */
    459430                bkpinfo->media_size = 0L;
    460431            } else {
     
    492463    }
    493464
    494     if (flag_set['c']) {
    495         bkpinfo->backup_media_type = cdr;
    496     }
    497465    if (flag_set['C']) {
    498466        bkpinfo->backup_media_type = cdstream;
     
    659627            strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN);
    660628        } 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;
    662632        }
    663633    }
     
    678648
    679649    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;
    692655        } 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"));
    695657        }
    696658    }
  • branches/stable/mondo/src/mondoarchive/mondoarchive.c

    r1592 r1594  
    9696    mr_msg(7, "Seven...");
    9797    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);
    9999}
    100100
     
    133133}
    134134
     135/* reset/empty the mr_ar_conf structure from mondo's conf file */
     136static 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
    135172/* fill the mr_ar_conf structure from mindi's conf file */
    136173static void mr_ar_store_conf_mindi(struct mr_ar_conf *mr_cnf) {
     
    153190    char *p = NULL;
    154191
    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    }
    232343    mr_msg(5, "Directory for images is %s", mr_cnf->images_dir);
    233344}
     
    242353    mr_free(mr_cnf->iso_creation_opt);
    243354    mr_free(mr_cnf->iso_burning_cmd);
     355    mr_free(mr_cnf->iso_burning_dev);
    244356    mr_free(mr_cnf->iso_burning_opt);
    245357    mr_free(mr_cnf->media_device);
     
    301413    (void) textdomain("mondo");
    302414#endif
    303     printf(_("Initializing..."));
     415    printf(_("Initializing...\n"));
    304416
    305417    /* Reference a dummy cleanup function for mr_exit temporarily */
     
    327439
    328440    /* Conf file management */
     441    mr_conf = mr_malloc(sizeof(struct mr_ar_conf));
     442    mr_ar_reset_conf(mr_conf);
    329443    /* Check md5 sum before */
    330444    /* Get content */
     
    332446            mr_log_exit(-1, "Unable to open "MONDO_CONF_DIR"/mondo.conf.dist");
    333447    }
    334     mr_conf = malloc(sizeof(struct mr_ar_conf));
    335448    mr_ar_store_conf(mr_conf);
    336449    /* Reference the right cleanup function for mr_exit now it's allocated */
    337450    mr_cleanup = &mr_ar_cleanup;
    338 
    339451    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    }
    340457
    341458    /* Check md5 sum before */
  • branches/stable/mondo/src/mondorestore/mondo-rstr-compare.c

    r1591 r1594  
    298298    if (res) {
    299299        log_OS_error(command);
    300         log_msg(2, tmp);
     300        mr_msg(2, tmp);
    301301    }
    302302    mr_free(command);
     
    594594
    595595    kill_petris();
    596     paranoid_free(new);
    597     paranoid_free(cwd);
     596    mr_free(new);
     597    mr_free(cwd);
    598598    return (retval);
    599599}
     
    635635    if (bkpinfo->disaster_recovery
    636636        && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    637         strcpy(bkpinfo->media_device,
     637        mr_allocstr(bkpinfo->media_device,
    638638               last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    639     } else {
    640         find_cdrom_device(bkpinfo->media_device, FALSE);
    641639    }
    642640    res = verify_tape_backups(bkpinfo);
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1581 r1594  
    674674        if (bkpinfo->disaster_recovery
    675675            && does_file_exist("/tmp/CDROM-LIVES-HERE")) {
    676             strcpy(bkpinfo->media_device,
     676            mr_allocstr(bkpinfo->media_device,
    677677                   last_line_of_file("/tmp/CDROM-LIVES-HERE"));
    678         } else {
    679             find_cdrom_device(bkpinfo->media_device, TRUE);
    680678        }
    681679
     
    725723                               FALSE);
    726724    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 );
    729726    }
    730727    run_program_and_log_output("mkdir -p " MNT_RESTORING
    731728                               "/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);
    734730    run_program_and_log_output("cd " MNT_RESTORING
    735731                               "; 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",
     
    838834    if (bkpinfo->disaster_recovery) {
    839835        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");
    842837            bkpinfo->media_size = (long)650;    /* good guess */
    843838        } else if (bkpinfo->backup_media_type == tape
     
    846841                fatal_error("Cannot get tape device name from cfg file");
    847842            }
    848             strcpy(bkpinfo->media_device, value);
     843            mr_allocstr(bkpinfo->media_device, value);
    849844            read_cfg_var(cfg_file, "media-size", value);
    850845            bkpinfo->media_size = atol(value);
     
    852847                    bkpinfo->media_device);
    853848        } 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 */
    856850            bkpinfo->media_size = (long)1999*1024;  /* 650, probably, but we don't need this var anyway */
    857851            mr_msg(2, "Backup medium is CD-R[W]");
     
    10191013                            "Unable to mount isodir. Perhaps this is really a CD backup?");
    10201014                    bkpinfo->backup_media_type = cdr;
    1021                     strcpy(bkpinfo->media_device, "/dev/cdrom");    /* superfluous */
     1015                    mr_allocstr(bkpinfo->media_device, "/dev/cdrom");   /* superfluous */
    10221016                    bkpinfo->isodir[0] = '\0';
    10231017                    mr_free(iso_mnt);
     
    21502144
    21512145            if (strlen(bkpinfo->media_device) == 0) {
    2152                 strcpy(bkpinfo->media_device, "/dev/st0");
     2146                mr_allocstr(bkpinfo->media_device, "/dev/st0");
    21532147                mr_msg(2, "media_device is blank; assuming %s",
    21542148                        bkpinfo->media_device);
     
    21572151            if (extract_cfg_file_and_mountlist_from_tape_dev
    21582152                (bkpinfo->media_device)) {
    2159                 strcpy(bkpinfo->media_device, "/dev/st0");
     2153                mr_allocstr(bkpinfo->media_device, "/dev/st0");
    21602154                if (extract_cfg_file_and_mountlist_from_tape_dev
    21612155                    (bkpinfo->media_device)) {
    2162                     strcpy(bkpinfo->media_device, "/dev/osst0");
     2156                    mr_allocstr(bkpinfo->media_device, "/dev/osst0");
    21632157                    if (extract_cfg_file_and_mountlist_from_tape_dev
    21642158                        (bkpinfo->media_device)) {
    2165                         strcpy(bkpinfo->media_device, "/dev/ht0");
     2159                        mr_allocstr(bkpinfo->media_device, "/dev/ht0");
    21662160                        if (extract_cfg_file_and_mountlist_from_tape_dev
    21672161                            (bkpinfo->media_device)) {
    21682162                            mr_msg(3,
    21692163                                    "I tried lots of devices but none worked.");
    2170                             strcpy(bkpinfo->media_device, tmp);
     2164                            mr_allocstr(bkpinfo->media_device, tmp);
    21712165                        }
    21722166                    }
  • branches/stable/mondo/src/mondorestore/mondorestore.c

    r1581 r1594  
    912912    }
    913913    interactively_obtain_media_parameters_from_user(bkpinfo, FALSE);
    914     if (!bkpinfo->media_device[0]) {
     914    if (!bkpinfo->media_device) {
    915915        mr_msg(2, "Warning - failed to find media dev");
    916916    } else {
     
    954954    }
    955955    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)) {
    957957        eject_device(bkpinfo->media_device);
    958958    }
     
    30373037    if (argc == 3 && strcmp(argv[1], "--paa") == 0) {
    30383038        g_current_media_number = atoi(argv[2]);
    3039         pause_and_ask_for_cdr(5, NULL);
     3039        pause_and_ask_for_cdr(5);
    30403040        paranoid_MR_finish(0);
    30413041    } else if (!bkpinfo->disaster_recovery) {   // live!
Note: See TracChangeset for help on using the changeset viewer.