Changeset 1977 in MondoRescue


Ignore:
Timestamp:
Jun 2, 2008, 10:49:01 AM (16 years ago)
Author:
Bruno Cornec
Message:

svn merge -r 1938:1976 $SVN_M/branches/2.2.6

Location:
branches/stable
Files:
9 deleted
24 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-kernel/mindi-kernel.spec

    r349 r1977  
    22# $Id$
    33#
    4 %define mrel    1
    54
    65Summary:    A program that creates emergency boot disks/CDs using your kernel, tools and modules.
    76Name:       mindi-kernel
    8 Version:    1.06
    9 Release:    %mrel
     7Version:    2.6
     8Release:    1
    109License:    GPL
    1110Group:      System/Kernel and hardware
  • branches/stable/mindi/README.pxe

    r1939 r1977  
    2121server is the ip addr of the NFS server
    2222mountpoint is the mount point on the NFS server to use (should be in /etc/exports of the NFS server)
     23rmadisk_size may have to be increase to 131072 on more recent distributions such as rhel 5
    2324The [] mean this parameter is optional
    2425The () mean that you have a choice with the '|' meaning 'or'
     
    4041During boot mondorestore will start your NFS configuration and mount mondo's content from the network rather than from a physical media. You may alter the IP configuration stored from the original machine by passing the ipconf option describing respectively the IP address, netmask, broadcast and default gateway you want to setup for the machine, separated by ':'. Or alternatively, you may specify the dhcp keyword so that a DHCP request is made to get those information. In the 2 cases, you have to mention on which physical interface those parameters should apply. On some configurations, you may also want to increase the number of ping queries made before the NFS mount, which is of 3 by default, using the ping option and give the number you want. If you have a different NFS server for the deployment than for the archiving, you can also precise it through the nfsmount option. The structure on both server under the mountpoint has to be the same.
    4142
     43CAVEAT: the limit to the number of char on the append line is 255. Use symlinks to reduce the size of your path if needed.
     44
    4245Please report any problem around that tool to bruno@mondorescue.org
    4346
  • branches/stable/mindi/analyze-my-lvm

    r1489 r1977  
    1313GetValueFromField() {
    1414    local res
    15     sed s/'    '/~/ "$1" | tr -s ' ' ' ' | sed s/'~ '/'~'/ | grep -i "$2~" | cut -d'~' -f2,3,4,5 | tr '~' ' ' | gawk '{ if ($2=="MB") {printf "%dm",$1;} else if ($2=="KB") {printf "%dk",$1;} else if ($2=="GB") {printf "%dg",$1;} else {print $0;};}'
     15    sed s/'    '/~/ "$1" | tr -s ' ' ' ' | sed s/'~ '/'~'/ | grep -i "$2~" | cut -d'~' -f2,3,4,5 | tr '~' ' ' | gawk '{ if ($2=="MB") {printf "%dm",$1;} else if ($2=="KB") {printf "%dk",$1;} else if ($2=="GB") {printf "%fg",$1;} else {print $0;};}'
    1616}
    1717
  • branches/stable/mindi/distributions/conf/mindi.conf.dist

    r1939 r1977  
    9292# Modules supported by mindi and required at boot time
    9393#
    94 mindi_scsi_mods="3w-xxxx 3w_xxxx 3w-9xxx 3w_9xxx 53c7,8xx a100u2w a320raid aacraid adpahci advansys aha152x aha1542 aha1740 aic79xx aic79xx_mod aic7xxx aic7xxx_mod aic7xxx_old AM53C974 atp870u BusLogic cciss cpqfc dmx3191d dpt_i2o dtc eata eata_dma eata_pio fdomain gdth g_NCR5380 i2o_block i2o_core ide-scsi ieee1394 imm in2000 initio ips iscsi isp megaraid megaraid_mm megaraid_mbox megaraid_sas mptbase mptscsih mptsas mptspi mptfc mptscsi mptctl NCR53c406a ncr53c8xx nsp32 pas16 pci2000 pci2220i pcmcia ppa psi240i qla1280 qla2200 qla2300 qla2xxx qla2xxx_conf qlogicfas qlogicfc qlogicisp raw1394 scsi_debug scsi_mod scsi_transport_sas scsi_transport_spi sd_mod seagate sg sim710 sr_mod sym53c416 sym53c8xx sym53c8xx_2 t128 tmscsim u14-34f ultrastor wd7000 vmhgfs"
     94mindi_scsi_mods="3w-xxxx 3w_xxxx 3w-9xxx 3w_9xxx 53c7,8xx a100u2w a320raid aacraid adpahci advansys aha152x aha1542 aha1740 aic79xx aic79xx_mod aic7xxx aic7xxx_mod aic7xxx_old AM53C974 atp870u BusLogic cciss cpqfc dmx3191d dpt_i2o dtc eata eata_dma eata_pio fdomain gdth g_NCR5380 i2o_block i2o_core ide-scsi ieee1394 imm in2000 initio ips iscsi isp megaraid megaraid_mm megaraid_mbox megaraid_sas mptbase mptscsih mptsas mptspi mptfc mptscsi mptctl NCR53c406a ncr53c8xx nsp32 pas16 pci2000 pci2220i pcmcia ppa psi240i qla1280 qla2200 qla2300 qla2xxx qla2xxx_conf qlogicfas qlogicfc qlogicisp raw1394 scsi_debug scsi_mod scsi_transport_sas scsi_transport_spi sd_mod seagate sg sim710 sr_mod sym53c416 sym53c8xx sym53c8xx_2 t128 tmscsim u14-34f ultrastor wd7000 vmhgfs intermodule"
    9595mindi_ide_mods="ide ide-generic ide-detect ide-mod ide-disk ide_disk ide-cd ide_cd ide-cs ide-core ide_core edd paride ata_generic ata_piix libata via82cxxx generic nvidia ahci sata_nv cmd64x pata_amd pata_marvell pata_serverworks"
    9696# Replace with that line for HP OCMP e.g.
  • branches/stable/mindi/mindi

    r1939 r1977  
    13851385    rm -Rf $MINDI_TMP/iso
    13861386    mkdir -p $MINDI_TMP/iso/{images,archives,isolinux}
    1387     cp -f $1/*.img $1/*.gz $MINDI_TMP/iso/images 2>> $LOGFILE || LogIt "OfferToMakeBootableISO: Cannot copy $i to $MINDI_TMP/iso/images"
     1387    cp -f $1/*.gz $MINDI_TMP/iso/images 2>> $LOGFILE || LogIt "OfferToMakeBootableISO: Cannot copy $1/*.gz to $MINDI_TMP/iso/images"
    13881388    old_pwd=`pwd`
    13891389    cd $MINDI_TMP/iso
     
    14271427    else
    14281428        $ISO_CMD $ISO_OPT -V Mindi_Image -o $MINDI_CACHE/mindi.iso -b images/mindi-bootroot.$BOOT_SIZE.img -c isolinux/boot.cat -no-emul-boot . > /dev/null 2> $MINDI_TMP/mkisofs.log
     1429        rm -f images/mindi-bootroot.$BOOT_SIZE.img
    14291430    fi
    14301431    if [ "$?" -ne "0" ] ; then
     
    16301631            else
    16311632                options="interactive expert compare iso nuke isonuke"
    1632 # hda hdb hdc hdd"
    16331633            fi
    16341634        else
     
    21002100    rm -f $orig_file
    21012101    return 0
    2102 }
    2103 
    2104 
    2105 ScanCDandTape() {
    2106     local i
    2107 
    2108     for i in /dev/st0 /dev/ht0 /dev/cdrom /dev/cdrom0 /dev/cdrom 1 ; do
    2109         dd if=$i of=/dev/null bs=64k count=1 &> /dev/null
    2110     done
    21112102}
    21122103
     
    28802871    fi
    28812872fi
    2882 #ScanCDandTape
    28832873[ "$CDRECOVERY" = "yes" ] || CDRECOVERY=no
    28842874if [ "$CDRECOVERY" = "yes" ] ; then
     
    29562946fi
    29572947if [ _"$MONDO_SHARE" = _"" ] && [ "$INTERACTIVE" = "yes" ] && [ "$ARCH" != "ia64" ] ; then
    2958     echo -en "Would you like to use LILO (instead of syslinux)\nfor your boot image (y/[n]) ?"
    2959     read ch
    2960     if [ "$ch" != "y" ] && [ "$ch" != "Y" ] ; then
    2961         USE_LILO=no
    2962     else
    2963         USE_LILO=yes
    2964     fi
     2948    USE_LILO=no
    29652949fi
    29662950if [ "$YOUR_KERNEL_SUCKS" != "" ] || [ "$kernelpath" = "" ] || [ "$kernelpath" = "SUCKS" ] || [ "$kernelpath" = "FAILSAFE" ] ; then
  • branches/stable/mindi/rootfs/sbin/init

    r1939 r1977  
    105105    [ "$1" != "" ] && tapedev=$1
    106106    [ ! "$tapedev" ] && tapedev=`grep media-dev /tmp/mondo-restore.cfg | tr -s ' ' ' ' | cut -d' ' -f2`
    107 #    tar -zxf $tapedev
     107    mt -f $tapedev rewind
     108    mt -f $tapedev fsf 2
    108109    dd if=$tapedev bs=32k count=1024 | tar -zx
    109110    res=$?
    110111    if [ "$res" -eq "0" ] ; then
    111     grep -v media-dev /tmp/mondo-restore.cfg > /tmp/mr.cfg
    112     echo "media-dev=$tapedev" >> /tmp/mr.cfg
    113         cp -f /tmp/mr.cfg /tmp/mondo-restore.cfg
     112        # Store the dev name in case we changed it interactively
     113        sed -i "s/^media-dev .*$/media-dev  $tapedev/" /tmp/mondo-restore.cfg
     114
     115        #grep -v media-dev /tmp/mondo-restore.cfg > /tmp/mr.cfg
     116        #echo "media-dev $tapedev" >> /tmp/mr.cfg
     117        #cp -f /tmp/mr.cfg /tmp/mondo-restore.cfg
    114118    fi
    115119    cd $old_pwd
     
    120124    local res tapedev
    121125    tapedev="" ; # will be set by UntarTapeStuff()
     126
     127    # Here we can add the USB storage module, it's working even with OBDR !
     128    modprobe -q usb-storage
     129    # Tape takes some time to appear
     130    sleep 10
    122131    cd $GROOVY
    123     UntarTapeStuff $tapedev || UntarTapeStuff /dev/st0 || UntarTapeStuff /dev/osst0 || UntarTapeStuff /dev/ht0
     132    UntarTapeStuff $tapedev
    124133    res=$?
    125134    while [ "$res" -ne "0" ] ; do
     
    139148        fi
    140149    done
     150    # For post-init
     151    export TAPEDEV=$tapedev
    141152
    142153    if [ "$res" -ne "0" ] ; then
     
    146157        res=$?
    147158    else
    148     #   clear
    149159        LogIt "Using tape as extended datadisk. Good." 3
    150160        echo "Using tape as extd ddisk." > /tmp/TAPEDEV-HAS-DATA-DISKS
     
    584594    export DENY_MODS=" "
    585595fi
    586 
     596if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg`" ]; then
     597    # Do not try to load usb storage when dealing with OBDR it makes the modprobe hang :-(
     598    export DENY_MODS="usb-storage $DENY_MODS"
     599fi
    587600if [ "`grep -i forcemods /proc/cmdline`" ]; then
    588601    export FORCE_MODS="`cat /proc/cmdline | sed 's~.*forcemods=\"\(.*\)\".*~\1~'` mondonone"
     
    623636fi
    624637
    625 if [ "`grep -i 'tape ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i udev /tmp/mondo-restore.cfg`" ]; then
     638if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg`" ] || [ "`grep -i ' udev' /tmp/mondo-restore.cfg`" ]; then
    626639    HandleTape
    627640    ExtractDataDisksAndLoadModules
     
    635648    ExtractDataDisksAndLoadModules
    636649elif [ "`grep -i usb= /proc/cmdline`" ] || [ "`grep -i usb /tmp/mondo-restore.cfg | grep media-type`" ]; then
    637     # We need to get here exported variables from start-nfs
    638650    . /sbin/start-usb
    639651
  • branches/stable/mindi/rootfs/sbin/post-init

    r1621 r1977  
    104104done
    105105
     106mondoopt=""
     107if [ "`grep -i 'obdr ' /tmp/mondo-restore.cfg`" ]; then
     108    mondoopt="$mondoopt -o -d $TAPEDEV"
     109fi
     110
     111if [ "`grep -i 'debug' /proc/cmdline`" ]; then
     112    mondoopt="$mondoopt -K 99"
     113fi
     114
    106115if [ "$compare" ] ; then
    107116    LogIt "------------------COMPARE MODE-----------------" 1
    108     mondorestore --compare
     117    mondorestore $mondoopt -Z compare
    109118elif [ "$nuke" ] ; then
    110119    LogIt "-------------------NUKE MODE-------------------" 1
    111     mondorestore --nuke
     120    mondorestore $mondoopt -Z nuke
    112121elif [ "$expert" ] ; then
    113122    if [ "`grep tapedev /tmp/mondo-restore.cfg`" ] ; then
     
    119128        LogIt "Tape Mode -- calling mondorestore..."
    120129            if [ "$nuke" ] ; then
    121                 mondorestore --nuke
     130                mondorestore $mondoopt -Z nuke
    122131            else
    123                 mondorestore; # MR will detect & access the tape
     132                mondorestore $mondoopt; # MR will detect & access the tape
    124133            fi
    125134    fi
     
    132141            LogIt "Cdstream Mode -- calling mondorestore..."
    133142            if [ "$nuke" ] ; then
    134                 mondorestore --nuke
     143                mondorestore -Z nuke $mondoopt
    135144            else
    136                 mondorestore; # MR will detect & access the cdstream
     145                mondorestore $mondoopt; # MR will detect & access the cdstream
    137146            fi
    138147        fi
     
    147156else
    148157    LogIt "------------------INTERACTIVE------------------" 1
    149     mondorestore --interactive
     158    mondorestore -Z interactive $mondoopt
    150159fi
    151160
    152 [ -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
    153162
    154163exit 0
  • branches/stable/mondo-doc/mondoarchive.8

    r1903 r1977  
    189189this is the directory where the ISO images are stored. For NFS users, this is
    190190the directory within the NFS mount where the backups are stored. The default
    191 for ISO and NFS is '/root/images/mondo'.
     191for ISO and NFS is '/var/cache/mondo'.
    192192
    193193.TP
     
    212212.TP
    213213.BI "-o "
    214 Use LILO as boot loader of boot media instead of SYSLINUX/ISOLINUX. By
    215 default, SYSLINUX is used for USB and ISOLINUX for CD's. Use LILO if you
    216 prefer to use that boot loader. NB: This does not affect which boot loader you
    217 use to boot your PC, merely the boot loader used by the media created
    218 by Mondo. Use ELILO instead which is mandatory for IA64 machines.
     214Use OBDR (One Button Disaster Recovery) type of tapes.
     215By default, tapes are not bootable. With this flag, tape will be made bootable
     216following the OBDR format.
    219217
    220218.TP
     
    310308.TP
    311309.BI "-e "
    312 Don't eject the CD or tape when backing up or restoring... unless cdrecord
    313 insists on it. If it does, well, tough. Sorry. :)
     310Don't eject the CD or tape when backing up...
    314311
    315312.TP
  • branches/stable/mondo-doc/mondorestore.8

    r1903 r1977  
    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/stable/mondo/src/common/libmondo-archive.c

    r1939 r1977  
    6060/*@unused@*/
    6161//static char cvsid[] = "$Id$";
     62//
     63extern char *get_non_rewind_dev(char *);
    6264
    6365/* *************************** external global vars ******************/
     
    7072extern long long g_tape_posK;
    7173extern char *g_tmpfs_mountpt;
    72 extern bool g_cd_recovery;
    7374extern char *g_serial_string;
    74 
    7575extern char *g_getfacl;
    7676extern char *g_getfattr;
     
    7979/* Reference to global bkpinfo */
    8080extern struct s_bkpinfo *bkpinfo;
    81 
    8281
    8382
     
    111110static int g_sem_id;
    112111static int g_sem_key;
    113 
    114 
    115 
    116112
    117113/**
     
    540536    char *use_lilo_sz = NULL;
    541537    char *bootdev = NULL;
     538    char *ntapedev = NULL;
    542539
    543540    /*@ char ************************************************************** */
     
    586583    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    587584        mr_asprintf(&tape_size_sz, "%ld", bkpinfo->media_size);
     585        ntapedev = get_non_rewind_dev(bkpinfo->media_device);
     586        if ((bkpinfo->use_obdr) && (ntapedev != NULL)) {
     587            mr_free(bkpinfo->media_device);
     588            bkpinfo->media_device = ntapedev;
     589        } else {
     590            if (ntapedev == NULL) {
     591                log_it("Not able to create OBDR - Restore will have to be done manually");
     592            }
     593        }
    588594        mr_asprintf(&tape_device, bkpinfo->media_device);
    589595    } else {
     
    858864        mr_fprintf(fd1, "acl=no\n");
    859865    }
     866    if (bkpinfo->use_obdr) {
     867        asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     868        if (write_one_liner_data_file(tmp1, "TRUE")) {
     869            log_msg(1, "%ld: Unable to write one-liner OBDR",
     870                __LINE__);
     871        }
     872        paranoid_free(tmp1);
     873    }
    860874
    861875    if (g_cd_recovery) {
     
    12551269            openout_cdstream(bkpinfo->media_device, bkpinfo->writer_speed);
    12561270        } else {
    1257             openout_tape(bkpinfo->media_device, bkpinfo->internal_tape_block_size); /* sets g_tape_stream */
     1271            openout_tape(); /* sets g_tape_stream */
    12581272        }
    12591273        if (!g_tape_stream) {
     
    21442158        /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    21452159        if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2146             register_in_tape_catalog(fileset, curr_set_no, -1,
    2147                                      curr_afioball_fname);
    2148             maintain_collection_of_recent_archives(bkpinfo->tmpdir,
    2149                                                    curr_afioball_fname);
     2160            register_in_tape_catalog(fileset, curr_set_no, -1, curr_afioball_fname);
     2161            maintain_collection_of_recent_archives(bkpinfo->tmpdir, curr_afioball_fname);
    21502162            iamhere("Writing EXAT files");
    21512163            res +=
  • branches/stable/mondo/src/common/libmondo-cli.c

    r1939 r1977  
    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']);
    365             log_msg(1,"Loglevel forced to %s",g_loglevel);
     368            log_msg(1,"Loglevel forced to %d",g_loglevel);
    366369        if (g_loglevel < 3) {
    367370            g_loglevel = 3;
    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    }
    524     if (flag_set['t'] && !flag_set['d']) {
     535
     536    if ((flag_set['t'] && !flag_set['d']) && (! bkpinfo->restore_data)) {
    525537        log_it("Hmm! No tape drive specified. Let's see what we can do.");
    526538        if (find_tape_device_and_size(flag_val['d'], tmp)) {
     
    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);
    789     }
    790 
     814        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
     815    }
    791816
    792817    if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
     
    801826            strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN);
    802827        } else {                /* backup device (if tape/CD-R/CD-RW) */
    803 
    804828            strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4);
    805829        }
    806830    }
    807831
    808     if (flag_set['n']) {
     832    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    809833        asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    810834        sprintf(tmp, "echo hi > %s", tmp1);
     
    839863    }
    840864
    841     if (!flag_set['d'] && !flag_set['n'] && !flag_set['C']) {
     865    if ((!flag_set['d'] && !flag_set['n'] && !flag_set['C']) && (! bkpinfo->restore_data)) {
    842866        retval++;
    843867        log_to_screen("Please specify the backup device/directory.\n");
     
    845869            ("You didn't use -d to specify the backup device/directory.");
    846870    }
    847 /* optional, obscure */
     871
    848872    for (i = '0'; i <= '9'; i++) {
    849873        if (flag_set[i]) {
     
    851875        }                       /* not '\0' but '0' */
    852876    }
     877
    853878    if (flag_set['S']) {
    854879        sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'],
    855880                random() % 32768);
    856881    }
     882
    857883    if (flag_set['T']) {
    858884        setup_tmpdir(flag_val['T']);
     
    872898        }
    873899    }
    874     if (flag_set['A']) {
     900
     901    if ((flag_set['A']) && (! bkpinfo->restore_data)) {
    875902        strncpy(bkpinfo->call_after_iso, flag_val['A'], MAX_STR_LEN);
    876903    }
    877     if (flag_set['B']) {
     904
     905    if ((flag_set['B']) && (! bkpinfo->restore_data)) {
    878906        strncpy(bkpinfo->call_before_iso, flag_val['B'], MAX_STR_LEN);
    879907    }
    880     if (flag_set['H']) {
     908
     909    if ((flag_set['H']) && (! bkpinfo->restore_data)) {
    881910        g_cd_recovery = TRUE;
    882911    }
    883     if (flag_set['l']) {
     912
     913    if ((flag_set['l']) && (! bkpinfo->restore_data)) {
    884914#ifdef __FreeBSD__
    885915#  define BOOT_LOADER_CHARS "GLBMR"
     
    901931#undef BOOT_LOADER_CHARS
    902932    }
     933
    903934    if (flag_set['f']) {
    904935        strncpy(bkpinfo->boot_device,
     
    907938                MAX_STR_LEN / 4);
    908939    }
    909     if (flag_set['P']) {
     940
     941    if ((flag_set['P']) && (! bkpinfo->restore_data)) {
    910942        strncpy(bkpinfo->postnuke_tarball, flag_val['P'], MAX_STR_LEN);
    911943    }
     944
    912945    if (flag_set['Q']) {
    913946        i = which_boot_loader(tmp);
     
    916949        finish(0);
    917950    }
    918     if (flag_set['L']) {
     951
     952    if ((flag_set['L']) && (! bkpinfo->restore_data)) {
    919953        bkpinfo->use_lzo = TRUE;
    920954        if (run_program_and_log_output("which lzop", 2)) {
     
    925959    }
    926960
    927     if (flag_set['G']) {
     961    if ((flag_set['G']) && (! bkpinfo->restore_data)) {
    928962        bkpinfo->use_gzip = TRUE;
    929963        if (run_program_and_log_output("which gzip", 2)) {
     
    934968    }
    935969
    936     if (!flag_set['o']
    937         &&
    938         !run_program_and_log_output
    939         ("grep -Ei suse /etc/issue.net | grep -E '9.0' | grep 64", 2)) {
     970    bkpinfo->use_obdr = FALSE;
     971    if (flag_set['o']) {
     972        if ((!flag_set['t']) && (! bkpinfo->restore_data)) {
     973            log_to_screen("OBDR support is only available for tapes. Use the -t option");
     974            fatal_error("Aborting");
     975        }
     976        bkpinfo->use_obdr = TRUE;
     977    }
     978
     979#ifndef __FreeBSD__
     980    if ((!is_this_a_valid_disk_format("vfat")) && (! bkpinfo->restore_data)) {
    940981        bkpinfo->make_cd_use_lilo = TRUE;
    941982        log_to_screen
    942             ("Forcing you to use LILO. SuSE 9.0 (64-bit) has a broken mkfs.vfat binary.");
    943     }
    944     if (flag_set['o']) {
     983            ("Your kernel appears not to support vfat filesystems. I am therefore");
     984        log_to_screen
     985            ("using LILO instead of SYSLINUX as the media boot loader.");
     986    }
     987    if ((run_program_and_log_output("which mkfs.vfat", 2)) && (! bkpinfo->restore_data)) {
    945988        bkpinfo->make_cd_use_lilo = TRUE;
    946     }
    947 #ifndef __FreeBSD__
    948     else {
    949         if (!is_this_a_valid_disk_format("vfat")) {
    950             bkpinfo->make_cd_use_lilo = TRUE;
    951             log_to_screen
    952                 ("Your kernel appears not to support vfat filesystems. I am therefore");
    953             log_to_screen
    954                 ("using LILO instead of SYSLINUX as the media boot loader.");
    955         }
    956         if (run_program_and_log_output("which mkfs.vfat", 2)) {
    957             bkpinfo->make_cd_use_lilo = TRUE;
    958989#ifdef __IA32__
    959             log_to_screen
    960                 ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
    961             log_to_screen
    962                 ("your boot loader. I shall therefore use LILO instead.");
     990        log_to_screen
     991            ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
     992        log_to_screen
     993            ("your boot loader. I shall therefore use LILO instead.");
    963994#endif
    964995#ifdef __IA64__
    965             log_to_screen
    966                 ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
    967             log_to_screen("environment correctly. Please install it.");
    968             fatal_error("Aborting");
     996        log_to_screen
     997            ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
     998        log_to_screen("environment correctly. Please install it.");
     999        fatal_error("Aborting");
    9691000#endif
    970         }
     1001    }
    9711002#ifdef __IA64__
    972         /* We force ELILO usage on IA64 */
    973         bkpinfo->make_cd_use_lilo = TRUE;
     1003    /* We force ELILO usage on IA64 */
     1004    bkpinfo->make_cd_use_lilo = TRUE;
    9741005#endif
    975     }
    9761006#endif
    9771007
     
    9801010    }
    9811011
    982     if ( ! bkpinfo->restore_data ) {
     1012    if (! bkpinfo->restore_data) {
    9831013        i = flag_set['O'] + flag_set['V'];
    9841014        if (i == 0) {
    9851015            retval++;
    9861016            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;
    9871040        }
    9881041    }
     
    10821135void help_screen()
    10831136{
    1084     log_msg(1, "Type 'man mondo-archive' for more information\n");
     1137    log_msg(1, "Type 'man mondoarchive' for more information\n");
    10851138    exit(1);
    10861139}
     
    11411194    }
    11421195    kill_buffer();
     1196
     1197    free_MR_global_filenames();
     1198
    11431199    fatal_error
    1144         ("Mondoarchive is terminating in response to a signal from the OS");
     1200        ("MondoRescue is terminating in response to a signal from the OS");
    11451201    finish(254);                // just in case
    11461202}
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1939 r1977  
    17491749
    17501750    case tape:
    1751         if (bkpinfo->media_device) {
     1751        if ((!bkpinfo->restore_mode) && (find_tape_device_and_size(bkpinfo->media_device, sz_size))) {
     1752            mr_msg(3, "Ok, using vanilla scsi tape.");
     1753            mr_free(bkpinfo->media_device);
     1754            mr_asprintf(&tmp,VANILLA_SCSI_TAPE);
     1755            bkpinfo->media_device = tmp;
     1756
    17521757            if ((fin = fopen(bkpinfo->media_device, "r"))) {
    17531758                paranoid_fclose(fin);
     
    17951800        bkpinfo->media_size = 0L;
    17961801        mr_msg(4, "media_size = %ld", bkpinfo->media_size);
     1802        bkpinfo->use_obdr = ask_me_yes_or_no
     1803            ("Do you want to activate OBDR support for your tapes ?");
    17971804        if (archiving_to_media) {
    17981805            if ((bkpinfo->compression_level =
     
    21962203    strcpy(exclude_these_directories,
    21972204           call_program_and_get_last_line_of_output
    2198            ("mount -t coda,ncpfs,nfs,smbfs,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2205           ("mount -t coda,ncpfs,nfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
    21992206    strcpy(exclude_these_devices,
    22002207           call_program_and_get_last_line_of_output
    2201            ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|afs|ocfs|ocfs2|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2208           ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    22022209    sprintf(result_sz, "%s", exclude_these_directories);
    22032210    mr_free(exclude_these_devices);
     
    22272234    mr_asprintf(&tmp,
    22282235           call_program_and_get_last_line_of_output
    2229            ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2236           ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    22302237#else
    22312238    mr_asprintf(&tmp,
    22322239           call_program_and_get_last_line_of_output
    2233            ("LANGUAGE=C df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x ocfs -x ocfs2 -x mvfs | sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2240           ("LANGUAGE=C df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs | sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    22342241#endif
    22352242
  • branches/stable/mondo/src/common/libmondo-filelist.c

    r1924 r1977  
    16031603        mr_asprintf(&exclude_paths, " %s %s %s %s %s %s . .. \
    16041604" MNT_CDROM " " MNT_FLOPPY " /media /tmp /var/log/lastlog \
    1605 /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);
    1606         paranoid_free(tmp2);
     1605/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);
     1606        mr_free(tmp2);
    16071607
    16081608        mr_msg(2,
  • branches/stable/mondo/src/common/libmondo-stream-EXT.h

    r1663 r1977  
    1313extern int openin_tape();
    1414extern int openout_cdstream(char *cddev, int speed);
    15 extern int openout_tape(char *tapedev, long internal_tape_block_size);
     15extern int openout_tape();
    1616extern int read_file_from_stream_to_file(
    1717                                         char *outfile, long long size);
  • branches/stable/mondo/src/common/libmondo-stream.c

    r1939 r1977  
    22
    33...tools for talking to tapes, Monitas streams, etc.
     4
    45*/
    56
     
    364365    int res = 0;
    365366    char *fname = (char *)&res;                 /* Should NOT be NULL */
     367    char *tmp = NULL;
    366368
    367369    // xattr
     
    371373            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    372374        }
    373         if (!strstr(fname, "xattr")) {
    374             fatal_error("Wrong order for xattr, sunshine.");
     375        if (strstr(fname, "xattr") == NULL) {
     376            asprintf(&tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
     377            fatal_error(tmp);
    375378        }
    376379        read_file_from_stream_to_file(xattr_fname, *ptmp_size);
    377         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     380        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    378381        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
    379382            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
    380383        }
    381384        mr_msg(1, "Got xattr");
    382         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     385        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    383386        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
    384387            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
    385388        }
    386         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    387         if (pctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
     389        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
     390        if (*pctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
    388391            log_msg(1, "No acl attributes found, skipping to afio files");
    389392            return(0);
    390393        } else {
    391             if (pctrl_chr != BLK_START_EXTENDED_ATTRIBUTES) {
     394            if (*pctrl_chr != BLK_START_EXTENDED_ATTRIBUTES) {
    392395                wrong_marker(BLK_START_EXTENDED_ATTRIBUTES, *pctrl_chr);
    393396            }
     
    397400    if (g_getfacl) {
    398401        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    399         if (!strstr(fname, "acl")) {
    400             fatal_error("Wrong order for acl, sunshine.");
    401         }
    402402        if (*pctrl_chr != BLK_START_EXAT_FILE) {
    403403            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    404404        }
     405        if (strstr(fname, "acl") == NULL) {
     406            asprintf(&tmp,"Wrong order expected acl, got %s, sunshine.", fname);
     407            fatal_error(tmp);
     408        }
    405409        read_file_from_stream_to_file(acl_fname, *ptmp_size);
    406         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     410        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    407411        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
    408412            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
    409413        }
    410         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     414        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    411415        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
    412416            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
     
    595599
    596600
    597 int set_tape_block_size_with_mt(char *tapedev,
    598                                 long internal_tape_block_size)
     601int set_tape_block_size_with_mt(long internal_tape_block_size)
    599602{
    600603    char *tmp;
    601604    int res;
    602605
    603     if (strncmp(tapedev, "/dev/", 5)) {
     606    if (strncmp(bkpinfo->media_device, "/dev/", 5)) {
    604607        mr_msg(1,
    605608                "Not using 'mt setblk'. This isn't an actual /dev entry.");
    606609        return (0);
    607610    }
    608     mr_asprintf(&tmp, "mt -f %s setblk %ld", tapedev,
    609              internal_tape_block_size);
     611    mr_asprintf(&tmp, "mt -f %s setblk %ld",bkpinfo->media_device,internal_tape_block_size);
    610612    res = run_program_and_log_output(tmp, 3);
    611613    mr_free(tmp);
    612614    return (res);
     615}
     616
     617/**
     618 * Return the non-rewinding device when passed the normal one
     619 * @param tapedev The tape device to open for writing.
     620 * @note the caller needs to free the string returned
     621 */
     622char *get_non_rewind_dev(char *tapedev)
     623{
     624
     625    char *ntapedev = NULL;
     626    char *p = NULL;
     627    char *q = NULL;
     628    char *r = NULL;
     629
     630    ntapedev = (char *)malloc(strlen(tapedev)+sizeof(char));
     631    p = strrchr(tapedev,'/');
     632    if (p == NULL) {
     633        log_it("Didn't find a '/' in %s",tapedev);
     634        return(NULL);
     635    }
     636
     637    /* Copy tapedev content up to the last / */
     638    q = tapedev;
     639    r = ntapedev;
     640    while (q != p) {
     641        *r = *q;
     642        r++;
     643        q++;
     644    }
     645    /* Copy the '/' */
     646    *r = *q;
     647    r++;
     648    q++;
     649    /* Adds a 'n' - non-rewinding */
     650    *r = 'n';
     651    r++;
     652    /* Copy the rest of tapedev */
     653    while (*q != '\0') {
     654        *r = *q;
     655        r++;
     656        q++;
     657    }
     658    *r = '\0';
     659    if (mt_says_tape_exists(ntapedev)) {
     660        log_it("Non-rewinding tape device is %s",ntapedev);
     661    } else {
     662        log_it("Unable to find non-rewinding tape device.");
     663        ntapedev = NULL;
     664    }
     665    return(ntapedev);
     666}
     667
     668
     669
     670/**
     671 * Handle OBDR if we were asked to do so
     672 * @param tapedev The tape device to open for reading.
     673 */
     674int skip_obdr(void)
     675{
     676    char *command = NULL;
     677    int res = 0;
     678
     679    log_it("Skipping OBDR headers");
     680    asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     681    res = run_program_and_log_output(command, 1);
     682    paranoid_free(command);
     683
     684    asprintf(&command, "mt -f %s fsf 2",bkpinfo->media_device);
     685    res = run_program_and_log_output(command, 1);
     686    paranoid_free(command);
     687
     688    set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     689    return(res);
     690}
     691
     692/**
     693 * Handle OBDR if we were asked to do so
     694 * @param tapedev The tape device to open for writing.
     695 * @return 0 for success, nonzero for failure.
     696 * @note This should be called ONLY from backup processes. It will OVERWRITE ANY
     697 * EXISTING DATA on the tape!
     698 */
     699int create_obdr(void)
     700{
     701
     702    char *command = NULL;
     703    int res = 0;
     704
     705    log_it("Creating OBDR headers");
     706    /* OBDR: First block 10 kB of zero bs = 512 */
     707    asprintf(&command, "mt -f %s compression off",bkpinfo->media_device);
     708    res = run_program_and_log_output(command, 1);
     709    paranoid_free(command);
     710
     711    asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     712    res += run_program_and_log_output(command, 1);
     713    paranoid_free(command);
     714
     715    set_tape_block_size_with_mt(512);
     716
     717    asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
     718    res += run_program_and_log_output(command, 1);
     719    paranoid_free(command);
     720
     721    /* OBDR: then ISO boot image bs = 2048 */
     722    set_tape_block_size_with_mt(2048);
     723
     724    asprintf(&command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
     725    res += run_program_and_log_output(command, 1);
     726    paranoid_free(command);
     727
     728    set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     729    return(res);
    613730}
    614731
     
    633750    int i;
    634751    int j;
    635     int res;
     752    int res = 0;
    636753    long length, templong;
    637754    size_t k;
     
    654771        return (0);
    655772    }
     773
     774    // mondoarchive should have configured everything to give the right non-rew device
     775    if ((bkpinfo->use_obdr) && (bkpinfo->media_device != NULL)) {
     776        res = skip_obdr();
     777        if (res != 0) {
     778            log_it("Not able to skip OBDR - Restore will have to be done manually");
     779        }
     780    } else {
     781        if (bkpinfo->media_device == NULL) {
     782            log_it("Not able to skip OBDR - Restore will have to be done manually");
     783        }
     784        set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     785    }
     786
    656787    insist_on_this_tape_number(1);
    657788    mr_asprintf(&outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
    658789    make_hole_for_file(outfname);
    659 
    660     set_tape_block_size_with_mt(bkpinfo->media_device,
    661                                 bkpinfo->internal_tape_block_size);
    662790
    663791    log_it("Opening IN tape");
     
    762890/**
    763891 * Start writing to a tape device for the backup.
     892 * Handle OBDR if we were asked to do so
    764893 * @param tapedev The tape device to open for writing.
    765894 * @return 0 for success, nonzero for failure.
     
    767896 * EXISTING DATA on the tape!
    768897 */
    769 int openout_tape(char *tapedev, long internal_tape_block_size)
    770 {
     898int openout_tape() {
     899
    771900    g_current_media_number = 1;
    772901    if (g_tape_stream) {
     
    777906    g_tape_posK = 0;
    778907
    779     set_tape_block_size_with_mt(tapedev, internal_tape_block_size);
     908    if (bkpinfo->use_obdr) {
     909        create_obdr();
     910    } else {
     911        set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     912    }
    780913    log_it("Opening OUT tape");
    781914    if (!
    782915        (g_tape_stream =
    783          open_device_via_buffer(tapedev, 'w', internal_tape_block_size))) {
     916         open_device_via_buffer(bkpinfo->media_device, 'w', internal_tape_block_size))) {
    784917        log_to_screen(_("Cannot openin stream device"));
    785918        return (1);
  • branches/stable/mondo/src/common/libmondo-stream.h

    r1663 r1977  
    1414int openin_tape();
    1515int openout_cdstream(char *cddev, int speed);
    16 int openout_tape(char *tapedev, long internal_tape_block_size);
     16int openout_tape();
    1717int read_file_from_stream_to_file(char *outfile,
    1818                                  long long size);
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1924 r1977  
    677677
    678678void setup_tmpdir(char *path) {
    679    
     679
    680680    char *tmp = NULL;
    681681    char *p = NULL;
     
    687687        paranoid_free(tmp);
    688688    }
    689        
     689
    690690    if (path != NULL) {
    691691        asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path);
     
    758758    }
    759759    bkpinfo->boot_device[0] = '\0';
    760     bkpinfo->restore_path[0] = '\0';
     760    bkpinfo->image_devs[0] = '\0';
     761    bkpinfo->compression_level = 3;
    761762    bkpinfo->do_not_compress_these[0] = '\0';
    762763    bkpinfo->verify_data = FALSE;
    763764    bkpinfo->backup_data = FALSE;
    764765    bkpinfo->restore_data = FALSE;
     766    bkpinfo->use_star = FALSE;
     767    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    765768    bkpinfo->disaster_recovery =
    766769        (am_I_in_disaster_recovery_mode()? TRUE : FALSE);
     
    772775    mr_asprintf(&tmp,mr_conf->prefix);
    773776    bkpinfo->prefix = tmp;
    774 
    775     bkpinfo->make_filelist = TRUE;  // unless -J supplied to mondoarchive
     777    sensibly_set_tmpdir_and_scratchdir();
     778
    776779    bkpinfo->optimal_set_size = 0;
    777     bkpinfo->backup_media_type = none;
    778780    bkpinfo->backup_media_string[0] = '\0';
    779781    strcpy(bkpinfo->include_paths, "/");
     782    bkpinfo->restore_path[0] = '\0';
    780783    bkpinfo->call_before_iso[0] = '\0';
    781784    bkpinfo->call_make_iso[0] = '\0';
    782785    bkpinfo->call_after_iso[0] = '\0';
    783     bkpinfo->image_devs[0] = '\0';
    784     bkpinfo->postnuke_tarball[0] = '\0';
    785786    bkpinfo->nfs_mount[0] = '\0';
    786787    bkpinfo->nfs_remote_dir[0] = '\0';
     788    bkpinfo->postnuke_tarball[0] = '\0';
    787789    bkpinfo->wipe_media_first = FALSE;
    788     bkpinfo->differential = FALSE;
     790    bkpinfo->differential = 0;
     791    bkpinfo->please_dont_eject = FALSE;
    789792    bkpinfo->writer_speed = mr_conf->iso_burning_speed;
     793    bkpinfo->manual_cd_tray = FALSE;
     794    bkpinfo->nonbootable_backup = FALSE;
     795    bkpinfo->make_cd_use_lilo = FALSE;
     796    bkpinfo->use_obdr = FALSE;
     797    bkpinfo->restore_mode = interactive;
    790798}
    791799
  • branches/stable/mondo/src/common/mondostructures.h

    r1904 r1977  
    127127   */
    128128    int index;
    129    
     129
    130130  /**
    131131   * Type of disk.
    132132   */
    133133    char type;  // ' ' = data (default), S = spare, F = faulty
    134    
     134
    135135};
    136136
     
    184184} t_archtype;
    185185
     186/**
     187 * A type of file in the catalog of recent archives.
     188 */
     189typedef enum {
     190    nuke = 0,                   /// Nuke mode
     191    interactive,                /// Interactive mode
     192    compare,                    /// Compare mode
     193    mbr,                        /// MBR mode
     194    isoonly,                    /// ISO mode
     195    isonuke,                    /// ISO+Nuke mode
     196} t_restore_mode;
     197
    186198
    187199#ifdef __FreeBSD__
     
    236248       */
    237249    int chunk_size;
    238    
     250
    239251      /**
    240252       * The parity algorithm of this RAID device. (RAID5 only)
     
    582594   */
    583595    bool make_cd_use_lilo;
     596
     597  /**
     598   * If TRUE, make the the tape bootable. If FALSE, normal tape, the default
     599   */
     600    bool use_obdr;
     601
     602  /**
     603   * Nature of the restore
     604   */
     605    t_restore_mode restore_mode;
    584606};
    585607
  • branches/stable/mondo/src/mondoarchive/mondoarchive.c

    r1939 r1977  
    817817struct s_bkpinfo *bkpinfo;
    818818
     819/* To be coded */
     820void free_MR_global_filenames(void) {
     821}
     822
    819823/****************** subroutines used only by main.c ******************/
    820824
  • branches/stable/mondo/src/mondoarchive/mondoarchive.h

    r1924 r1977  
    1717 */
    1818char *MONDO_LOGFILE = "/var/log/mondoarchive.log";
    19 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";
     19char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
    2020
    2121/* No restriction on ps options */
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1939 r1977  
    5656
    5757extern void kill_anything_like_this(char *str);
     58extern int skip_obdr(void);
    5859
    5960/**
     
    7273    mr_free(g_mondo_cfg_file);
    7374    mr_free(g_mountlist_fname);
     75    mr_free(g_mondo_home);
    7476    mr_free(g_tmpfs_mountpt);
    7577    mr_free(g_isodir_device);
     
    887889        bkpinfo->use_star = TRUE;
    888890        mr_msg(1, "Goody! ... bkpinfo->use_star is now true.");
     891    }
     892
     893    read_cfg_var(cfg_file, "obdr", value);
     894    if (strstr(value, "yes")) {
     895        bkpinfo->use_obdr = TRUE;
     896        log_msg(1, "OBDR mode activated");
    889897    }
    890898
     
    17861794
    17871795/**
    1788  * Turn signal trapping on or off.
    1789  * @param on If TRUE, then do full cleanup when we receive a signal; if FALSE, then
    1790  * print a message and exit immediately.
    1791  */
    1792 void set_signals(int on)
    1793 {
    1794     int signals[] =
    1795         { SIGKILL, SIGPIPE, SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT,
    1796         SIGSTOP, 0
    1797     };
    1798     int i;
    1799     for (i = 0; signals[i]; i++) {
    1800         if (on) {
    1801             signal(signals[i], terminate_daemon);
    1802         } else {
    1803             signal(signals[i], termination_in_progress);
    1804         }
    1805     }
    1806 }
    1807 
    1808 /**************************************************************************
    1809  *END_SET_SIGNALS                                                         *
    1810  **************************************************************************/
    1811 
    1812 
    1813 /**
    18141796 * malloc() and set sensible defaults for the mondorestore filename variables.
    18151797 * @param bkpinfo The backup information structure. Fields used:
     
    18951877/**************************************************************************
    18961878 *END_STREAMLINE_CHANGES_FILE                                             *
    1897  **************************************************************************/
    1898 
    1899 
    1900 /**
    1901  * Exit due to a signal (normal cleanup).
    1902  * @param sig The signal we're exiting due to.
    1903  */
    1904 void terminate_daemon(int sig)
    1905 {
    1906     log_to_screen
    1907         (_("Mondorestore is terminating in response to a signal from the OS"));
    1908     free_MR_global_filenames();
    1909     finish(254);
    1910 }
    1911 /**************************************************************************
    1912  *END_TERMINATE_DAEMON                                                    *
    19131879 **************************************************************************/
    19141880
     
    19411907/**************************************************************************
    19421908 *END_TWENTY_SECONDS_TIL_YIKES                                            *
    1943  **************************************************************************/
    1944 
    1945 
    1946 /**
    1947  * Exit due to a signal (no cleanup).
    1948  * @param sig The signal we're exiting due to.
    1949  */
    1950 void termination_in_progress(int sig)
    1951 {
    1952     mr_msg(1, "Termination in progress");
    1953     usleep(1000);
    1954     pthread_exit(0);
    1955 }
    1956 /**************************************************************************
    1957  *END_TERMINATION_IN_PROGRESS                                             *
    19581909 **************************************************************************/
    19591910
     
    20111962                                   "/mnt/.boot.d", 5);
    20121963    }
     1964
     1965    /* Unmounting the local /proc and /sys first */
     1966    run_program_and_log_output("umount " MNT_RESTORING "/proc",3);
     1967    run_program_and_log_output("umount " MNT_RESTORING "/sys",3);
     1968
    20131969    for (lino = mountlist->entries - 1; lino >= 0; lino--) {
    20141970        if (!strcmp(mountlist->el[lino].mountpoint, "lvm")) {
     
    20812037    // BERLIOS: below 32KB seems to block at least on RHAS 2.1 and MDK 10.0
    20822038
     2039    if (bkpinfo->use_obdr) {
     2040        skip_obdr();
     2041    }
    20832042    // tar -zxvf-
    20842043    mr_asprintf(&command,
  • branches/stable/mondo/src/mondorestore/mondorestore.c

    r1939 r1977  
    33243324
    33253325extern int partition_everything(struct mountlist_itself *mountlist);
    3326 
     3326extern int handle_incoming_parameters(int argc, char *argv[]);
    33273327
    33283328/**
     
    35453545    c = which_restore_mode();
    35463546    iamhere("post wrm");
    3547     if (c == 'I' || c == 'N' || c == 'C') {
     3547    if (c == 'I' || c == 'C') {
    35483548        interactively_obtain_media_parameters_from_user(FALSE);
     3549    } else if (c == 'N') {
     3550        // Auto mode nothing special to do
    35493551    } else {
    35503552        popup_and_OK("No restoring or comparing will take place today.");
     
    37103712        }
    37113713    }
    3712    
     3714
    37133715#ifdef __FreeBSD__
    37143716    if (strstr
     
    63986400    }
    63996401
    6400     if (argc == 3 && strcmp(argv[1], "-p") == 0) {
    6401         strcpy(bkpinfo->prefix,argv[2]);
    6402         log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    6403     }
    6404 
    6405     if (argc == 3 && strcmp(argv[1], "-K") == 0) {
    6406         g_loglevel = atoi(argv[2]);
    6407         log_msg(1,"Loglevel forced to %s",g_loglevel);
    6408     }
    6409 
    64106402    if (argc == 2 && strcmp(argv[1], "--live-grub") == 0) {
    64116403        retval = run_grub(FALSE, "/dev/hda");
     
    64196411        pause_and_ask_for_cdr(5, NULL);
    64206412        paranoid_MR_finish(0);
    6421     } else if (!bkpinfo->disaster_recovery) {   // live!
    6422         if (argc != 1) {
    6423             popup_and_OK
    6424                 ("Live mode doesn't support command-line parameters yet.");
    6425             paranoid_MR_finish(1);
    6426 //    return(1);
    6427         }
     6413    }
     6414    if ((argc == 2 && strcmp(argv[1], "--partition-only") == 0) && (bkpinfo->disaster_recovery)) {
     6415        log_msg(0, "Partitioning only.");
     6416        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     6417        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     6418        load_mountlist(mountlist, g_mountlist_fname);
     6419        res = partition_everything(mountlist);
     6420        finish(res);
     6421    }
     6422
     6423    if ((argc == 2 && strcmp(argv[1], "--format-only") == 0) && (bkpinfo->disaster_recovery)) {
     6424        log_msg(0, "Formatting only.");
     6425        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     6426        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     6427        load_mountlist(mountlist, g_mountlist_fname);
     6428        res = format_everything(mountlist, FALSE, raidlist);
     6429        finish(res);
     6430    }
     6431
     6432    if ((argc == 2 && strcmp(argv[1], "--stop-lvm-and-raid") == 0) && (bkpinfo->disaster_recovery)) {
     6433        log_msg(0, "Stopping LVM and RAID");
     6434        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     6435        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     6436        load_mountlist(mountlist, g_mountlist_fname);
     6437        res = do_my_funky_lvm_stuff(TRUE, FALSE);
     6438        res += stop_all_raid_devices(mountlist);
     6439        finish(res);
     6440    }
     6441
     6442    if ((argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) && (!bkpinfo->disaster_recovery)) {
     6443        g_restoring_live_from_cd = TRUE;
     6444    }
     6445
     6446    // Handle params here first
     6447    handle_incoming_parameters(argc,argv);
     6448
     6449    if (!bkpinfo->disaster_recovery) {  // live!
    64286450        log_msg(1, "I am in normal, live mode.");
    64296451        log_msg(2, "FYI, MOUNTLIST_FNAME = %s", g_mountlist_fname);
    64306452        mount_boot_if_necessary();  /* for Gentoo users */
    64316453        log_msg(2, "Still here.");
    6432         if (argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) {
    6433             g_restoring_live_from_cd = TRUE;
    6434         }
    64356454        if (bkpinfo->backup_media_type == nfs) {
    64366455            g_restoring_live_from_nfs = TRUE;
     
    64396458            retval =
    64406459                restore_live_from_monitas_server(argv[2],
    6441                                                  argv[3], argv[4]);
     6460                                                argv[3], argv[4]);
    64426461        } else {
    64436462            log_msg(2, "Calling restore_to_live_filesystem()");
     
    64556474        log_msg(1, "I must be in disaster recovery mode.");
    64566475        log_msg(2, "FYI, MOUNTLIST_FNAME = %s ", g_mountlist_fname);
    6457         if (argc == 3 && strcmp(argv[1], "--monitas-memorex") == 0) {
    6458             log_to_screen("Uh, that hasn't been implemented yet.");
    6459             paranoid_MR_finish(1);
    6460         }
    64616476
    64626477        iamhere("About to call load_mountlist and load_raidtab");
     
    64686483            ("Returned from calling load_mountlist and load_raidtab successfully");
    64696484
    6470         if (argc > 1
    6471             && (strcmp(argv[1], "--compare") == 0
    6472                 || strcmp(argv[1], "--nuke") == 0)) {
     6485        // BCO:To be reviewed
     6486        if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) {
    64736487            if (bkpinfo->backup_media_type == nfs
    64746488                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
     
    64826496        }
    64836497
    6484 
    64856498        if (retval) {
    64866499            log_to_screen
     
    64886501        }
    64896502
    6490 
    64916503        log_msg(1, "Send in the clowns.");
    64926504
    6493         if (argc == 2 && strcmp(argv[1], "--partition-only") == 0) {
    6494             log_msg(0, "Partitioning only.");
    6495             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    6496             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    6497             load_mountlist(mountlist, g_mountlist_fname);
    6498             res = partition_everything(mountlist);
    6499             finish(res);
    6500         }
    6501 
    6502         if (argc == 2 && strcmp(argv[1], "--format-only") == 0) {
    6503             log_msg(0, "Formatting only.");
    6504             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    6505             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    6506             load_mountlist(mountlist, g_mountlist_fname);
    6507             res = format_everything(mountlist, FALSE, raidlist);
    6508             finish(res);
    6509         }
    6510 
    6511         if (argc == 2 && strcmp(argv[1], "--stop-lvm-and-raid") == 0) {
    6512             log_msg(0, "Stopping LVM and RAID");
    6513             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    6514             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    6515             load_mountlist(mountlist, g_mountlist_fname);
    6516             res = do_my_funky_lvm_stuff(TRUE, FALSE);
    6517             res += stop_all_raid_devices(mountlist);
    6518             finish(res);
    6519         }
    6520 
    6521         if (argc == 2 && strcmp(argv[1], "--nuke") == 0) {
     6505
     6506        if (bkpinfo->restore_mode == nuke) {
    65226507            iamhere("nuking");
    65236508            retval += nuke_mode(mountlist, raidlist);
    6524         } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) {
     6509        } else if (bkpinfo->restore_mode == interactive) {
    65256510            iamhere("catchall");
    65266511            retval += catchall_mode(mountlist, raidlist);
    6527         } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) {
     6512        } else if (bkpinfo->restore_mode == compare) {
    65286513            iamhere("compare");
    65296514            retval += compare_mode(mountlist, raidlist);
    6530         } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) {
     6515        } else if (bkpinfo->restore_mode == isoonly) {
    65316516            iamhere("iso");
    65326517            retval = iso_mode(mountlist, raidlist, FALSE);
    6533         } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) {
     6518        } else if (bkpinfo->restore_mode == mbr) {
    65346519            iamhere("mbr");
    65356520            retval = mount_all_devices(mountlist, TRUE);
     
    65416526                log_to_screen("Failed to write Master Boot Record");
    65426527            }
    6543         } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) {
     6528        } else if (bkpinfo->restore_mode == isonuke) {
    65446529            iamhere("isonuke");
    65456530            retval = iso_mode(mountlist, raidlist, TRUE);
    6546         } else if (argc != 1) {
    6547             log_to_screen("Invalid paremeters");
    6548             paranoid_MR_finish(1);
    65496531        } else {
    65506532            iamhere("catchall (no mode specified in command-line call");
  • branches/stable/mondo/src/mondorestore/mondorestore.h

    r1663 r1977  
    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.