Changeset 2462 in MondoRescue for branches/2.2.10/mondo


Ignore:
Timestamp:
Oct 20, 2009, 4:07:00 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3548@localhost: bruno | 2009-10-16 19:18:27 +0200

  • mindi now boots in a QEMU VM without busybox
  • mindi is now noarch as a consequence
  • MINDI_LIB becomes MINDI_DATA for coherency and as a consequence
  • CACHEDIR becomes MINDI_CACHE for coherency and it's a build parameter and not hardcoded anymore in mindi
  • THat variable is also used at restore time for mondorestore.cfg e.g.
  • FAILSAFE kernel is gone. Just use another kernel of your choice. Most std kernels work anyway
  • TurnTgzIntoRdz rewritten and now really computes data disk size and not suppose its size
  • Interface mondo/mindi changed again => incompatible
  • Non-bootable media not supported anymore.
  • Mondorescue adapted to these changes but not tested yet
  • Doc updated as well
Location:
branches/2.2.10/mondo
Files:
23 edited

Legend:

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

    r2460 r2462  
    513513    char *bootldr_str = NULL;
    514514    char *tape_device = NULL;
    515     char *last_filelist_number = NULL;
    516515    char *broken_bios_sz = NULL;
    517516    char *cd_recovery_sz = NULL;
     
    546545    }
    547546    lines_in_filelist = count_lines_in_file(tmp);
    548     mr_free(tmp);
    549 
    550     mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    551     last_filelist_number = last_line_of_file(tmp);
    552547    mr_free(tmp);
    553548
     
    805800            (bkpinfo->image_devs == NULL) ? "\"\"" : bkpinfo->image_devs,   // parameter #10
    806801            broken_bios_sz,     // parameter #11
    807             last_filelist_number,   // parameter #12 (STRING)
    808             estimated_total_noof_slices,    // parameter #13 (INT)
    809             (bkpinfo->exclude_devs == NULL) ? "\"\"" : bkpinfo->exclude_devs,   // parameter #14
    810             use_comp_sz,        // parameter #15
    811             use_lilo_sz,        // parameter #16
    812             use_star_sz,        // parameter #17
    813             bkpinfo->internal_tape_block_size,  // parameter #18 (LONG)
    814             bkpinfo->differential,  // parameter #19 (INT)
    815             use_gzip_sz,        // parameter #20 (STRING)
    816             use_lzma_sz,        // parameter #21 (STRING)
     802            estimated_total_noof_slices,    // parameter #12 (INT)
     803            (bkpinfo->exclude_devs == NULL) ? "\"\"" : bkpinfo->exclude_devs,   // parameter #13
     804            use_comp_sz,        // parameter #14
     805            use_lilo_sz,        // parameter #15
     806            use_star_sz,        // parameter #16
     807            bkpinfo->internal_tape_block_size,  // parameter #17 (LONG)
     808            bkpinfo->differential,  // parameter #18 (INT)
     809            use_gzip_sz,        // parameter #19 (STRING)
     810            use_lzma_sz,        // parameter #20 (STRING)
    817811            MONDO_LOGFILE);
    818812
    819813    mr_free(tmp2);
    820     mr_free(last_filelist_number);
    821814    mr_free(tape_device);
    822815    mr_free(use_lzo_sz);
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2444 r2462  
    671671        mr_free(bkpinfo->kernel_path);
    672672        mr_asprintf(bkpinfo->kernel_path, "%s", flag_val['k']);
    673         if (!strcmp(bkpinfo->kernel_path, "failsafe")) {
    674             mr_free(bkpinfo->kernel_path);
    675             mr_asprintf(bkpinfo->kernel_path, "FAILSAFE");
    676         }
    677         if (strcmp(bkpinfo->kernel_path, "FAILSAFE") && !does_file_exist(bkpinfo->kernel_path)) {
     673        if (!does_file_exist(bkpinfo->kernel_path)) {
    678674            retval++;
    679675            log_to_screen("You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2460 r2462  
    27312731                paranoid_fclose(fin);
    27322732            } else {
    2733                 if (does_file_exist("/tmp/mondo-restore.cfg")) {
     2733                if (does_file_exist(MINDI_CACHE"/mondorestore.cfg")) {
    27342734                    mr_free(bkpinfo->media_device);
    2735                     bkpinfo->media_device = read_cfg_var("/tmp/mondo-restore.cfg", "media-dev");
     2735                    bkpinfo->media_device = read_cfg_var(MINDI_CACHE"/mondorestore.cfg", "media-dev");
    27362736                }
    27372737            }
     
    30753075            ("Will you want to verify your backups after Mondo has created them?");
    30763076
    3077 #ifndef __FreeBSD__
    3078         if (!ask_me_yes_or_no
    3079             ("Are you confident that your kernel is a sane, sensible, standard Linux kernel? Say 'no' if you are using a Gentoo <1.4 or Debian <3.0, please."))
    3080 #endif
    3081         {
    3082             mr_free(bkpinfo->kernel_path);
    3083             mr_asprintf(bkpinfo->kernel_path, "FAILSAFE");
    3084         }
    3085 
    30863077        if (!ask_me_yes_or_no
    30873078            ("Are you sure you want to proceed? Hit 'no' to abort.")) {
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2444 r2462  
    322322    mr_free(biggie_fname);
    323323
    324     mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    325     mr_asprintf(tmp, "%ld", curr_set_no);
    326     if (write_one_liner_data_file(outfname, tmp)) {
    327         log_OS_error
    328             ("Unable to echo write one-liner to LAST-FILELIST-NUMBER");
    329         err = 1;
    330     }
     324    mr_asprintf(tmp, "echo 'last-filelist-number %ld' >> "MINDI_CACHE"/mondorestore.cfg", curr_set_no);
     325    paranoid_system(tmp);
    331326    mr_free(tmp);
    332     mr_free(outfname);
    333327
    334328    if (curr_set_no == 0) {
     
    708702    assert(bkpinfo != NULL);
    709703
    710     mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
     704    mr_asprintf(cfg_fname, "%s/mondorestore.cfg", MINDI_CACHE);
    711705    val_sz = read_cfg_var(cfg_fname, "last-filelist-number");
    712706    mr_free(cfg_fname);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2406 r2462  
    705705
    706706/**
    707  * Determine the size (in KB) of @p dev in the mountlist in <tt>tmpdir</tt>/mountlist.txt.
     707 * Determine the size (in KB) of @p dev in the mountlist in mountlist.txt.
    708708 * @param tmpdir The tempdir where the mountlist is stored.
    709709 * @param dev The device to search for.
     
    717717    long file_len_K;
    718718
    719     mr_asprintf(mountlist, "%s/mountlist.txt", tmpdir);
    720     mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);
     719    mr_asprintf(mountlist, "%s/mountlist.txt", MINDI_CACHE);
     720    mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, MINDI_CACHE);
    721721    mr_free(mountlist);
    722722
     
    992992 * Copy the files that Mondo/Mindi need to run to the scratchdir or tempdir.
    993993 * Currently this includes: copy Mondo's home directory to scratchdir,
    994  * copy LAST-FILELIST-NUMBER to scratchdir, copy post-nuke.tgz (if it exists) to tmpdir,
     994 * copy post-nuke.tgz (if it exists) to tmpdir,
    995995 * and run "hostname > scratchdir/HOSTNAME".
    996996 * @param bkpinfo The backup information structure. Fields used:
     
    10201020    if (res) {
    10211021        fatal_error("Failed to copy Mondo's stuff to scratchdir");
    1022     }
    1023 
    1024     mr_asprintf(command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
    1025     res = run_program_and_log_output(command, FALSE);
    1026     mr_free(command);
    1027 
    1028     if (res) {
    1029         fatal_error("Failed to copy LAST-FILELIST-NUMBER to scratchdir");
    10301022    }
    10311023
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2405 r2462  
    856856    (void) getcwd(old_cwd, MAX_STR_LEN);
    857857    chdir(bkpinfo->tmpdir);
    858     mr_asprintf(tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);
     858    mr_asprintf(tmp, "tar -zxf %s ."MINDI_CACHE"/mondorestore.cfg 2> /dev/null", outfname);
    859859    paranoid_system(tmp);
    860860    mr_free(tmp);
    861861
    862     paranoid_system("cp -f tmp/mondo-restore.cfg . 2> /dev/null");
     862    paranoid_system("cp -f ."MINDI_CACHE"/mondorestore.cfg . 2> /dev/null");
    863863    chdir(old_cwd);
    864864    unlink(outfname);
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2444 r2462  
    10711071/**
    10721072 * Retrieve the line containing @p label from the config file.
    1073  * @param config_file The file to read from, usually @c /tmp/mondo-restore.cfg.
     1073 * @param config_file The file to read from, usually @c mondorestore.cfg.
    10741074 * @param label What to read from the file.
    10751075 * @param value Where to put it.
     
    12941294 * Write a line to a configuration file. Writes a line of the form,
    12951295 * @c label @c value.
    1296  * @param config_file The file to write to. Usually @c mondo-restore.cfg.
     1296 * @param config_file The file to write to. Usually @c mondorestore.cfg.
    12971297 * @param label What to call this bit of data you're writing.
    12981298 * @param value The bit of data you're writing.
  • branches/2.2.10/mondo/src/common/mondostructures.h

    r2428 r2462  
    557557
    558558  /**
    559    * Path to the user's kernel, or "FAILSAFE" or "SUCKS" to use the kernel
    560    * included with Mindi.
     559   * Path to the user's kernel included with Mindi.
    561560   */
    562561    char *kernel_path;
  • branches/2.2.10/mondo/src/include/my-stuff.h

    r2420 r2462  
    7474 * The location where mindi media images are stored.
    7575 */
    76 #define MINDI_CACHE "/var/cache/mindi"
     76#define MINDI_CACHE_REL "var/cache/mindi"   /* Should be coherent with mindi */
     77#define MINDI_CACHE "/"MINDI_CACHE_REL
    7778
    7879/**
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

    r2405 r2462  
    15731573    if (pout_to_fdisk) {
    15741574        // mark relevant partition as bootable
    1575         tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy");
     1575        tmp1 = call_program_and_get_last_line_of_output ("make-me-bootable "MINDI_CACHE"/mountlist.txt dummy");
    15761576        mr_asprintf(tmp, "a\n%s\n", tmp1);
    15771577        mr_free(tmp1);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2420 r2462  
    649649    chdir(bkpinfo->restore_path);
    650650
    651     mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
    652     run_program_and_log_output(command, FALSE);
    653     mr_free(command);
    654 
    655651    mvaddstr_and_log_it(g_currentY,
    656652                        0, "Verifying archives against filesystem");
     
    705701    getcwd(dir, MAX_STR_LEN);
    706702    chdir(bkpinfo->restore_path);
    707     mr_asprintf(command, "cp -f /tmp/LAST-FILELIST-NUMBER %s/tmp", bkpinfo->restore_path);
    708     run_program_and_log_output(command, FALSE);
    709     mr_free(command);
    710703
    711704    mvaddstr_and_log_it(g_currentY,
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2451 r2462  
    2626 * The mountlist stub (appended to the directory where all.tar.gz was unpacked).
    2727 */
    28 #define MOUNTLIST_FNAME_STUB "tmp/mountlist.txt"
    29 
    30 /**
    31  * The mondo-restore.cfg stub (appended to the directory where all.tar.gz was unpacked).
     28#define MOUNTLIST_FNAME_STUB MINDI_CACHE_REL"/mountlist.txt"
     29
     30/**
     31 * The mondorestore.cfg stub (appended to the directory where all.tar.gz was unpacked).
    3232 */
    33 #define MONDO_CFG_FILE_STUB "tmp/mondo-restore.cfg"
     33#define MONDO_CFG_FILE_STUB MINDI_CACHE_REL"/mondorestore.cfg"
    3434/**
    3535 * The i-want-my-lvm stub
     
    157157
    158158/**
    159 * Extract @c mondo-restore.cfg and @c mountlist.txt from @p ramdisk_fname.
     159* Extract @c mondorestore.cfg and @c mountlist.txt from @p ramdisk_fname.
    160160* @param bkpinfo The backup information structure. @c tmpdir is the only field used.
    161161* @param ramdisk_fname The filename of the @b compressed ramdisk to look in.
     
    167167
    168168/**
    169 * Keep trying to get mondo-restore.cfg from the archive, until the user gives up.
     169* Keep trying to get mondorestore.cfg from the archive, until the user gives up.
    170170*/
    171171void get_cfg_file_from_archive_or_bust()
     
    678678/**
    679679* Fill out @p bkpinfo based on @p cfg_file.
    680 * @param cfg_file The mondo-restore.cfg file to read into @p bkpinfo.
     680* @param cfg_file The mondorestore.cfg file to read into @p bkpinfo.
    681681* @param bkpinfo The backup information structure to fill out with information
    682682* from @p cfg_file.
     
    15741574        if (!run_program_and_log_output("which grub-MR", FALSE)) {
    15751575            log_msg(1, "Yay! grub-MR found...");
    1576             mr_asprintf(command, "grub-MR %s /tmp/mountlist.txt", boot_device);
     1576            mr_asprintf(command, "grub-MR %s "MINDI_CACHE"/mountlist.txt", boot_device);
    15771577            log_msg(1, "command = %s", command);
    15781578        } else {
     
    18721872    } else {
    18731873        /* nuke mode */
    1874         mr_asprintf(command, "raw-MR %s /tmp/mountlist.txt", boot_device);
     1874        mr_asprintf(command, "raw-MR %s "MINDI_CACHE"/mountlist.txt", boot_device);
    18751875        log_msg(2, "run_raw_mbr() --- command='%s'", command);
    18761876
     
    21282128
    21292129/**
    2130  * Extract mondo-restore.cfg and the mountlist from the tape inserted
     2130 * Extract mondorestore.cfg and the mountlist from the tape inserted
    21312131 * to the ./tmp/ directory.
    21322132 * @param dev The tape device to read from.
     
    22612261            mr_free(tmp);
    22622262
    2263             if (!does_file_exist("tmp/mondo-restore.cfg")) {
     2263            if (!does_file_exist(MINDI_CACHE_REL"/mondorestore.cfg")) {
    22642264                log_to_screen("Cannot find config info on media");
    22652265                return (1);
     
    23452345    }
    23462346
    2347     log_to_screen("Recovered mondo-restore.cfg");
     2347    log_to_screen("Recovered mondorestore.cfg");
    23482348    if (!does_file_exist(MOUNTLIST_FNAME_STUB)) {
    23492349        log_to_screen("...but not mountlist.txt - a pity, really...");
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2405 r2462  
    102102
    103103/**
    104  * The location of 'mondo-restore.cfg', containing the metadata
     104 * The location of 'mondorestore.cfg', containing the metadata
    105105 * information for this backup.
    106106 */
     
    162162    assert(raidlist != NULL);
    163163    if (!bkpinfo->disaster_recovery) {
    164         strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     164        strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt");
    165165        log_msg(2, "I guess you're testing edit_mountlist()");
    166166    }
     
    20742074
    20752075    mvaddstr_and_log_it(g_currentY, 0, "Restoring from archives");
    2076     log_msg(2, "Insisting on 1st CD, so that I can have a look at LAST-FILELIST-NUMBER");
     2076    log_msg(2, "Insisting on 1st CD");
    20772077    if (g_current_media_number != 1) {
    20782078        log_msg(3, "OK, that's jacked up.");
     
    26952695        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    26962696        if (!does_file_exist(g_mountlist_fname)) {
    2697             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2697            strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt");
    26982698        }
    26992699        res = let_user_edit_the_mountlist(mountlist, raidlist);
     
    27952795        log_msg(0, "Partitioning only.");
    27962796        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    2797         strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2797        strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt");
    27982798        load_mountlist(mountlist, g_mountlist_fname);
    27992799        res = partition_everything(mountlist);
     
    28042804        log_msg(0, "Formatting only.");
    28052805        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    2806         strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2806        strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt");
    28072807        load_mountlist(mountlist, g_mountlist_fname);
    28082808        res = format_everything(mountlist, FALSE, raidlist);
     
    28132813        log_msg(0, "Stopping LVM and RAID");
    28142814        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    2815         strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     2815        strcpy(g_mountlist_fname, MINDI_CACHE"/mountlist.txt");
    28162816        load_mountlist(mountlist, g_mountlist_fname);
    28172817        res = do_my_funky_lvm_stuff(TRUE, FALSE);
  • branches/2.2.10/mondo/src/restore-scripts/mondo/format-and-kludge-vfat

    r2186 r2462  
    115115umount /mnt/tmpK || Die "Can't unmount /mnt/tmpK"
    116116
    117 ideal_size=`grep "$device " /tmp/mountlist.txt | tr -s ' ' ' ' | cut -d' ' -f4`
     117ideal_size=`grep "$device " $MINI_CACHE/mountlist.txt | tr -s ' ' ' ' | cut -d' ' -f4`
    118118if [ "$ideal_size" = "" ]; then
    119119    LogIt "format-and-kludge-vfat --- can't find $device in mountlist" 1
  • branches/2.2.10/mondo/src/restore-scripts/mondo/grub-MR

    r2451 r2462  
    9393
    9494if [ "$#" -ne "2" ] ; then
    95     Die "grub-MR <MBR drive> <mountlist filename>; e.g. grub-MR /dev/hda /tmp/mountlist.txt"
     95    Die "grub-MR <MBR drive> <mountlist filename>; e.g. grub-MR /dev/hda $MINDI_CACHE/mountlist.txt"
    9696fi
    9797[ ! -f "$2" ] && Die "mountlist file not found"
  • branches/2.2.10/mondo/src/restore-scripts/mondo/label-partitions-as-necessary

    r2172 r2462  
    5555LogIt "Identifying your drives with tune2fs"
    5656if [ "$#" -ne "1" ] ; then
    57     LogIt "label-partitions-as-necessary /tmp/mountlist.txt < /tmp/fstab.new" 1
     57    LogIt "label-partitions-as-necessary $MINDI_CACHE/mountlist.txt < /tmp/fstab.new" 1
    5858    exit 1
    5959fi
  • branches/2.2.10/mondo/src/restore-scripts/mondo/mount-me

    r680 r2462  
    11#!/bin/sh
    22
    3 mountlist=/tmp/mountlist.txt
     3mountlist=$MINDI_CACHE/mountlist.txt
    44
    55if [ "$#" -ne "0" ] ;then
  • branches/2.2.10/mondo/src/restore-scripts/mondo/stabelilo-me

    r1567 r2462  
    122122
    123123WhatIsFirstDriveCalled() {
    124     cut -d' ' -f1 /tmp/mountlist.txt \
     124    cut -d' ' -f1 $MINDI_CACHE/mountlist.txt \
    125125| sed s/[0-9]// | sed s/[0-9]// \
    126126| sort -u | head -n 1
     
    133133LocateOldFstab
    134134LocateOldElilo
    135 old_mountlist=/tmp/mountlist.original
    136 new_mountlist=/tmp/mountlist.txt
     135old_mountlist=$MINDI_CACHE/mountlist.original
     136new_mountlist=$MINDI_CACHE/mountlist.txt
    137137QuitIfNotFound $old_mountlist
    138138QuitIfNotFound $new_mountlist
  • branches/2.2.10/mondo/src/restore-scripts/mondo/stabgrub-me

    r2451 r2462  
    116116LocateOldFstab
    117117LocateOldGrub
    118 old_mountlist=/tmp/mountlist.original
    119 new_mountlist=/tmp/mountlist.txt
     118old_mountlist=$MINDI_CACHE/mountlist.original
     119new_mountlist=$MINDI_CACHE/mountlist.txt
    120120QuitIfNotFound $old_mountlist
    121121QuitIfNotFound $new_mountlist
  • branches/2.2.10/mondo/src/restore-scripts/mondo/stablilo-me

    r567 r2462  
    9191
    9292WhatIsFirstDriveCalled() {
    93     cut -d' ' -f1 /tmp/mountlist.txt \
     93    cut -d' ' -f1 $MINDI_CACHE/mountlist.txt \
    9494| sed s/[0-9]// | sed s/[0-9]// \
    9595| sort -u | head -n 1
     
    101101LogIt "stablilo-me --- starting"
    102102LocateOldFstab
    103 old_mountlist=/tmp/mountlist.original
    104 new_mountlist=/tmp/mountlist.txt
     103old_mountlist=$MINDI_CACHE/mountlist.original
     104new_mountlist=$MINDI_CACHE/mountlist.txt
    105105QuitIfNotFound $old_mountlist
    106106QuitIfNotFound $new_mountlist
  • branches/2.2.10/mondo/src/restore-scripts/mondo/stabraw-me

    r1315 r2462  
    8282LogIt "stabraw-me --- starting"
    8383LocateOldFstab
    84 old_mountlist=/tmp/mountlist.original
    85 new_mountlist=/tmp/mountlist.txt
     84old_mountlist=$MINDI_CACHE/mountlist.original
     85new_mountlist=$MINDI_CACHE/mountlist.txt
    8686QuitIfNotFound $old_mountlist
    8787QuitIfNotFound $new_mountlist
  • branches/2.2.10/mondo/src/restore-scripts/mondo/unmount-me

    r567 r2462  
    11#!/bin/sh
    22
    3 mountlist=/tmp/mountlist.txt
     3mountlist=$MINDI_CACHE/mountlist.txt
    44
    55if [ "$#" -ne "0" ] ;then
  • branches/2.2.10/mondo/test/test-mountlist.c

    r2421 r2462  
    6868
    6969setup_newt_stuff();
    70 mr_asprintf(g_mountlist_fname, "/tmp/mountlist.txt");
     70mr_asprintf(g_mountlist_fname, MINDI_CACHE"/mountlist.txt");
    7171log_it("before mountlist");
    7272load_mountlist(mountlist, g_mountlist_fname);
Note: See TracChangeset for help on using the changeset viewer.