Changeset 1967 in MondoRescue


Ignore:
Timestamp:
May 29, 2008, 5:40:05 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Remove all references to /root/images
  • Fix the lack of support for options in mondorestore by copying what is done for mondoarchive and sharing the functions analyzing the cli (getopt usage)
  • Review the now common handle_incoming_parameters to have it support correctly 2 modes (archiving and restoring)
  • Update mondorestore man page to take in account the options supported now
  • Replace mondorestore options --nuke, --interactive, with -Z nuke, -Z interactive ...
Location:
branches/2.2.6
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mindi/mindi

    r1957 r1967  
    16721672            else
    16731673                options="interactive expert compare iso nuke isonuke"
    1674 # hda hdb hdc hdd"
    16751674            fi
    16761675        else
  • branches/2.2.6/mindi/rootfs/sbin/post-init

    r1962 r1967  
    115115if [ "$compare" ] ; then
    116116    LogIt "------------------COMPARE MODE-----------------" 1
    117     mondorestore $mondoopt --compare
     117    mondorestore $mondoopt -Z compare
    118118elif [ "$nuke" ] ; then
    119119    LogIt "-------------------NUKE MODE-------------------" 1
    120     mondorestore $mondoopt --nuke
     120    mondorestore $mondoopt -Z nuke
    121121elif [ "$expert" ] ; then
    122122    if [ "`grep tapedev /tmp/mondo-restore.cfg`" ] ; then
     
    128128        LogIt "Tape Mode -- calling mondorestore..."
    129129            if [ "$nuke" ] ; then
    130                 mondorestore $mondoopt --nuke
     130                mondorestore $mondoopt -Z nuke
    131131            else
    132132                mondorestore $mondoopt; # MR will detect & access the tape
     
    141141            LogIt "Cdstream Mode -- calling mondorestore..."
    142142            if [ "$nuke" ] ; then
    143                 mondorestore --nuke $mondoopt
     143                mondorestore -Z nuke $mondoopt
    144144            else
    145145                mondorestore $mondoopt; # MR will detect & access the cdstream
     
    156156else
    157157    LogIt "------------------INTERACTIVE------------------" 1
    158     mondorestore --interactive $mondoopt
     158    mondorestore -Z interactive $mondoopt
    159159fi
    160160
    161 [ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore --mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
     161[ -e "/tmp/DO-MBR-PLEASE" ] && LogIt "PLEASE RUN 'mondorestore -Z mbr' NOW TO INITIALIZE YOUR BOOT SECTOR." 1
    162162
    163163exit 0
  • branches/2.2.6/mondo-doc/mondoarchive.8

    r1948 r1967  
    186186this is the directory where the ISO images are stored. For NFS users, this is
    187187the directory within the NFS mount where the backups are stored. The default
    188 for ISO and NFS is '/root/images/mondo'.
     188for ISO and NFS is '/var/cache/mondo'.
    189189
    190190.TP
     
    305305.TP
    306306.BI "-e "
    307 Don't eject the CD or tape when backing up or restoring... unless cdrecord
    308 insists on it. If it does, well, tough. Sorry. :)
     307Don't eject the CD or tape when backing up...
    309308
    310309.TP
  • branches/2.2.6/mondo-doc/mondorescue-howto.sgml

    r1887 r1967  
    469469<row>
    470470<entry>
    471         bash# cd /root/images/mindi
     471        bash# cd /var/cache/mindi
    472472
    473473</entry>
     
    575575<row>
    576576<entry>
    577 bash# cdrecord dev=0,0,0 speed=4 -eject -v /root/images/mindi/mindi.iso
     577        bash# cdrecord dev=0,0,0 speed=4 -eject -v /var/cache/mindi/mindi.iso
    578578</entry>
    579579</row>
     
    12551255Making 2880KB boot disk...........................mkfs.vfat 2.10 (22 Sep 2003)
    12561256... 2880 KB boot disks were created OK                          Done.
    1257 In the directory '/root/images/mindi' you will find the images:-
     1257In the directory '/var/cache/mindi' you will find the images:-
    12581258   mindi-data-1.img    mindi-data-2.img    mindi-data-3.img    mindi-data-4.img    mindi-data-5.img mindi-root.1440.img
    12591259Shall I make a bootable CD image? (y/n) y
     
    12811281<row>
    12821282<entry>
    1283         bash# cd /root/images/mindi
     1283        bash# cd /var/cache/mindi
    12841284</entry>
    12851285</row>
  • branches/2.2.6/mondo-doc/mondorestore.8

    r1872 r1967  
    4545.B prefix
    4646to specify the name of your ISO images.
    47 By default, mondoarchive names images mondorescue-1.iso, mondorescue-2.iso, ...
     47By default, mondorestore names images mondorescue-1.iso, mondorescue-2.iso, ...
    4848Using
    4949.B -p machine
     
    5252
    5353.TP
     54.BI "-i "
     55Use ISO files (CD images) as restore media. This is good when having backed up your
     56system to a spare hard drive. The
     57.B -n
     58switch is a wiser choice if you plan to restore from a remote filesystem.
     59
     60.TP
     61.BI "-n " mount
     62Use files residing on NFS partition as restore media.
     63.I mount
     64is the remote mount-point, e.g. '192.168.1.3:/home/nfs'
     65for my file server. Please mount it before restoring/verifying.
     66
     67.TP
     68.BI "-t "
     69Use tape streamer as restore device and its tapes as restore media.
     70
     71.TP
     72.BI "-U "
     73Use a generic USB device as restore device. Use this if you want to read
     74your backup from a USB key or USB disk.
     75The USB device should be attached to the system ir order for this to work and
     76its device name passed to the
     77.BR \-d
     78option.
     79
     80.TP
     81.BI "-u "
     82Use a generic streaming device as restore device. Use this if you want to read
     83your backup from a device that is not directly support by mondoarchive. This will
     84get the data directly from a raw device.
     85.B For experienced users only.
     86
     87.TP
     88.BI "-E " "\*(lqpath ...\*(rq"
     89Exclude path(s) from restore (future dev). The paths should be separated with a whitespace.
     90/mnt/cdrom, /proc, /sys, /tmp). For example, if you are restoring up from an NFS mount but you
     91do not want to restore some content, exclude it with that switch.
     92
     93.TP
     94.BI "-I " "\*(lqpath ...\*(rq"
     95Include paths(s) to retore (future dev).
     96
     97.TP
     98.BI "-J " "file"
     99Specify an explicit list of files and directories to restore in a plain text file, one item
     100(file or directory) per line. Beware that directories placed in that file are not managed recursively contrary to what is done with the -I option.
     101
     102.TP
     103.BI "-d " "dev|dir"
     104Specify the restore device (CD/tape/USB) or directory (NFS/ISO). For CD-R[W] drives,
     105this is the SCSI node where the drive may be found, e.g. '0,1,0'. For tape
     106users, this is the tape streamers /dev entry, e.g. '/dev/st0'. For USB users,
     107this is the device name of your key or external disk. For ISO users,
     108this is the directory where the ISO images are stored. For NFS users, this is
     109the directory within the NFS mount where the backups are stored. The default
     110for ISO and NFS is '/var/cache/mondo'.
     111
     112.TP
     113.BI "-g "
     114GUI mode. Without this switch, the screen output of mondorestore is text based.
     115
     116.TP
     117.BI "-m "
     118Manual (not self-retracting) CD trays are often found on laptops. If you are
     119a laptop user, your CD burner has BurnProof technology or you experience
     120problems with mondo then please call mondorestore with this switch.
     121
     122.TP
     123.BI "-o "
     124Use OBDR (One Button Disaster Recovery) type of tapes.
     125By default, tapes are not bootable. With this flag, tape will be read as bootable tapes
     126following the OBDR format.
     127
     128.TP
     129.BI "-x " "'dev ...'"
     130Specify non-Linux partitions which you want to restore (future dev).
     131
     132.TP
     133.BI "-T " "path"
     134Specify the full pathname of the tempdir, the directory where temporary files
     135are stored.
     136
     137.TP
     138.BI "-b "
     139Specify the internal block size used by the tape drive. This is usually 32K but
     140some drives just don't like that. They should but they don't. That's what
     141happens when tape drive vendors don't talk to kernel driver writers. Try 512 or
     14216384.
     143
     144.TP
     145.BI "-e "
     146Don't eject the CD or tape when restoring...
     147
     148.TP
     149.BI "-f " "device"
     150Specify the drive on which your Master Boot Record lives. Usually, this is
     151discovered automatically. (future dev)
     152
     153.TP
     154.BI "-Q "
     155Give more detailed information about the boot loader.
     156
     157.TP
    54158.BI "-K " "loglevel"
    55159Specify the loglevel. Use 99 for full debug. Standard debug level is 4.
     160
     161.TP
     162.BI "-z "
     163Use extended attributes and acl for each file and store them in the backup media. Use this option if you use SElinux e.g. but it will slow down backup and restore time of course.
    56164
    57165.SH DIAGNOSTICS
  • branches/2.2.6/mondo/src/common/libmondo-archive.c

    r1956 r1967  
    6060extern FILE *g_tape_stream;
    6161extern long long g_tape_posK;
     62extern bool g_cd_recovery;
    6263extern char *g_mondo_home;
    6364extern char *g_tmpfs_mountpt;
    64 extern bool g_cd_recovery;
    6565extern char *g_serial_string;
    66 
    6766extern char *g_getfacl;
    6867extern char *g_getfattr;
     
    101100static int g_sem_id;
    102101static int g_sem_key;
    103 
    104 
    105 
    106102
    107103/**
  • branches/2.2.6/mondo/src/common/libmondo-cli.c

    r1966 r1967  
    199199/* Reference to global bkpinfo */
    200200extern struct s_bkpinfo *bkpinfo;
     201
     202extern void free_MR_global_filenames(void);
    201203
    202204/**
     
    349351    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    350352
    351 /* compulsory */
     353    /* compulsory */
    352354    i = flag_set['c'] + flag_set['i'] + flag_set['n'] +
    353355        flag_set['t'] + flag_set['u'] + flag_set['r'] +
    354356        flag_set['w'] + flag_set['C'] + flag_set['U'];
    355     if (i == 0) {
     357    if ((i == 0) && (! bkpinfo->restore_data)) {
    356358        retval++;
    357359        log_to_screen("You must specify the media type\n");
     
    361363        log_to_screen("Please specify only one media type\n");
    362364    }
     365
    363366    if (flag_set['K']) {
    364367        g_loglevel = atoi(flag_val['K']);
     
    368371        }
    369372    }
    370     if (flag_set['L'] && flag_set['0']) {
     373
     374    if ((flag_set['L'] && flag_set['0']) && (! bkpinfo->restore_data)) {
    371375        retval++;
    372376        log_to_screen("You cannot have 'no compression' _and_ LZOP.\n");
    373377    }
    374     bkpinfo->backup_data = flag_set['O'];
     378    if (! bkpinfo->restore_data) {
     379        bkpinfo->backup_data = flag_set['O'];
     380    }
    375381    bkpinfo->verify_data = flag_set['V'];
     382
    376383    if (flag_set['I'] && !bkpinfo->backup_data) {
    377384        log_to_screen("-I switch is ignored if just verifying");
     
    401408        }
    402409    }
    403     if (flag_set['W']) {
     410
     411    if ((flag_set['W']) && (! bkpinfo->restore_data)) {
    404412        bkpinfo->nonbootable_backup = TRUE;
    405413        log_to_screen("Warning - you have opted for non-bootable backup");
     
    409417        }
    410418    }
    411     if (flag_set['t'] && flag_set['H']) {
     419
     420    if ((flag_set['t'] && flag_set['H']) && (! bkpinfo->restore_data)) {
    412421        fatal_error
    413422            ("Sorry, you may not nuke w/o warning from tape. Drop -H, please.");
    414423    }
     424
    415425    if (flag_set['I']) {
    416426        if (!strcmp(bkpinfo->include_paths, "/")) {
     
    430440            if (q != NULL) {
    431441                *q = '\0';
    432                 if (stat(p, &buf) != 0) {
     442                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    433443                    log_msg(1, "ERROR ! %s doesn't exist", p);
    434444                    fatal_error("ERROR ! You specified a directory to include which doesn't exist");
     
    436446                p = q+1 ;
    437447            } else {
    438                 if (stat(p, &buf) != 0) {
     448                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    439449                    log_msg(1, "ERROR ! %s doesn't exist", p);
    440450                    fatal_error("ERROR ! You specified a directory to include which doesn't exist");
     
    456466
    457467    if (g_kernel_version >= 2.6 && !flag_set['d']
    458         && (flag_set['c'] || flag_set['w'])) {
     468        && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) {
    459469        fatal_error
    460470            ("If you are using the 2.6.x kernel, please specify the CD-R(W) device.");
     
    471481        strcpy(bkpinfo->include_paths, flag_val['J']);
    472482    }
    473     if (flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) {
     483
     484    if ((flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) && (! bkpinfo->restore_data)) {
    474485        if (!flag_set['r'] && g_kernel_version <= 2.5
    475486            && strstr(flag_val['d'], "/dev/")) {
     
    522533        }
    523534    }
     535
    524536    if (flag_set['t'] && !flag_set['d']) {
    525537        log_it("Hmm! No tape drive specified. Let's see what we can do.");
     
    540552        if (! flag_set['d']) {
    541553            fatal_error
    542                 ("You need to specify a device file with -d for bootable USB device creation");
    543         }
    544         if (!flag_set['s']) {
     554                ("You need to specify a device file with -d for bootable USB device usage");
     555        }
     556        if ((!flag_set['s']) && (! bkpinfo->restore_data)) {
    545557            fatal_error("You did not specify a size (-s) for your USB device. Aborting");
    546558        }
     
    559571            }
    560572        }
    561         if (!find_home_of_exe("growisofs")) {
    562             fatal_error
    563                 ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    564         }
    565         if (!find_home_of_exe("dvd+rw-format")) {
    566             fatal_error
    567                 ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    568         }
    569573        if (strchr(flag_val['d'], ',')) {
    570574            fatal_error
    571575                ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    572576        }
    573         if (!flag_set['s']) {
    574             sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
    575             strcat(flag_val['s'], "m");
    576             log_to_screen
    577                 ("You did not specify a size (-s) for DVD. I'm guessing %s.",
    578                  flag_val['s']);
    579             flag_set['s'] = 1;
     577        if (! bkpinfo->restore_data) {
     578            if (!find_home_of_exe("growisofs")) {
     579                fatal_error
     580                    ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
     581            }
     582            if (!find_home_of_exe("dvd+rw-format")) {
     583                fatal_error
     584                    ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
     585            }
     586            if (!flag_set['s']) {
     587                sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
     588                strcat(flag_val['s'], "m");
     589                log_to_screen
     590                    ("You did not specify a size (-s) for DVD. I'm guessing %s.",
     591                    flag_val['s']);
     592                flag_set['s'] = 1;
     593            }
    580594        }
    581595/*
     
    591605                ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    592606        }
    593         if (flag_set['O']) {
     607        if ((flag_set['O']) && (! bkpinfo->restore_data)) {
    594608            if (flag_set['s']) {
    595609                if (flag_set['t']) {
     
    609623            }
    610624        }
    611     } else {                    /* CD|USB size */
     625    } else if (! bkpinfo->restore_data) {           /* CD|USB size */
    612626        if (flag_set['s']) {
    613627            if (process_the_s_switch(flag_val['s'])) {
     
    619633        }                       /* CD-RW */
    620634    }
     635
    621636    if (flag_set['n']) {
    622637        strncpy(bkpinfo->nfs_mount, flag_val['n'], MAX_STR_LEN);
     
    636651        log_msg(3, "isodir= %s", bkpinfo->isodir);
    637652    }
     653
    638654    if (flag_set['c']) {
    639655        bkpinfo->backup_media_type = cdr;
     
    702718                q++;
    703719                /* End of bug fix */
    704                 if (stat(p, &buf) != 0) {
     720                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    705721                    log_msg(1, "WARNING ! %s doesn't exist", p);
    706722                }
    707723                p = q+1 ;
    708724            } else {
    709                 if (stat(p, &buf) != 0) {
     725                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    710726                    log_msg(1, "WARNING ! %s doesn't exist", p);
    711727                }
     
    719735                4*MAX_STR_LEN - strlen(bkpinfo->exclude_paths));
    720736    }
     737
    721738    if (flag_set['e']) {
    722739        bkpinfo->please_dont_eject = TRUE;
    723740    }
    724     if (flag_set['N'])          // exclude NFS mounts & devices
     741
     742    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude NFS mounts & devices
    725743    {
    726744//      strncpy(psz, list_of_NFS_devices_and_mounts(), MAX_STR_LEN);
     
    733751                bkpinfo->exclude_paths);
    734752    }
     753
    735754    if (strlen(bkpinfo->exclude_paths) >= 4*MAX_STR_LEN) {
    736755        fatal_error
    737756            ("Your '-E' parameter is too long. Increase MAX_STR_LEN");
    738757    }
     758
    739759    if (flag_set['b']) {
    740760        strcpy(psz, flag_val['b']);
     
    754774        bkpinfo->internal_tape_block_size = itbs;
    755775    }
    756     if (flag_set['D']) {
     776
     777    if ((flag_set['D']) && (! bkpinfo->restore_data)) {
    757778        bkpinfo->differential = 1;
    758779//      bkpinfo->differential = atoi (flag_val['D']);
     
    762783        }
    763784    }
     785
    764786    if (flag_set['x']) {
    765787        strncpy(bkpinfo->image_devs, flag_val['x'], MAX_STR_LEN / 4);
    766         if (run_program_and_log_output("which ntfsclone", 2)) {
     788        if ((run_program_and_log_output("which ntfsclone", 2)) && (! bkpinfo->restore_data)) {
    767789            fatal_error("Please install ntfsprogs package/tarball.");
    768790        }
    769791    }
     792
    770793    if (flag_set['m']) {
    771794        bkpinfo->manual_cd_tray = TRUE;
    772795    }
    773     if (flag_set['k']) {
     796
     797    if ((flag_set['k']) && (! bkpinfo->restore_data)) {
    774798        strncpy(bkpinfo->kernel_path, flag_val['k'], MAX_STR_LEN);
    775799        if (!strcmp(bkpinfo->kernel_path, "failsafe")) {
     
    785809        }
    786810    }
     811
    787812    if (flag_set['p']) {
    788813        strncpy(bkpinfo->prefix, flag_val['p'], MAX_STR_LEN / 4);
    789814        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    790815    }
    791 
    792816
    793817    if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
     
    802826            strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN);
    803827        } else {                /* backup device (if tape/CD-R/CD-RW) */
    804 
    805828            strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4);
    806829        }
    807830    }
    808831
    809     if (flag_set['n']) {
     832    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    810833        asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    811834        sprintf(tmp, "echo hi > %s", tmp1);
     
    840863    }
    841864
    842     if (!flag_set['d'] && !flag_set['n'] && !flag_set['C']) {
     865    if ((!flag_set['d'] && !flag_set['n'] && !flag_set['C']) && (! bkpinfo->restore_data)) {
    843866        retval++;
    844867        log_to_screen("Please specify the backup device/directory.\n");
     
    846869            ("You didn't use -d to specify the backup device/directory.");
    847870    }
    848 /* optional, obscure */
     871
    849872    for (i = '0'; i <= '9'; i++) {
    850873        if (flag_set[i]) {
     
    852875        }                       /* not '\0' but '0' */
    853876    }
     877
    854878    if (flag_set['S']) {
    855879        sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'],
    856880                random() % 32768);
    857881    }
     882
    858883    if (flag_set['T']) {
    859884        setup_tmpdir(flag_val['T']);
     
    873898        }
    874899    }
    875     if (flag_set['A']) {
     900
     901    if ((flag_set['A']) && (! bkpinfo->restore_data)) {
    876902        strncpy(bkpinfo->call_after_iso, flag_val['A'], MAX_STR_LEN);
    877903    }
    878     if (flag_set['B']) {
     904
     905    if ((flag_set['B']) && (! bkpinfo->restore_data)) {
    879906        strncpy(bkpinfo->call_before_iso, flag_val['B'], MAX_STR_LEN);
    880907    }
    881     if (flag_set['H']) {
     908
     909    if ((flag_set['H']) && (! bkpinfo->restore_data)) {
    882910        g_cd_recovery = TRUE;
    883911    }
    884     if (flag_set['l']) {
     912
     913    if ((flag_set['l']) && (! bkpinfo->restore_data)) {
    885914#ifdef __FreeBSD__
    886915#  define BOOT_LOADER_CHARS "GLBMR"
     
    902931#undef BOOT_LOADER_CHARS
    903932    }
     933
    904934    if (flag_set['f']) {
    905935        strncpy(bkpinfo->boot_device,
     
    908938                MAX_STR_LEN / 4);
    909939    }
    910     if (flag_set['P']) {
     940
     941    if ((flag_set['P']) && (! bkpinfo->restore_data)) {
    911942        strncpy(bkpinfo->postnuke_tarball, flag_val['P'], MAX_STR_LEN);
    912943    }
     944
    913945    if (flag_set['Q']) {
    914946        i = which_boot_loader(tmp);
     
    917949        finish(0);
    918950    }
    919     if (flag_set['L']) {
     951
     952    if ((flag_set['L']) && (! bkpinfo->restore_data)) {
    920953        bkpinfo->use_lzo = TRUE;
    921954        if (run_program_and_log_output("which lzop", 2)) {
     
    926959    }
    927960
    928     if (flag_set['G']) {
     961    if ((flag_set['G']) && (! bkpinfo->restore_data)) {
    929962        bkpinfo->use_gzip = TRUE;
    930963        if (run_program_and_log_output("which gzip", 2)) {
     
    937970    bkpinfo->use_obdr = FALSE;
    938971    if (flag_set['o']) {
    939         if (!flag_set['t']) {
     972        if ((!flag_set['t']) && (! bkpinfo->restore_data)) {
    940973            log_to_screen("OBDR support is only available for tapes. Use the -t option");
    941974            fatal_error("Aborting");
     
    943976        bkpinfo->use_obdr = TRUE;
    944977    }
     978
    945979#ifndef __FreeBSD__
    946     if (!is_this_a_valid_disk_format("vfat")) {
     980    if ((!is_this_a_valid_disk_format("vfat")) && (! bkpinfo->restore_data)) {
    947981        bkpinfo->make_cd_use_lilo = TRUE;
    948982        log_to_screen
     
    951985            ("using LILO instead of SYSLINUX as the media boot loader.");
    952986    }
    953     if (run_program_and_log_output("which mkfs.vfat", 2)) {
     987    if ((run_program_and_log_output("which mkfs.vfat", 2)) && (! bkpinfo->restore_data)) {
    954988        bkpinfo->make_cd_use_lilo = TRUE;
    955989#ifdef __IA32__
     
    9761010    }
    9771011
    978     if ( ! bkpinfo->restore_data ) {
     1012    if (! bkpinfo->restore_data) {
    9791013        i = flag_set['O'] + flag_set['V'];
    9801014        if (i == 0) {
    9811015            retval++;
    9821016            log_to_screen("Specify backup (-O), verify (-V) or both (-OV).\n");
     1017        }
     1018    }
     1019
     1020    if ((! bkpinfo->restore_data) && (flag_set['Z'])) {
     1021            fatal_error
     1022                ("The -Z switch is only valid in restore mode");
     1023    }
     1024
     1025    if (flag_set['Z']) {
     1026        if (! strcmp(flag_val['Z'], "nuke")) {
     1027            bkpinfo->restore_mode = nuke;
     1028        } else if (! strcmp(flag_val['Z'], "interactive")) {
     1029            bkpinfo->restore_mode = interactive;
     1030        } else if (! strcmp(flag_val['Z'], "compare")) {
     1031            bkpinfo->restore_mode = compare;
     1032        } else if (! strcmp(flag_val['Z'], "mbr")) {
     1033            bkpinfo->restore_mode = mbr;
     1034        } else if (! strcmp(flag_val['Z'], "iso")) {
     1035            bkpinfo->restore_mode = isoonly;
     1036        } else if (! strcmp(flag_val['Z'], "isonuke")) {
     1037            bkpinfo->restore_mode = isonuke;
     1038        } else {
     1039            bkpinfo->restore_mode = interactive;
    9831040        }
    9841041    }
     
    10781135void help_screen()
    10791136{
    1080     log_msg(1, "Type 'man mondo-archive' for more information\n");
     1137    log_msg(1, "Type 'man mondoarchive' for more information\n");
    10811138    exit(1);
    10821139}
     
    11371194    }
    11381195    kill_buffer();
     1196
     1197    free_MR_global_filenames();
     1198
    11391199    fatal_error
    1140         ("Mondoarchive is terminating in response to a signal from the OS");
     1200        ("MondoRescue is terminating in response to a signal from the OS");
    11411201    finish(254);                // just in case
    11421202}
  • branches/2.2.6/mondo/src/common/libmondo-filelist.c

    r1920 r1967  
    17671767        snprintf(exclude_paths, (size_t)8*MAX_STR_LEN," %s %s %s %s %s . .. \
    17681768" MNT_CDROM " " MNT_FLOPPY " /media /tmp \
    1769 /proc /sys /root/images/mondo " MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1769/proc /sys /var/cache/mondo " MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
    17701770        paranoid_free(tmp2);
    17711771
  • branches/2.2.6/mondo/src/common/libmondo-tools.c

    r1966 r1967  
    806806
    807807void setup_tmpdir(char *path) {
    808    
     808
    809809    char *tmp = NULL;
    810810    char *p = NULL;
     
    816816        paranoid_free(tmp);
    817817    }
    818        
     818
    819819    if (path != NULL) {
    820820        asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path);
     
    871871        strcpy(bkpinfo->isodir, "/");
    872872    } else {
    873         strcpy(bkpinfo->isodir, "/root/images/mondo");
     873        strcpy(bkpinfo->isodir, "/var/cache/mondo");
    874874    }
    875875    strcpy(bkpinfo->prefix, STD_PREFIX);
     
    898898    bkpinfo->make_cd_use_lilo = FALSE;
    899899    bkpinfo->use_obdr = FALSE;
     900    bkpinfo->restore_mode = interactive;
    900901}
    901902
  • branches/2.2.6/mondo/src/common/mondostructures.h

    r1948 r1967  
    151151   */
    152152    int index;
    153    
     153
    154154  /**
    155155   * Type of disk.
    156156   */
    157157    char type;  // ' ' = data (default), S = spare, F = faulty
    158    
     158
    159159};
    160160
     
    197197} t_archtype;
    198198
     199/**
     200 * A type of file in the catalog of recent archives.
     201 */
     202typedef enum {
     203    nuke = 0,                   /// Nuke mode
     204    interactive,                /// Interactive mode
     205    compare,                    /// Compare mode
     206    mbr,                        /// MBR mode
     207    isoonly,                    /// ISO mode
     208    isonuke,                    /// ISO+Nuke mode
     209} t_restore_mode;
     210
    199211
    200212#ifdef __FreeBSD__
     
    249261       */
    250262    int chunk_size;
    251    
     263
    252264      /**
    253265       * The parity algorithm of this RAID device. (RAID5 only)
     
    571583    bool wipe_media_first;
    572584
    573 // patch by Herman Kuster 
     585// patch by Herman Kuster
    574586  /**
    575587   * The differential level of this backup. Currently only 0 (full backup) and 1
     
    577589   */
    578590    int differential;
    579 // end patch 
     591// end patch
    580592
    581593  /**
     
    611623   */
    612624    bool use_obdr;
     625
     626  /**
     627   * Nature of the restore
     628   */
     629    t_restore_mode restore_mode;
    613630};
    614631
  • branches/2.2.6/mondo/src/mondoarchive/mondoarchive.c

    r1930 r1967  
    7272struct s_bkpinfo *bkpinfo;
    7373
     74/* To be coded */
     75void free_MR_global_filenames(void) {
     76}
     77
    7478/****************** subroutines used only by main.c ******************/
    7579
  • branches/2.2.6/mondo/src/mondoarchive/mondoarchive.h

    r1917 r1967  
    99 */
    1010char *MONDO_LOGFILE = "/var/log/mondoarchive.log";
    11 char *MONDO_OPTIONS = "0123456789A:B:C:DE:FGHI:J:K:LNOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
     11char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
    1212
    1313/* No restriction on ps options */
  • branches/2.2.6/mondo/src/mondorestore/mondo-rstr-newt.c

    r1741 r1967  
    23302330 * @param isodir_device Where to put the device (e.g. /dev/hda4) the user enters.
    23312331 * @param isodir_format Where to put the format (e.g. ext2) the user enters.
    2332  * @param isodir_path Where to put the path (e.g. /root/images/mondo) the user enters.
     2332 * @param isodir_path Where to put the path (e.g. /var/cache/mondo) the user enters.
    23332333 * @param nuke_me_please Whether we're planning on nuking or not.
    23342334 * @return TRUE if OK was pressed, FALSE otherwise.
  • branches/2.2.6/mondo/src/mondorestore/mondo-rstr-tools.c

    r1948 r1967  
    177177* Free the malloc()s for the filename variables.
    178178*/
    179 void free_MR_global_filenames()
     179void free_MR_global_filenames(void)
    180180{
    181181paranoid_free(g_biggielist_txt);
    182182paranoid_free(g_filelist_full);
    183183paranoid_free(g_filelist_imagedevs);
    184 //  paranoid_free (g_imagedevs_pot );
    185184paranoid_free(g_imagedevs_restthese);
    186185paranoid_free(g_mondo_cfg_file);
     
    19731972
    19741973
    1975 
    1976 
    1977 /**
    1978  * Turn signal trapping on or off.
    1979  * @param on If TRUE, then do full cleanup when we receive a signal; if FALSE, then
    1980  * print a message and exit immediately.
    1981  */
    1982 void set_signals(int on)
    1983 {
    1984     int signals[] =
    1985         { SIGKILL, SIGPIPE, SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT,
    1986 SIGSTOP, 0 };
    1987     int i;
    1988     for (i = 0; signals[i]; i++) {
    1989         if (on) {
    1990             signal(signals[i], terminate_daemon);
    1991         } else {
    1992             signal(signals[i], termination_in_progress);
    1993         }
    1994     }
    1995 }
    1996 
    1997 /**************************************************************************
    1998  *END_SET_SIGNALS                                                         *
    1999  **************************************************************************/
    2000 
    2001 
    20021974/**
    20031975 * malloc() and set sensible defaults for the mondorestore filename variables.
     
    20922064
    20932065/**
    2094  * Exit due to a signal (normal cleanup).
    2095  * @param sig The signal we're exiting due to.
    2096  */
    2097 void terminate_daemon(int sig)
    2098 {
    2099     log_to_screen
    2100         ("Mondorestore is terminating in response to a signal from the OS");
    2101     paranoid_MR_finish(254);
    2102 }
    2103 
    2104 /**************************************************************************
    2105  *END_TERMINATE_DAEMON                                                    *
    2106  **************************************************************************/
    2107 
    2108 
    2109 /**
    21102066 * Give the user twenty seconds to press Ctrl-Alt-Del before we nuke their drives.
    21112067 */
     
    21372093 *END_TWENTY_SECONDS_TIL_YIKES                                            *
    21382094 **************************************************************************/
    2139 
    2140 
    2141 
    2142 
    2143 
    2144 /**
    2145  * Exit due to a signal (no cleanup).
    2146  * @param sig The signal we're exiting due to.
    2147  */
    2148 void termination_in_progress(int sig)
    2149 {
    2150     log_msg(1, "Termination in progress");
    2151     usleep(1000);
    2152     pthread_exit(0);
    2153 }
    2154 
    2155 /**************************************************************************
    2156  *END_TERMINATION_IN_PROGRESS                                             *
    2157  **************************************************************************/
    2158 
    21592095
    21602096
  • branches/2.2.6/mondo/src/mondorestore/mondorestore.c

    r1966 r1967  
    31603160        finish(res);
    31613161    }
    3162        
     3162
    31633163    if ((argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) && (!bkpinfo->disaster_recovery)) {
    31643164        g_restoring_live_from_cd = TRUE;
     
    32053205
    32063206        // BCO:To be reviewed
    3207         if (argc > 1
    3208             && (strcmp(argv[1], "--compare") == 0
    3209                 || strcmp(argv[1], "--nuke") == 0)) {
     3207        if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) {
    32103208            if (bkpinfo->backup_media_type == nfs
    32113209                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
     
    32273225
    32283226
    3229         if (argc == 2 && strcmp(argv[1], "--nuke") == 0) {
     3227        if (bkpinfo->restore_mode == nuke) {
    32303228            iamhere("nuking");
    32313229            retval += nuke_mode(mountlist, raidlist);
    3232         } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) {
     3230        } else if (bkpinfo->restore_mode == interactive) {
    32333231            iamhere("catchall");
    32343232            retval += catchall_mode(mountlist, raidlist);
    3235         } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) {
     3233        } else if (bkpinfo->restore_mode == compare) {
    32363234            iamhere("compare");
    32373235            retval += compare_mode(mountlist, raidlist);
    3238         } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) {
     3236        } else if (bkpinfo->restore_mode == isoonly) {
    32393237            iamhere("iso");
    32403238            retval = iso_mode(mountlist, raidlist, FALSE);
    3241         } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) {
     3239        } else if (bkpinfo->restore_mode == mbr) {
    32423240            iamhere("mbr");
    32433241            retval = mount_all_devices(mountlist, TRUE);
     
    32493247                log_to_screen("Failed to write Master Boot Record");
    32503248            }
    3251         } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) {
     3249        } else if (bkpinfo->restore_mode == isonuke) {
    32523250            iamhere("isonuke");
    32533251            retval = iso_mode(mountlist, raidlist, TRUE);
    3254         } else if (argc != 1) {
    3255             log_to_screen("Invalid paremeters");
    3256             paranoid_MR_finish(1);
    32573252        } else {
    32583253            iamhere("catchall (no mode specified in command-line call");
  • branches/2.2.6/mondo/src/mondorestore/mondorestore.h

    r1644 r1967  
    99 */
    1010char *MONDO_LOGFILE = "/var/log/mondorestore.log";
     11char *MONDO_OPTIONS = "E:GI:J:K:QRT:UVZ:b:d:ef:gimn:op:tux:z";
    1112
    1213/* Busybox ps has no option and PID in first pos */
Note: See TracChangeset for help on using the changeset viewer.