Changeset 2029 in MondoRescue


Ignore:
Timestamp:
Oct 3, 2008, 1:15:28 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Should fix #277 (compatibility in live mode with previous versions)
Location:
branches/2.2.7/mondo/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.7/mondo/src/include/my-stuff.h

    r1930 r2029  
    7575#define STD_PREFIX "mondorescue"    /* Should be coherent with mindi */
    7676
    77 /**
    78  * The biggielist stub (appended to the directory where all.tar.gz was unpacked).
    79  */
    80 #define BIGGIELIST_TXT_STUB "./tmp/biggielist.txt"
    81 
    82 /**
    83  * The filelist stub (appended to the directory where all.tar.gz was unpacked).
    84  */
    85 #define FILELIST_FULL_STUB "./tmp/filelist.full.gz"
    86 
    87 /**
    88  * The mountlist stub (appended to the directory where all.tar.gz was unpacked).
    89  */
    90 #define MOUNTLIST_FNAME_STUB "./tmp/mountlist.txt"
    91 
    92 /**
    93  * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked).
    94  */
    95 #define MONDO_CFG_FILE_STUB "./tmp/mondo-restore.cfg"
    9677/**
    9778 * The location where mindi media images are stored.
  • branches/2.2.7/mondo/src/mondorestore/mondo-rstr-tools.c

    r2022 r2029  
    11/***************************************************************************
    2 mondo-rstr-tools.c  -  description
    3 -----------------
    4 
    5 begin: Sun Sep 21 16:40:35 EDT 2003
    6 copyright : (C) 2002 Mondo  Hugo Rabson
    7 email     : Hugo Rabson <hugorabson@msn.com>
    8 edited by : by Stan Benoit ?/2003
    9 email     : troff@nakedsoul.org
    10 cvsid     : $Id: mondo-rstr-tools.c
    11 ***************************************************************************/
     2$Id$
    123
    134/***************************************************************************
     
    1910*                                                                         *
    2011***************************************************************************/
    21 /* mondo-rstr-tools.c               Hugo Rabson
    22 
    23 
    24 07/27
    25 - if the user is foolish enough to use /dev/md0 as boot device,
    26 call lilo -M /dev/hda to make sure lilo does its job properly
    27 - better NFS+nuke support
    28 
    29 07/20
    30 - use backup's i-want-my-lvm file
    31 - be sure to use archives' raidtab when restoring
    32 
    33 07/18
    34 - use /tmp/isodir for NFS if DR mode
    35 - better support of users who boot from LVM CD and nuke-restore non-LVM backups
    36 
    37 07/12
    38 - bugfix to allow user to burn ISOs to CDs and restore from CDs (not original src)
    39 
    40 06/29
    41 - mount ext3 partitions as ext2, just in case :)
    42 
    43 06/26
    44 - delete make_relevant_partition_bootable()
    45 
    46 06/19
    47 - futzed with the call to mount floppy, to stop it from locking up on my AMD64 system
    48 
    49 06/14
    50 - shell out to /mnt/RESTORING chroot in order to let user install GRUB
    51 manually if automatic GRUB installation fails
    52 
    53 06/15
    54 - Added check for different 'isodir' chosen by user than stored in the archive
    55 Conor Daly <conor.daly@met.ie>
    56 
    57 04/17
    58 - replaced INTERNAL_TAPE_BLK_SIZE with bkpinfo->internal_tape_block_size
    59 
    60 04/09
    61 - don't try to mount CD if tape bkp
    62 
    63 04/03
    64 - trying to copy tmp/mondo-restore.cfg to itself - silly! - fixed
    65 
    66 04/02
    67 - when extracting cfg file and mountlist from all.tar.gz (tape copy),
    68 use block size of INTERNAL_TAPE_BLK_SIZE, not TAPE_BLOCK_SIZE
    69 
    70 02/21
    71 - don't use 'mv -v' cos Busybox won't support it
    72 
    73 02/09
    74 - make hole for cfg file before moving it (line 2094 or so)
    75 
    76 02/03
    77 - changed a couple of refs to filelist.full, to filelist.full.gz
    78 
    79 01/16/2004
    80 - instead of copying filelist, use 'ln -sf' to link to original;
    81 saves space
    82 
    83 11/20/2003
    84 - also retrieve /tmp/mountlist.txt if user wants
    85 
    86 11/16
    87 - fixed NFS path bug affecting the extractions of filelist/biggielist
    88 during selective restore
    89 
    90 11/02
    91 - fixed mount_cdrom() to run properly w/ nfs restores
    92 - mount_device() returns 0 if swap mount fails cos swap isn't crucial
    93 
    94 10/17
    95 - run_grub() uses MNT_RESTORING instead of "/mnt/RESTORING"
    96 
    97 10/26
    98 - cleaned up run_grub()
    99 
    100 10/25
    101 - fixed mount_cdrom() to run properly w/ nfs restores
    102 
    103 10/21
    104 - mount_device() returns 0 if swap mount fails cos swap isn't crucial
    105 
    106 10/15
    107 - run_grub() now uses its initiative instead
    108 of calling grub-install
    109 
    110 10/10
    111 - don't leave copies of filelist.full lying around, clogging up
    112 the ramdisk, there's a good fellow :-)
    113 
    114 10/02
    115 - added 'dvd' to the range of media types I'll understand
    116 - fixed iso->cdr problem (thanks, Stan Benoit & Fred Beondo)
    117 
    118 09/24
    119 - try lots of tape devs if /dev/st0 fails
    120 
    121 09/23/2003
    122 - first incarnation
    123 */
    124 
    12512
    12613#include <pthread.h>
     
    13017#include "../common/libmondo.h"
    13118#include "mr-externs.h"
    132 //#include "mondo-restore.h"
    133 //#include "mondo-rstr-compare-EXT.h"
    13419#include "mondo-rstr-tools.h"
     20
     21/**
     22 * The biggielist stub (appended to the directory where all.tar.gz was unpacked).
     23 */
     24#define BIGGIELIST_TXT_STUB "tmp/biggielist.txt"
     25
     26/**
     27 * The filelist stub (appended to the directory where all.tar.gz was unpacked).
     28 */
     29#define FILELIST_FULL_STUB "tmp/filelist.full.gz"
     30
     31/**
     32 * The mountlist stub (appended to the directory where all.tar.gz was unpacked).
     33 */
     34#define MOUNTLIST_FNAME_STUB "tmp/mountlist.txt"
     35
     36/**
     37 * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked).
     38 */
     39#define MONDO_CFG_FILE_STUB "tmp/mondo-restore.cfg"
     40/**
     41 * The i-want-my-lvm stub
     42 */
     43#define IWANTMYLVM_STUB "tmp/i-want-my-lvm"
    13544
    13645extern bool g_ISO_restore_mode; /* are we in Iso Mode? */
     
    12901199    log_to_screen("Extracting filelist and biggielist from media...");
    12911200    unlink("/tmp/filelist.full");
    1292     unlink("/" FILELIST_FULL_STUB);
    1293     unlink("/tmp/i-want-my-lvm");
     1201    unlink(FILELIST_FULL_STUB);
     1202    unlink("/" IWANTMYLVM_STUB);
    12941203    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    12951204        sprintf(command,
    1296             "tar -b %ld -zxf %s %s %s %s %s %s",
     1205            "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s",
    12971206            bkpinfo->internal_tape_block_size,
    12981207            bkpinfo->media_device,
     
    13001209            BIGGIELIST_TXT_STUB,
    13011210            FILELIST_FULL_STUB,
    1302             "./tmp/i-want-my-lvm", MONDO_CFG_FILE_STUB);
     1211            IWANTMYLVM_STUB,
     1212            MONDO_CFG_FILE_STUB);
    13031213        log_msg(1, "tarcommand = %s", command);
    13041214        run_program_and_log_output(command, 1);
     1215        if (!does_file_exist(FILELIST_FULL_STUB)) {
     1216            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
     1217            log_msg(2, "pre-2.2.4 compatible mode on");
     1218            sprintf(command,
     1219                "tar -b %ld -zxf %s %s %s %s %s %s",
     1220                bkpinfo->internal_tape_block_size,
     1221                bkpinfo->media_device,
     1222                MOUNTLIST_FNAME_STUB,
     1223                BIGGIELIST_TXT_STUB,
     1224                FILELIST_FULL_STUB,
     1225                IWANTMYLVM_STUB,
     1226                MONDO_CFG_FILE_STUB);
     1227            log_msg(1, "tarcommand = %s", command);
     1228            run_program_and_log_output(command, 1);
     1229        }
    13051230    } else {
    13061231        log_msg(2,
     
    13111236        run_program_and_log_output("mount", 1);
    13121237        sprintf(command,
    1313             "tar -zxf %s/images/all.tar.gz %s %s %s %s %s",
     1238            "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s",
    13141239            MNT_CDROM,
    13151240            MOUNTLIST_FNAME_STUB,
    13161241            BIGGIELIST_TXT_STUB,
    13171242            FILELIST_FULL_STUB,
    1318             "./tmp/i-want-my-lvm", MONDO_CFG_FILE_STUB);
     1243            IWANTMYLVM_STUB,
     1244            MONDO_CFG_FILE_STUB);
    13191245
    13201246        log_msg(1, "tarcommand = %s", command);
    13211247        run_program_and_log_output(command, 1);
     1248        if (!does_file_exist(FILELIST_FULL_STUB)) {
     1249            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
     1250            log_msg(2, "pre-2.2.4 compatible mode on");
     1251            sprintf(command,
     1252                "tar -zxf %s/images/all.tar.gz %s %s %s %s %s",
     1253                MNT_CDROM,
     1254                MOUNTLIST_FNAME_STUB,
     1255                BIGGIELIST_TXT_STUB,
     1256                FILELIST_FULL_STUB,
     1257                IWANTMYLVM_STUB,
     1258                MONDO_CFG_FILE_STUB);
     1259
     1260            log_msg(1, "tarcommand = %s", command);
     1261            run_program_and_log_output(command, 1);
     1262        }
    13221263        if (!does_file_exist(BIGGIELIST_TXT_STUB)) {
    13231264            fatal_error
    1324                 ("all.tar.gz did not include ./tmp/biggielist.txt");
     1265                ("all.tar.gz did not include " BIGGIELIST_TXT_STUB);
    13251266        }
    13261267        if (!does_file_exist(FILELIST_FULL_STUB)) {
    13271268            fatal_error
    1328                 ("all.tar.gz did not include ./tmp/filelist.full.gz");
     1269                ("all.tar.gz did not include " FILELIST_FULL_STUB);
    13291270        }
    13301271    }
     
    13471288    ask_me_yes_or_no("Do you want to retrieve the mountlist as well?"))
    13481289    {
    1349 //      sprintf(command, "cp -f tmp/mountlist.txt /tmp");
    13501290        sprintf(command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB,
    13511291            bkpinfo->tmpdir);
     
    22302170
    22312171    sprintf(command,
    2232             "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s",
     2172            "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s",
    22332173            dev,
    22342174            bkpinfo->internal_tape_block_size,
    22352175            1024L * 1024 * 32 / bkpinfo->internal_tape_block_size,
    22362176            MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB,
    2237             BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, "./tmp/i-want-my-lvm");
     2177            BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
    22382178    log_msg(2, "command = '%s'", command);
    22392179    res = run_program_and_log_output(command, -1);
    2240     if (res != 0 && does_file_exist(MONDO_CFG_FILE_STUB)) {
    2241         res = 0;
     2180    if (res != 0) {
     2181        if (does_file_exist(MONDO_CFG_FILE_STUB)) {
     2182            res = 0;
     2183        } else {
     2184            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
     2185            log_msg(2, "pre-2.2.4 compatible mode on");
     2186            sprintf(command,
     2187                    "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s",
     2188                    dev,
     2189                    bkpinfo->internal_tape_block_size,
     2190                    1024L * 1024 * 32 / bkpinfo->internal_tape_block_size,
     2191                    MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB,
     2192                    BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
     2193            log_msg(2, "command = '%s'", command);
     2194            res = run_program_and_log_output(command, -1);
     2195            if ((res != 0) && (does_file_exist(MONDO_CFG_FILE_STUB))) {
     2196                res = 0;
     2197            }
     2198        }
    22422199    }
    22432200    paranoid_free(command);
     
    22892246    unlink(FILELIST_FULL_STUB);
    22902247    unlink(BIGGIELIST_TXT_STUB);
    2291     unlink("tmp/i-want-my-lvm");
     2248    unlink(IWANTMYLVM_STUB);
    22922249    sprintf(command, "mkdir -p %s", mountpt);
    22932250    run_program_and_log_output(command, FALSE);
     
    23552312                log_msg(2,
    23562313                        "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz");
    2357                 sprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, "./tmp/i-want-my-lvm");    // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
     2314                sprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);    // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
    23582315                run_program_and_log_output(command, TRUE);
    23592316                if (!does_file_exist(MONDO_CFG_FILE_STUB)) {
    2360                     fatal_error
    2361                         ("Please reinsert the disk/CD and try again.");
     2317                    /* Doing that allow us to remain compatible with pre-2.2.5 versions */
     2318                    log_msg(2, "pre-2.2.4 compatible mode on");
     2319                    sprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);  // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
     2320                    run_program_and_log_output(command, TRUE);
     2321                    if (!does_file_exist(MONDO_CFG_FILE_STUB)) {
     2322                        fatal_error
     2323                            ("Please reinsert the disk/CD and try again.");
     2324                    }
    23622325                }
    23632326        }
     
    23932356            } else {
    23942357                log_msg(1, "Copied mountlist to /tmp as well OK");
    2395                 sprintf(command, "cp -f tmp/i-want-my-lvm /tmp/");
     2358                sprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB);
    23962359                run_program_and_log_output(command, 1);
    23972360            }
     
    24312394    sprintf(command, "cp -f etc/raidtab /etc/");
    24322395    run_program_and_log_output(command, FALSE);
    2433     sprintf(command, "cp -f tmp/i-want-my-lvm /tmp/");
     2396    sprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB);
    24342397    run_program_and_log_output(command, FALSE);
    24352398    g_backup_media_type = bkpinfo->backup_media_type;
Note: See TracChangeset for help on using the changeset viewer.