Changeset 3881 in MondoRescue


Ignore:
Timestamp:
Mar 9, 2024, 3:31:21 PM (3 months ago)
Author:
Bruno Cornec
Message:

-c means now optical backup for CD/DVD. Removed dvd special mode -r

Location:
branches/3.3/mondo/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mondo/src/common/libmondo-archive.c

    r3879 r3881  
    917917    }
    918918
    919     if (bkpinfo->backup_media_type == cdr) {
     919    if (bkpinfo->backup_media_type == optical) {
    920920        if (is_this_device_mounted(bkpinfo->media_device)) {
    921921            log_msg(2, "Warning - %s mounted. I'm unmounting it before I burn to it.", bkpinfo->media_device);
     
    10891089        }
    10901090        if (g_current_media_number == 1 && !res
    1091             && (bkpinfo->backup_media_type == cdr)) {
    1092             if ((tmp = find_optical_device())   == NULL) {  // make sure find_optical_device() finds, records CD-R's loc
    1093                 log_msg(3, "*Sigh* Mike, I hate your computer.");
     1091            && (bkpinfo->backup_media_type == optical)) {
     1092            if ((tmp = find_optical_device()) == NULL) {    // make sure find_optical_device() finds, records CD-R's loc
     1093                log_msg(3, "*Sigh* no optical drive found, I hate your computer ;-)");
    10941094                // if it can't be found then force pausing
    10951095                bkpinfo->manual_cd_tray = TRUE;
    10961096            } else {
    1097                 log_msg(3, "Great. Found Mike's CD-ROM drive.");
     1097                log_msg(3, "Great. Found an optical drive.");
    10981098            }
    10991099            mr_free(tmp);
     
    28482848
    28492849    switch (bkpinfo->backup_media_type) {
    2850     case cdr:
    2851         mr_asprintf(value, "cdr");
     2850    case optical:
     2851        mr_asprintf(value, "optical");
    28522852        break;
    28532853    case cdstream:
     
    28652865    case netfs:
    28662866        mr_asprintf(value, "netfs");
    2867         break;
    2868     case dvd:
    2869         mr_asprintf(value, "dvd");
    28702867        break;
    28712868    case usb:
     
    31803177        if (bkpinfo->backup_media_type != iso) {
    31813178            mr_free(bkpinfo->media_device);
    3182             bkpinfo->media_device = find_optical_device();  // replace 0,0,0 with /dev/cdrom
     3179            bkpinfo->media_device = find_optical_device();
    31833180        }
    31843181        if (chdir("/")) {
  • branches/3.3/mondo/src/common/libmondo-cli.c

    r3880 r3881  
    204204    /* compulsory */
    205205    i = flag_set['c'] + flag_set['i'] + flag_set['n'] +
    206         flag_set['t'] + flag_set['u'] + flag_set['r'] +
    207         flag_set['C'] + flag_set['U'];
     206        flag_set['t'] + flag_set['u'] + flag_set['U'];
    208207    if ((i == 0) && (! bkpinfo->restore_data)) {
    209208        retval++;
     
    325324    }
    326325
    327     if ((flag_set['c'] || flag_set['C'] || flag_set['r']) && (! bkpinfo->restore_data)) {
     326    if (flag_set['c'] && (! bkpinfo->restore_data)) {
    328327        if (system("which cdrecord > /dev/null 2> /dev/null") && system("which dvdrecord > /dev/null 2> /dev/null")) {
    329328            fatal_error("Please install dvdrecord/cdrecord and try again.");
    330         }
    331         if (flag_set['C']) {
    332             bkpinfo->cdrw_speed = atoi(flag_val['C']);
    333             if (bkpinfo->cdrw_speed < 1) {
    334                 fatal_error("You specified a silly speed for a CD-R[W] drive");
    335             }
    336             if (!flag_set['L']) {
    337                 log_to_screen("You must use -L with -C. Therefore I am setting it for you.");
    338                 flag_set['L'] = 1;
    339                 flag_val['L'][0] = '\0';
    340             }
    341329        } else {
    342330            log_msg(3, "flag_val['c'] = %s", flag_val['c']);
    343331            if (flag_set['c']) {
    344332                bkpinfo->cdrw_speed = atoi(flag_val['c']);
    345             } else if (flag_set['r']) {
    346                 bkpinfo->cdrw_speed = 1;    /*atoi(flag_val['r']); */
    347             }
    348 
    349             if (bkpinfo->cdrw_speed < 1) {
    350                 fatal_error("You specified a silly speed for a CD-R[W] drive");
     333            }
     334        }
     335        if (!flag_set['d']) {
     336            if ((bkpinfo->media_device = find_optical_device()) != NULL) {
     337                flag_set['d'] = TRUE;
     338                log_to_screen("I guess optical drive is at %s", bkpinfo->media_device);
     339            }   
     340        }
     341
     342        if (! bkpinfo->restore_data) {
     343            if (!flag_set['s']) {
     344                sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
     345                strcat(flag_val['s'], "m");
     346                log_to_screen("You did not specify a size (-s) for your media. I'm guessing %s.", flag_val['s']);
     347                flag_set['s'] = 1;
    351348            }
    352349        }
     
    369366        if ((!flag_set['s']) && (! bkpinfo->restore_data)) {
    370367            fatal_error("You did not specify a size (-s) for your USB device. Aborting");
    371         }
    372     }
    373 
    374     if (flag_set['r'])          // DVD
    375     {
    376         if (flag_set['m']) {
    377             fatal_error("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m.");
    378         }
    379         if (!flag_set['d']) {
    380             if ((bkpinfo->media_device = find_optical_device()) != NULL) {
    381                 flag_set['d'] = TRUE;
    382                 log_to_screen("I guess DVD drive is at %s", bkpinfo->media_device);
    383             }
    384         }
    385         if (strchr(bkpinfo->media_device, ',')) {
    386             fatal_error("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    387         }
    388         if (! bkpinfo->restore_data) {
    389             if (!flag_set['s']) {
    390                 sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
    391                 strcat(flag_val['s'], "m");
    392                 log_to_screen("You did not specify a size (-s) for DVD. I'm guessing %s.", flag_val['s']);
    393                 flag_set['s'] = 1;
    394             }
    395368        }
    396369    }
     
    542515
    543516    if (flag_set['c']) {
    544         bkpinfo->backup_media_type = cdr;
     517        bkpinfo->backup_media_type = optical;
    545518    }
    546519    if (flag_set['C']) {
     
    554527        /* Never try to eject a Network device */
    555528        bkpinfo->please_dont_eject = TRUE;
    556     }
    557     if (flag_set['r']) {
    558         bkpinfo->backup_media_type = dvd;
    559529    }
    560530    if (flag_set['t']) {
  • branches/3.3/mondo/src/common/libmondo-devices.c

    r3879 r3881  
    698698/**
    699699 * Turn @c bkpinfo->backup_media_type into a human-readable string.
    700  * @return The human readable string (e.g. @c cdr becomes <tt>"cdr"</tt>).
     700 * @return The human readable string (e.g. @c optical becomes <tt>"optical"</tt>).
    701701 * @note The returned string points to static storage that will be overwritten with each call.
    702702 * @ingroup stringGroup
     
    712712        mr_asprintf(output, "%s", "iso");
    713713        break;
    714     case cdr:
    715         mr_asprintf(output, "%s", "cdr");
     714    case optical:
     715        mr_asprintf(output, "%s", "optical");
    716716        break;
    717717    case cdstream:
     
    12291229    } else if (media_type == tape) {
    12301230        return(find_tape_device());
    1231     } else if ((media_type == dvd) || (media_type == cdr)) {
     1231    } else if (media_type == optical) {
    12321232        return(find_optical_device());
    12331233    } else {
     
    20172017    // Tape, CD, NETFS, ...?
    20182018    srandom(getpid());
    2019     bkpinfo->backup_media_type = (g_restoring_live_from_cd) ? cdr : which_backup_media_type(bkpinfo->restore_data);
     2019    bkpinfo->backup_media_type = (g_restoring_live_from_cd) ? optical : which_backup_media_type(bkpinfo->restore_data);
    20202020    if (bkpinfo->backup_media_type == none) {
    20212021        log_to_screen("User has chosen not to backup the machine");
     
    20702070    // Find device's /dev (or SCSI) entry
    20712071    switch (bkpinfo->backup_media_type) {
    2072     case cdr:
    2073     case dvd:
     2072    case optical:
    20742073    case usb:
    20752074        /* Never try to eject a USB device */
     
    20812080            if (ask_me_yes_or_no("Is your computer a laptop type (manual insert of MondoRescue media)?")) {
    20822081                bkpinfo->manual_cd_tray = TRUE;
     2082            }
     2083            if (ask_me_yes_or_no("Do you want to blank your media before burning them (RW type of media)?")) {
     2084                bkpinfo->wipe_media_first = TRUE;
    20832085            }
    20842086        }
  • branches/3.3/mondo/src/common/libmondo-string.c

    r3878 r3881  
    976976
    977977    switch (type_of_bkp) {
    978     case dvd:
    979         mr_asprintf(type_of_backup, "DVD");
    980         break;
    981     case cdr:
    982         mr_asprintf(type_of_backup, "CDR");
     978    case optical:
     979        mr_asprintf(type_of_backup, "optical");
    983980        break;
    984981    case tape:
  • branches/3.3/mondo/src/common/libmondo-tools.c

    r3880 r3881  
    484484
    485485// CD-R or CD-RW
    486     if (bkpinfo->backup_media_type == cdr) {
     486    if (bkpinfo->backup_media_type == optical) {
    487487        if (!bkpinfo->manual_cd_tray) {
    488488            mr_asprintf(extra_cdrom_params, "-waiti ");
  • branches/3.3/mondo/src/common/mondostructures.h

    r3880 r3881  
    172172typedef enum { none = 0,        ///< No type has been set yet.
    173173    iso,                        ///< Back up to ISO images.
    174     cdr,                        ///< Back up to recordable CDs (do not erase them).
    175     dvd,                        ///< Back up to DVD+R[W] or DVD-R[W] disks.
    176     // To be removed
    177     cdstream,                   ///< Back up to recordable CDs but treat them like a tape streamer.
     174    optical,                        ///< Back up to optical media
    178175    netfs,                      ///< Back up to an NETFS mount on the local subnet.
    179176    tape,                       ///< Back up to tapes.
     
    339336  /**
    340337   * The device we're backing up to.
    341    * If backup_media_type is @b cdr, or @b cdstream, this should be the SCSI node (e.g. 0,1,0).
    342    * If backup_media_type is @b dvd, @b tape, @b usb or @b udev, this should be a /dev entry.
     338   * If backup_media_type is @b optical, @b tape, @b usb or @b udev, this should be a /dev entry.
    343339   * If backup_media_type is anything else, this should be blank.
    344340   */
  • branches/3.3/mondo/src/common/newt-specific.c

    r3874 r3881  
    12251225/**
    12261226 * Ask the user which backup media type they would like to use.
    1227  * The choices are @p none (exit to shell), @c cdr, @c dvd,
     1227 * The choices are @p none (exit to shell), @c optical,
    12281228 * @c tape, @c cdstream, @c udev (only when @p g_text_mode is TRUE), @c netfs,
    12291229 * and @c iso.
     
    12401240        char *title_sz = NULL;
    12411241        char *minimsg_sz = NULL;
    1242         static t_bkptype possible_bkptypes[] = { none, cdr, dvd, tape, cdstream, udev, netfs, iso };
    1243         static char *possible_responses[] = { "none", "cdr", "dvd", "tape", "cdstream", "udev", "netfs", "iso", NULL };
     1242        static t_bkptype possible_bkptypes[] = { none, optical, tape, cdstream, udev, netfs, iso };
     1243        static char *possible_responses[] = { "none", "optical", "tape", "cdstream", "udev", "netfs", "iso", NULL };
    12441244        char *outstr = NULL;
    12451245        char *instr = NULL;
     
    12481248
    12491249        newtComponent b1;
    1250         newtComponent b2;
    12511250        newtComponent b3;
    12521251        newtComponent b4;
    1253         newtComponent b5;
    12541252        newtComponent b6;
    12551253        newtComponent b7;
     
    12881286        newtPushHelpLine(title_sz);
    12891287        newtCenteredWindow(34, 17, minimsg_sz);
    1290         b1 = newtButton(1, 1, "CD-R disks ");
     1288        b1 = newtButton(1, 1, "Optical disks ");
    12911289        b3 = newtButton(1, 9, "Tape drive ");
    12921290        b4 = newtButton(17, 5, "USB Key/Disk");
    1293         b5 = newtButton(1, 5, " DVD disks ");
    12941291        b6 = newtButton(17, 9, " Net mount ");
    12951292        b7 = newtButton(1, 13, " Hard disk ");
    12961293        b8 = newtButton(17, 13, "    Exit   ");
    12971294        myForm = newtForm(NULL, NULL, 0);
    1298         newtFormAddComponents(myForm, b1, b5, b3, b7, b4, b6, b8, NULL);
     1295        newtFormAddComponents(myForm, b1, b3, b7, b4, b6, b8, NULL);
    12991296        b_res = newtRunForm(myForm);
    13001297        newtFormDestroy(myForm);
    13011298        newtPopWindow();
    13021299        if (b_res == b1) {
    1303             output = cdr;
     1300            output = optical;
    13041301        } else if (b_res == b3) {
    13051302            output = tape;
    13061303        } else if (b_res == b4) {
    13071304            output = usb;
    1308         } else if (b_res == b5) {
    1309             output = dvd;
    13101305        } else if (b_res == b6) {
    13111306            output = netfs;
  • branches/3.3/mondo/src/mondorestore/mondo-rstr-tools.c

    r3879 r3881  
    942942    if (!strcmp(value, "cdstream")) {
    943943        bkpinfo->backup_media_type = cdstream;
    944     } else if (!strcmp(value, "cdr")) {
    945         bkpinfo->backup_media_type = cdr;
    946     } else if (!strcmp(value, "dvd")) {
    947         bkpinfo->backup_media_type = dvd;
     944    } else if (!strcmp(value, "optical")) {
     945        bkpinfo->backup_media_type = optical;
    948946    } else if (!strcmp(value, "usb")) {
    949947        bkpinfo->backup_media_type = usb;
     
    958956            }
    959957            if (does_file_exist(ARCHIVES_PATH "/filelist.0")) {
    960                 bkpinfo->backup_media_type = cdr;
     958                bkpinfo->backup_media_type = optical;
    961959                run_program_and_log_output("umount -d "MNT_CDROM, 1);
    962                 log_it("Re-jigging configuration AGAIN. CD-R, not ISO.");
     960                log_it("Re-jigging configuration AGAIN. Optical, not ISO.");
    963961            }
    964962        }
     
    12521250            mr_asprintf(tmp1, "mount %s %s", g_isodir_device, iso_mnt);
    12531251            if (run_program_and_log_output(tmp1, 3)) {
    1254                 log_msg(1, "Unable to mount isodir. Perhaps this is really a CD backup?");
    1255                 bkpinfo->backup_media_type = cdr;
     1252                log_msg(1, "Unable to mount isodir. Perhaps this is really an optical based backup?");
     1253                bkpinfo->backup_media_type = optical;
    12561254                mr_asprintf(bkpinfo->media_device, "%s", "/dev/cdrom"); /* superfluous */
    12571255                mr_free(bkpinfo->isodir);
Note: See TracChangeset for help on using the changeset viewer.