Changeset 2338


Ignore:
Timestamp:
Aug 21, 2009, 1:47:12 AM (10 years ago)
Author:
bruno
Message:
  • Adds LZMA support (Fix #309)
  • Change
Location:
branches/2.2.10
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mindi/mindi

    r2329 r2338  
    912912    use_lzo=$USE_LZO; [ "$use_lzo" = "" ] && use_lzo="no"
    913913    use_gzip=$USE_GZIP; [ "$use_gzip" = "" ] && use_gzip="no"
     914    use_lzma=$USE_LZMA; [ "$use_lzma" = "" ] && use_lzma="no"
    914915    use_comp=$USE_COMP; [ "$use_comp" = "" ] && use_comp="yes"
    915916    use_star=$USE_STAR; [ "$use_star" = "" ] && use_star="no"
    916917    echo "use-lzo $use_lzo" >> $outfile
    917     echo "use-gzip $use_gzip" >> $outfile
     918    echo "use-lzma $use_lzma" >> $outfile
    918919    echo "use-star $use_star" >> $outfile
    919920    echo "use-comp $use_comp" >> $outfile
     
    23942395        [ "$USE_LZO" = "yes" ] && echo -en "Pras 4 Pres 2004" >> $mountpoint/tmp/USING-LZO
    23952396        [ "$USE_GZIP" = "yes" ] && echo -en "YES" >> $mountpoint/tmp/USING-GZIP
     2397        [ "$USE_LZMA" = "yes" ] && echo -en "YES" >> $mountpoint/tmp/USING-LZMA
    23962398        [ "$USE_COMP" = "yes" ] && echo -en "Compression, yep" >> $mountpoint/tmp/USING-COMP
    23972399        [ "$USE_STAR" = "yes" ] && echo -en "Using star. Hooray." >> $mountpoint/tmp/USING-STAR
     
    27572759        DIFFERENTIAL="${19}"
    27582760        USE_GZIP="${20}"
    2759         NOT_BOOT="${21}"
     2761        USE_LZMA="${21}"
     2762        NOT_BOOT="${22}"
    27602763        [ "$USE_COMP" = "" ] && USE_COMP=yes
    27612764        [ "$USE_GZIP" = "" ] && USE_GZIP=no
     2765        [ "$USE_LZMA" = "" ] && USE_LZMA=no
    27622766        [ "$NOT_BOOT" = "" ] && NOT_BOOT=no
    27632767        [ "$TAPEDEV" ] && LogIt "This is a tape-based backup. Fine."
  • branches/2.2.10/mondo/src/common/libmondo-archive.c

    r2334 r2338  
    509509    char *use_lzo_sz = NULL;
    510510    char *use_gzip_sz = NULL;
     511    char *use_lzma_sz = NULL;
    511512    char *use_comp_sz = NULL;
    512513    char *use_star_sz = NULL;
     
    544545    }
    545546
    546     mvaddstr_and_log_it(g_currentY, 0,
    547                         "Calling MINDI to create boot+data disks");
     547    mvaddstr_and_log_it(g_currentY, 0, "Calling MINDI to create boot+data disks");
    548548    mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir);
    549549    if (!does_file_exist(tmp)) {
     
    594594    } else {
    595595        mr_asprintf(use_gzip_sz, "no");
     596    }
     597    if (bkpinfo->use_lzma) {
     598        mr_asprintf(use_lzma_sz, "yes");
     599    } else {
     600        mr_asprintf(use_lzma_sz, "no");
    596601    }
    597602    if (bkpinfo->use_star) {
     
    83584011=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
    836841    mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' '%s' %ld '%s' '%s' '%s' \
    837 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir,    // parameter #2
     842'%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s' >> %s",
     843            tmp2,               // parameter #1
     844            bkpinfo->tmpdir,    // parameter #2
    838845            bkpinfo->scratchdir,    // parameter #3
    839846            bkpinfo->kernel_path,   // parameter #4
     
    843850            use_lzo_sz,         // parameter #8
    844851            cd_recovery_sz,     // parameter #9
    845             bkpinfo->image_devs,    // parameter #10
     852            (bkpinfo->image_devs == NULL) ? "\"\"" : bkpinfo->image_devs,   // parameter #10
    846853            broken_bios_sz,     // parameter #11
    847854            last_filelist_number,   // parameter #12 (STRING)
     
    853860            bkpinfo->internal_tape_block_size,  // parameter #18 (LONG)
    854861            bkpinfo->differential,  // parameter #19 (INT)
    855             use_gzip_sz);       // parameter #20 (STRING)
     862            use_gzip_sz,        // parameter #20 (STRING)
     863            use_lzma_sz,        // parameter #21 (STRING)
     864            MONDO_LOGFILE);
    856865
    857866    mr_free(tmp2);
     
    861870    mr_free(use_lzo_sz);
    862871    mr_free(use_gzip_sz);
     872    mr_free(use_lzma_sz);
    863873    mr_free(use_star_sz);
    864874    mr_free(use_comp_sz);
     
    868878    mr_free(tape_size_sz);
    869879
     880    /* This parameter is always the last one and optional */
    870881    if (bkpinfo->nonbootable_backup) {
    871882        mr_strcat(command, " NONBOOTABLE");
     
    875886//  popup_and_OK("Pausing");
    876887
    877     res = run_program_and_log_to_screen(command, "Generating boot+data disks");
     888    res = run_external_binary_with_percentage_indicator_NEW("Generating boot+data disks", command);
    878889    paranoid_free(command);
    879890
     
    16671678    if (bkpinfo->call_before_iso) {
    16681679        mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
    1669         res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1680        res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, message_to_screen);
    16701681        if (res) {
    16711682            mr_strcat(message_to_screen, "...failed");
     
    16911702        } else {
    16921703            res =
    1693                 eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1704                eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen);
    16941705            if (res) {
    16951706                log_to_screen("%s...failed to write", message_to_screen);
     
    17291740                res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk);
    17301741                if (res) {
    1731                     log_to_screen
    1732                         ("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath...");
    1733                     pause_for_N_seconds(5,
    1734                                         "Letting DVD drive settle... and trying again.");
    1735                     res =
    1736                         run_external_binary_with_percentage_indicator_NEW
    1737                         ("Blanking DVD disk", sz_blank_disk);
     1742                    log_to_screen("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath...");
     1743                    pause_for_N_seconds(5, "Letting DVD drive settle... and trying again.");
     1744                    res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk);
    17381745                    if (res) {
    17391746                        log_to_screen("Format failed a second time.");
     
    17511758                }
    17521759                pause_for_N_seconds(5, "Letting DVD drive settle");
    1753                 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1760                res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, message_to_screen);
    17541761                retval += res;
    17551762                if (!bkpinfo->please_dont_eject) {
     
    17801787            log_msg(1, "Making nonbootable backup");
    17811788// FIXME --- change mkisofs string to MONDO_MKISOFS_NONBOOTABLE and add ' .' at end
    1782             res =
    1783                 eval_call_to_make_ISO("mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .",
    1784                                       destfile, g_current_media_number,
    1785                                       MONDO_LOGFILE, message_to_screen);
     1789            res = eval_call_to_make_ISO("mkisofs -o '_ISO_' -r -p MondoRescue -publisher www.mondorescue.org -A MondoRescue_GPL -V _CD#_ .", destfile, g_current_media_number, message_to_screen);
    17861790        } else {
    17871791            log_msg(1, "Making bootable backup");
     
    18001804#ifdef __IA64__
    18011805                log_msg(1, "IA64 --> elilo");
    1802                 res = eval_call_to_make_ISO("mkisofs -no-emul-boot -b images/mindi-bootroot."
    1803                                             IA64_BOOT_SIZE
    1804                                             ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .",
    1805                                             destfile,
    1806                                             g_current_media_number,
    1807                                             MONDO_LOGFILE,
    1808                                             message_to_screen);
     1806                res = eval_call_to_make_ISO("mkisofs -no-emul-boot -b images/mindi-bootroot." IA64_BOOT_SIZE ".img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", destfile, g_current_media_number, message_to_screen);
    18091807#else
    18101808// FIXME --- change mkisofs string to MONDO_MKISOFS_REGULAR_SYSLINUX/LILO depending on bkpinfo->make_cd_usE_lilo
     
    18121810                log_msg(1, "Non-ia64 --> lilo");
    18131811                res =
    1814                     eval_call_to_make_ISO("mkisofs -b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .",
    1815                                           destfile, g_current_media_number,
    1816                                           MONDO_LOGFILE,
    1817                                           message_to_screen);
     1812                    eval_call_to_make_ISO("mkisofs -b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", destfile, g_current_media_number, message_to_screen);
    18181813#endif
    18191814            } else {
    18201815                log_msg(1, "make_cd_use_lilo = FALSE");
    18211816                log_msg(1, "Isolinux");
    1822                 res =
    1823                     eval_call_to_make_ISO("mkisofs -no-emul-boot -b isolinux.bin -boot-load-size 4 -boot-info-table -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .",
    1824                                           destfile, g_current_media_number,
    1825                                           MONDO_LOGFILE,
    1826                                           message_to_screen);
     1817                res = eval_call_to_make_ISO("mkisofs -no-emul-boot -b isolinux.bin -boot-load-size 4 -boot-info-table -c boot.cat -o '_ISO_' -J -r -p MondoRescue -publisher www.mondorescue.org -A Mondo_Rescue_GPL -V _CD#_ .", destfile, g_current_media_number, message_to_screen);
    18271818            }
    18281819        }
     
    18551846        mr_free(mds);
    18561847        pause_and_ask_for_cdr(2, &cd_is_mountable);
    1857         res = eval_call_to_make_ISO(bkpinfo->call_burn_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1848        res = eval_call_to_make_ISO(bkpinfo->call_burn_iso, destfile, g_current_media_number, message_to_screen);
    18581849        if (res) {
    18591850            mr_strcat(message_to_screen, "...failed");
     
    18711862        mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
    18721863        mr_free(mds);
    1873         res = eval_call_to_make_ISO(bkpinfo->call_after_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1864        res = eval_call_to_make_ISO(bkpinfo->call_after_iso, destfile, g_current_media_number, message_to_screen);
    18741865        if (res) {
    18751866            mr_strcat(message_to_screen, "...failed");
     
    20132004                && is_dev_an_NTFS_dev(bigfile_fname)) {
    20142005                use_ntfsprog = TRUE;
    2015                 log_msg(2,
    2016                         "Calling ntfsclone in background because %s is an NTFS partition",
    2017                         bigfile_fname);
     2006                log_msg(2, "Calling ntfsclone in background because %s is an NTFS partition", bigfile_fname);
    20182007                mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
    20192008                mkfifo(sz_devfile, 0x770);
     
    20242013                    fatal_error("Fork failure");
    20252014                case 0:
    2026                     log_msg(2,
    2027                             "CHILD - fip - calling feed_into_ntfsprog(%s, %s)",
    2028                             bigfile_fname, sz_devfile);
     2015                    log_msg(2, "CHILD - fip - calling feed_into_ntfsprog(%s, %s)", bigfile_fname, sz_devfile);
    20292016                    res = feed_into_ntfsprog(bigfile_fname, sz_devfile);
    2030                     /* BCO/BERLIOS Does the child need to unalocate memory as well ?
    2031                     paranoid_free(bigfile_fname);
     2017                    /* The child needs to unalocate memory as well */
     2018                    mr_free(bigfile_fname);
    20322019                    mr_free(sz_devfile);
    2033                     */
    20342020                    exit(res);
    20352021                    break;
    20362022                default:
    2037                     log_msg(2,
    2038                             "feed_into_ntfsprog() called in background --- pid=%ld",
    2039                             (long int) (pid));
     2023                    log_msg(2, "feed_into_ntfsprog() called in background --- pid=%ld", (long int) (pid));
    20402024                    mr_free(sz_devfile);
    20412025                }
     
    20532037                                             BLK_START_A_NORMBIGGIE);
    20542038            }
    2055             res =
    2056                 slice_up_file_etc(bigfile_fname,
    2057                                   ntfsprog_fifo, biggie_file_number,
    2058                                   noof_biggie_files, use_ntfsprog);
     2039            res = slice_up_file_etc(bigfile_fname, ntfsprog_fifo, biggie_file_number, noof_biggie_files, use_ntfsprog);
    20592040            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2060                 write_header_block_to_stream((off_t)0,
    2061                                              calc_checksum_of_file
    2062                                              (bigfile_fname),
    2063                                              BLK_STOP_A_BIGGIE);
     2041                write_header_block_to_stream((off_t)0, calc_checksum_of_file(bigfile_fname), BLK_STOP_A_BIGGIE);
    20642042            }
    20652043            retval += res;
     
    28202798 */
    28212799int
    2822 slice_up_file_etc(char *biggie_filename,
    2823                   char *ntfsprog_fifo, long biggie_file_number,
    2824                   long noof_biggie_files, bool use_ntfsprog)
    2825 {
     2800slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, long noof_biggie_files, bool use_ntfsprog) {
    28262801
    28272802    /*@ buffers ************************************************** */
    28282803    char *tmp = NULL;
    28292804    char *checksum_line = NULL;
    2830     char *command;
     2805    char *command = NULL;
    28312806    char *tempblock;
    28322807    char *curr_slice_fname_uncompressed = NULL;
    28332808    char *curr_slice_fname_compressed = NULL;
    28342809    char *file_to_archive = NULL;
    2835     char *file_to_openin;
     2810    char *file_to_openin = NULL;
    28362811    /*@ pointers ************************************************** */
    2837     char *pB;
    2838     FILE *fin = NULL, *fout = NULL;
     2812    char *pB = NULL;
     2813    FILE *fin = NULL;
     2814    FILE *fout = NULL;
    28392815
    28402816    /*@ bool ****************************************************** */
     
    28422818
    28432819    /*@ long ****************************************************** */
    2844     size_t blksize = 0;
    2845     long slice_num = 0;
    2846     long i;
    2847     long optimal_set_size;
    2848     bool should_I_compress_slices;
     2820    size_t blksize = (size_t)0;
     2821    long slice_num = 0L;
     2822    long i = 0L;
     2823    bool should_I_compress_slices = TRUE;
    28492824    char *suffix = NULL;                // for compressed slices
    28502825
     
    28522827    off_t totalread = (off_t)0;
    28532828    off_t totallength = (off_t)0;
    2854     off_t length;
    28552829
    28562830    /*@ int ******************************************************** */
     
    28602834    /*@ structures ************************************************** */
    28612835    struct s_filename_and_lstat_info biggiestruct;
    2862 //  struct stat statbuf;
    28632836
    28642837    assert(bkpinfo != NULL);
     
    28672840    biggiestruct.for_backward_compatibility = '\n';
    28682841    biggiestruct.use_ntfsprog = use_ntfsprog;
    2869     optimal_set_size = bkpinfo->optimal_set_size;
    28702842    if (is_this_file_compressed(biggie_filename) || bkpinfo->compression_level == 0) {
    28712843        mr_asprintf(suffix, "%s", "");
     
    28762848    }
    28772849
    2878     if (optimal_set_size < 999) {
     2850    if (bkpinfo->optimal_set_size < 999L) {
    28792851        fatal_error("bkpinfo->optimal_set_size is insanely small");
    28802852    }
     2853
    28812854    if (ntfsprog_fifo) {
    28822855        file_to_openin = ntfsprog_fifo;
     
    28962869        log_it("res of it = %s", tmp);
    28972870        totallength = (off_t)atoll(tmp);
    2898         paranoid_free(tmp);
     2871        mr_free(tmp);
    28992872    } else {
    29002873        file_to_openin = biggie_filename;
     
    29302903    if (fout == NULL) {
    29312904        log_msg(1, "Unable to open and write to %s\n", tmp);
    2932         paranoid_free(tmp);
     2905        mr_free(tmp);
    29332906        mr_free(suffix);
    29342907        return (1);
    29352908    }
    2936     paranoid_free(tmp);
     2909    mr_free(tmp);
    29372910
    29382911    (void) fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout);
    2939     if (fout) {
    2940         paranoid_fclose(fout);
    2941     }
    2942     length = totallength / optimal_set_size / 1024;
    2943     log_msg(1, "Opening in %s; slicing it and writing to CD/tape",
    2944             file_to_openin);
     2912    fclose(fout);
     2913
     2914    log_msg(1, "Opening in %s; slicing it and writing to CD/tape", file_to_openin);
    29452915    if (!(fin = fopen(file_to_openin, "r"))) {
    29462916        log_OS_error("Unable to openin biggie_filename");
     
    29602930    }
    29612931    i = bkpinfo->optimal_set_size / 256;
    2962     if (!(tempblock = (char *) malloc(256 * 1024))) {
    2963         fatal_error("malloc error 256*1024");
    2964     }
    29652932    for (slice_num = 1; !finished; slice_num++) {
    29662933        mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
     
    29772944            return (1);
    29782945        }
    2979         if ((i == bkpinfo->optimal_set_size / 256)
    2980             && (totalread < 1.1 * totallength)) {
    2981             for (i = 0; i < bkpinfo->optimal_set_size / 256; i++) {
     2946        if ((i == bkpinfo->optimal_set_size / 256) && (totalread < 1.1 * totallength)) {
     2947            tempblock = mr_malloc(256 * 1024);
     2948            for (i = 0L; i < bkpinfo->optimal_set_size / 256; i++) {
    29822949                blksize = fread(tempblock, 1, 256 * 1024, fin);
    29832950                if (blksize > 0) {
     
    29882955                }
    29892956            }
     2957            mr_free(tempblock);
    29902958        } else {
    2991             i = 0;
    2992         }
    2993         paranoid_fclose(fout);
    2994         if (i > 0)              // length_of_file (curr_slice_fname_uncompressed)
     2959            i = 0L;
     2960        }
     2961        fclose(fout);
     2962        if (i > 0L)             // length_of_file (curr_slice_fname_uncompressed)
    29952963        {
    29962964            if (!does_file_exist(curr_slice_fname_uncompressed)) {
    2997                 log_msg(2,
    2998                         "Warning - '%s' doesn't exist. How can I compress slice?",
    2999                         curr_slice_fname_uncompressed);
     2965                log_msg(2, "Warning - '%s' doesn't exist. How can I compress slice?", curr_slice_fname_uncompressed);
    30002966            }
    30012967            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
     
    30172983                log_msg(2, "Failed to compress the slice");
    30182984            }
    3019             if (bkpinfo->use_lzo
    3020                 && strcmp(curr_slice_fname_compressed,
    3021                           curr_slice_fname_uncompressed)) {
     2985            if (bkpinfo->use_lzo && strcmp(curr_slice_fname_compressed, curr_slice_fname_uncompressed)) {
    30222986                unlink(curr_slice_fname_uncompressed);
    30232987            }
     
    30373001            log_msg(2, tmp);
    30383002#endif
    3039             paranoid_free(tmp);
     3003            mr_free(tmp);
    30403004
    30413005            mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed);
     
    30533017
    30543018        if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    3055             register_in_tape_catalog(biggieslice, biggie_file_number,
    3056                                      slice_num, file_to_archive);
     3019            register_in_tape_catalog(biggieslice, biggie_file_number, slice_num, file_to_archive);
    30573020            maintain_collection_of_recent_archives(file_to_archive);
    30583021            res = move_files_to_stream(file_to_archive, NULL);
     
    30683031        }
    30693032    }
    3070     mr_free(tempblock);
    30713033    mr_free(suffix);
    30723034    paranoid_fclose(fin);
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2334 r2338  
    100100        bkpinfo->media_size[j] = 650;
    101101    }                           /* default */
    102     res =
    103         retrieve_switches_from_command_line(argc, argv, flag_val,
    104                                             flag_set);
     102    res = retrieve_switches_from_command_line(argc, argv, flag_val, flag_set);
    105103    retval += res;
    106104    if (!retval) {
     
    807805        }
    808806        if (bkpinfo->include_paths != NULL) {
     807            mr_strip_spaces(bkpinfo->include_paths);
    809808            log_msg(1, "include_paths is now '%s'", bkpinfo->include_paths);
    810809        }
    811810        if (bkpinfo->exclude_paths != NULL) {
     811            mr_strip_spaces(bkpinfo->exclude_paths);
    812812            log_msg(1, "exclude_paths is now '%s'", bkpinfo->exclude_paths);
    813813        }
     
    815815    }
    816816
    817     if (g_kernel_version >= 2.6 && !flag_set['d']
    818         && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) {
    819         fatal_error
    820             ("If you are using the 2.6.x kernel, please specify the CD-R(W) device.");
     817    if (g_kernel_version >= 2.6 && !flag_set['d'] && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) {
     818        fatal_error("If you are using the 2.6.x kernel, please specify the CD-R(W) device.");
    821819    }
    822820
     
    825823        if (flag_set['I']) {
    826824            retval++;
    827             log_to_screen
    828                 ("Please do not use -J in combination with -I. If you want to make a list of files to backup, that's fine, use -J <filename> but please don't muddy the waters by combining -J with -I. Thanks. :-)");
     825            log_to_screen("Please do not use -J in combination with -I. If you want to make a list of files to backup, that's fine, use -J <filename> but please don't muddy the waters by combining -J with -I. Thanks. :-)");
    829826        }
    830827        bkpinfo->make_filelist = FALSE;
     
    833830
    834831    if ((flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) && (! bkpinfo->restore_data)) {
    835         if (!flag_set['r'] && g_kernel_version <= 2.5
    836             && strstr(flag_val['d'], "/dev/")) {
    837             fatal_error
    838                 ("Please don't give a /dev entry. Give a SCSI node for the parameter of the -d flag.");
    839         }
    840         if (flag_set['r'] && g_kernel_version <= 2.5
    841             && !strstr(flag_val['d'], "/dev/")) {
    842             fatal_error
    843                 ("Please give a /dev entry, not a SCSI node, as the parameter of the -d flag.");
     832        if (!flag_set['r'] && g_kernel_version <= 2.5 && strstr(flag_val['d'], "/dev/")) {
     833            fatal_error("Please don't give a /dev entry. Give a SCSI node for the parameter of the -d flag.");
     834        }
     835        if (flag_set['r'] && g_kernel_version <= 2.5 && !strstr(flag_val['d'], "/dev/")) {
     836            fatal_error("Please give a /dev entry, not a SCSI node, as the parameter of the -d flag.");
    844837        }
    845838        if (g_kernel_version >= 2.6 && !strstr(flag_val['d'], "/dev/")) {
    846             log_to_screen
    847                 ("Linus says 2.6 has a broken ide-scsi module. Proceed at your own risk...");
    848         }
    849 
    850         if (system("which cdrecord > /dev/null 2> /dev/null")
    851             && system("which dvdrecord > /dev/null 2> /dev/null")) {
    852             fatal_error
    853                 ("Please install dvdrecord/cdrecord and try again.");
     839            log_to_screen("Linus says 2.6 has a broken ide-scsi module. Proceed at your own risk...");
     840        }
     841
     842        if (system("which cdrecord > /dev/null 2> /dev/null") && system("which dvdrecord > /dev/null 2> /dev/null")) {
     843            fatal_error("Please install dvdrecord/cdrecord and try again.");
    854844        }
    855845        if (flag_set['C']) {
    856846            bkpinfo->cdrw_speed = atoi(flag_val['C']);
    857847            if (bkpinfo->cdrw_speed < 1) {
    858                 fatal_error
    859                     ("You specified a silly speed for a CD-R[W] drive");
     848                fatal_error("You specified a silly speed for a CD-R[W] drive");
    860849            }
    861850            if (!flag_set['L']) {
    862                 log_to_screen
    863                     ("You must use -L with -C. Therefore I am setting it for you.");
     851                log_to_screen("You must use -L with -C. Therefore I am setting it for you.");
    864852                flag_set['L'] = 1;
    865853                flag_val['L'][0] = '\0';
     
    868856            log_msg(3, "flag_val['c'] = %s", flag_val['c']);
    869857            log_msg(3, "flag_val['w'] = %s", flag_val['w']);
    870             // log_msg(3, "flag_set['r'] = %i", flag_set['r'] );
    871858            if (flag_set['c']) {
    872859                bkpinfo->cdrw_speed = atoi(flag_val['c']);
     
    878865
    879866            if (bkpinfo->cdrw_speed < 1) {
    880                 fatal_error
    881                     ("You specified a silly speed for a CD-R[W] drive");
     867                fatal_error("You specified a silly speed for a CD-R[W] drive");
    882868            }
    883869        }
     
    901887    {
    902888        if (! flag_set['d']) {
    903             fatal_error
    904                 ("You need to specify a device file with -d for bootable USB device usage");
     889            fatal_error("You need to specify a device file with -d for bootable USB device usage");
    905890        }
    906891        if ((!flag_set['s']) && (! bkpinfo->restore_data)) {
     
    912897    {
    913898        if (flag_set['m']) {
    914             fatal_error
    915                 ("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m.");
     899            fatal_error("Manual CD tray (-m) not yet supported in conjunction w/ DVD drives. Drop -m.");
    916900        }
    917901        if (!flag_set['d']) {
     
    957941            if (flag_set['s']) {
    958942                if (flag_set['t']) {
    959                     fatal_error
    960                         ("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway.");
     943                    fatal_error("For the moment, please don't specify a tape size. Mondo should handle end-of-tape gracefully anyway.");
    961944                }
    962945                if (process_the_s_switch(flag_val['s'])) {
     
    11751158        log_msg(1, "Internal tape block size is now %ld bytes", itbs);
    11761159        if (itbs % 512 != 0 || itbs < 256 || itbs > 1024L * 1024) {
    1177             fatal_error
    1178                 ("Are you nuts? Silly, your internal tape block size is. Abort, I shall.");
     1160            fatal_error("Are you nuts? Silly, your internal tape block size is. Abort, I shall.");
    11791161        }
    11801162        bkpinfo->internal_tape_block_size = itbs;
     
    11851167//      bkpinfo->differential = atoi (flag_val['D']);
    11861168        if ((bkpinfo->differential < 1) || (bkpinfo->differential > 9)) {
    1187             fatal_error
    1188                 ("The D option should be between 1 and 9 inclusive");
     1169            fatal_error("The D option should be between 1 and 9 inclusive");
    11891170        }
    11901171    }
     
    12791260        retval++;
    12801261        log_to_screen("Please specify the backup device/directory.\n");
    1281         fatal_error
    1282             ("You didn't use -d to specify the backup device/directory.");
     1262        fatal_error("You didn't use -d to specify the backup device/directory.");
    12831263    }
    12841264
     
    13651345        if (run_program_and_log_output("which lzop", 2)) {
    13661346            retval++;
    1367             log_to_screen
    1368                 ("Please install LZOP. You can't use '-L' until you do.\n");
     1347            log_to_screen("Please install LZOP. You can't use '-L' until you do.\n");
    13691348        }
    13701349    }
     
    13741353        if (run_program_and_log_output("which gzip", 2)) {
    13751354            retval++;
    1376             log_to_screen
    1377                 ("Please install gzip. You can't use '-G' until you do.\n");
     1355            log_to_screen("Please install gzip. You can't use '-G' until you do.\n");
     1356        }
     1357    }
     1358
     1359    if ((flag_set['Y']) && (! bkpinfo->restore_data)) {
     1360        bkpinfo->use_lzma = TRUE;
     1361        if (run_program_and_log_output("which lzma", 2)) {
     1362            retval++;
     1363            log_to_screen("Please install lzma. You can't use '-Y' until you do.\n");
    13781364        }
    13791365    }
     
    13911377    if ((!is_this_a_valid_disk_format("vfat")) && (! bkpinfo->restore_data)) {
    13921378        bkpinfo->make_cd_use_lilo = TRUE;
    1393         log_to_screen
    1394             ("Your kernel appears not to support vfat filesystems. I am therefore");
    1395         log_to_screen
    1396             ("using LILO instead of SYSLINUX as the media boot loader.");
     1379        log_to_screen("Your kernel appears not to support vfat filesystems. I am therefore");
     1380        log_to_screen("using LILO instead of SYSLINUX as the media boot loader.");
    13971381    }
    13981382    if ((run_program_and_log_output("which mkfs.vfat", 2)) && (! bkpinfo->restore_data)) {
    13991383        bkpinfo->make_cd_use_lilo = TRUE;
    14001384#ifdef __IA32__
    1401         log_to_screen
    1402             ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
    1403         log_to_screen
    1404             ("your boot loader. I shall therefore use LILO instead.");
     1385        log_to_screen("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
     1386        log_to_screen("your boot loader. I shall therefore use LILO instead.");
    14051387#endif
    14061388#ifdef __IA64__
    1407         log_to_screen
    1408             ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
     1389        log_to_screen("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
    14091390        log_to_screen("environment correctly. Please install it.");
    14101391        fatal_error("Aborting");
     
    14261407
    14271408    if ((! bkpinfo->restore_data) && (flag_set['Z'])) {
    1428             fatal_error
    1429                 ("The -Z switch is only valid in restore mode");
     1409            fatal_error("The -Z switch is only valid in restore mode");
    14301410    }
    14311411
     
    14661446 * @return The number of problems with the command line (0 for success).
    14671447 */
    1468 int
    1469 retrieve_switches_from_command_line(int argc, char *argv[],
    1470                                     char flag_val[128][MAX_STR_LEN],
    1471                                     bool flag_set[128])
     1448int retrieve_switches_from_command_line(int argc, char *argv[], char flag_val[128][MAX_STR_LEN], bool flag_set[128])
    14721449{
    14731450    /*@ ints ** */
     
    14861463        flag_set[i] = FALSE;
    14871464    }
    1488     while ((opt =
    1489             getopt(argc, argv, MONDO_OPTIONS))
    1490            != -1) {
     1465    while ((opt = getopt(argc, argv, MONDO_OPTIONS)) != -1) {
    14911466        if (opt == '?') {
    14921467            bad_switches = TRUE;
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2334 r2338  
    422422    char *command = NULL;
    423423    /*@ pointers **************************************************** */
    424     char *p;
     424    char *p = NULL;
    425425
    426426    /*@ int's ******************************************************* */
    427     int i;
    428 
    429     for (i = NOOF_ERR_LINES - 1;
    430          i >= 0 && !strstr(err_log_lines[i], "% Done")
    431          && !strstr(err_log_lines[i], "% done"); i--);
     427    int i = 0;
     428
     429    for (i = NOOF_ERR_LINES - 1; i >= 0 && !strstr(err_log_lines[i], "% Done") && !strstr(err_log_lines[i], "% done"); i--);
    432430    if (i < 0) {
    433431        mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');
     
    445443    if (p) {
    446444        *p = '\0';
    447     }
    448     if (!p) {
     445    } else {
    449446        mr_free(lastline);
    450447        return (0);
    451448    }
    452     *p = '\0';
    453     for (p--; *p != ' ' && p != lastline; p--);
     449
     450    for (p--; isdigit(p) && p != lastline; p--);
    454451    if (p != lastline) {
    455452        p++;
    456453    }
     454    i = atoi(p);
    457455    mr_free(lastline);
    458 
    459     i = atoi(p);
    460456    return (i);
    461457}
     
    12141210 * @param bkpinfo The backup information structure. Fields used:
    12151211 * - @c bkpinfo->backup_media_type
    1216  * - @c bkpinfo->image_devs
    12171212 * - @c bkpinfo->media_size
    12181213 * - @c bkpinfo->optimal_set_size
     
    12451240        scratchLL = (scratchLL * 2) / 3;
    12461241    } else if (bkpinfo->use_gzip) {
     1242        scratchLL = (scratchLL * 2) / 3;
     1243    } else if (bkpinfo->use_lzma) {
    12471244        scratchLL = (scratchLL * 2) / 3;
    12481245    } else {
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2334 r2338  
    469469        mr_asprintf(bkpinfo->zip_exe, "gzip");
    470470        mr_asprintf(bkpinfo->zip_suffix, "gz");
     471    } else if (bkpinfo->use_lzma) {
     472        mr_asprintf(bkpinfo->zip_exe, "lzma");
     473        mr_asprintf(bkpinfo->zip_suffix, "lzma");
    471474    } else if (bkpinfo->compression_level != 0) {
    472475        mr_asprintf(bkpinfo->zip_exe, "bzip2");
     
    723726    if (bkpinfo->disaster_recovery) {
    724727        if (!does_nonMS_partition_exist()) {
    725             fatal_error
    726                 ("I am in disaster recovery mode\nPlease don't run mondoarchive.");
     728            fatal_error("I am in disaster recovery mode\nPlease don't run mondoarchive.");
    727729        }
    728730    }
     
    733735    paranoid_free(tmp);
    734736    if (find_and_store_mondoarchives_home(g_mondo_home)) {
    735         fprintf(stderr,
    736                 "Cannot find Mondo's homedir. I think you have >1 'mondo' directory on your hard disk. Please delete the superfluous 'mondo' directories and try again\n");
     737        fprintf(stderr, "Cannot find Mondo's homedir. I think you have >1 'mondo' directory on your hard disk. Please delete the superfluous 'mondo' directories and try again\n");
    737738        res++;
    738739        return (res);
     
    783784void mr_free_bkpinfo() {
    784785
     786    log_msg(1, "Freeing bkpinfo");
    785787    mr_free(bkpinfo->media_device);
    786788    mr_free(bkpinfo->boot_device);
     
    816818{
    817819    int i;
    818     log_msg(1, "Hi");
     820    log_msg(1, "Initializing bkpinfo");
     821    bkpinfo = (struct s_bkpinfo *)mr_malloc(sizeof(struct s_bkpinfo));
    819822
    820823    /* Initialized in same order as in the structure declaration to detect errors more easily */
     
    831834    bkpinfo->use_lzo = FALSE;
    832835    bkpinfo->use_gzip = FALSE;
     836    bkpinfo->use_lzma = FALSE;
    833837    bkpinfo->verify_data = FALSE;
    834838    bkpinfo->backup_data = FALSE;
     
    937941    if (system("which mkfs.vfat 2> /dev/null 1> /dev/null")
    938942        && !system("which mkfs.msdos 2> /dev/null 1> /dev/null")) {
    939         log_it
    940             ("OK, you've got mkfs.msdos but not mkfs.vfat; time for the fairy to wave her magic wand...");
    941         run_program_and_log_output
    942             ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
     943        log_it("OK, you've got mkfs.msdos but not mkfs.vfat; time for the fairy to wave her magic wand...");
     944        run_program_and_log_output("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
    943945    }
    944946    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     
    13461348 * information to the logfile.
    13471349 */
    1348 void standard_log_debug_msg(int debug_level, const char *szFile,
    1349                             const char *szFunction, int nLine,
    1350                             const char *fmt, ...)
    1351 {
     1350void standard_log_debug_msg(int debug_level, const char *szFile, const char *szFunction, int nLine, const char *fmt, ...) {
     1351
    13521352    va_list args;
    1353     int i;
    13541353    static int depth = 0;
    13551354    FILE *fout;
     
    13681367        // add tabs to distinguish log levels
    13691368        if (debug_level > 0) {
    1370             for (i = 1; i < debug_level; i++)
    1371                 fprintf(fout, "\t");
     1369            fprintf(fout, "DBG%d: ", debug_level);
    13721370            if (getpid() == g_main_pid)
    13731371                fprintf(fout, "[Main] %s->%s#%d: ", szFile, szFunction, nLine);
     
    13761374            else
    13771375                fprintf(fout, "[TH=%d] %s->%s#%d: ", getpid(), szFile, szFunction, nLine);
     1376        } else {
     1377            fprintf(fout, "INFO: ");
    13781378        }
    13791379        va_start(args, fmt);
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2334 r2338  
    254254        } else if (bkpinfo->use_gzip) {
    255255            mr_asprintf(sz_exe, "gzip");
     256        } else if (bkpinfo->use_lzma) {
     257            mr_asprintf(sz_exe, "lzma");
    256258        } else {
    257259            mr_asprintf(sz_exe, "bzip2");
     
    435437        bkpinfo->use_lzo = TRUE;
    436438        bkpinfo->use_gzip = FALSE;
     439        bkpinfo->use_lzma = FALSE;
    437440    }
    438441    if (strstr(tarball_fname, ".gz") && strcmp(bkpinfo->zip_suffix, "gz")) {
     
    444447        bkpinfo->use_lzo = FALSE;
    445448        bkpinfo->use_gzip = TRUE;
     449        bkpinfo->use_lzma = FALSE;
    446450    }
    447451    if (strstr(tarball_fname, ".bz2") && strcmp(bkpinfo->zip_suffix, "bz2")) {
     
    453457        bkpinfo->use_lzo = FALSE;
    454458        bkpinfo->use_gzip = FALSE;
     459        bkpinfo->use_lzma = FALSE;
     460    }
     461    if (strstr(tarball_fname, ".lzma") && strcmp(bkpinfo->zip_suffix, "lzma")) {
     462        log_msg(2, "OK, I'm going to start using lzma.");
     463        mr_free(bkpinfo->zip_exe);
     464        mr_asprintf(bkpinfo->zip_exe, "lzma");
     465        mr_free(bkpinfo->zip_suffix);
     466        mr_asprintf(bkpinfo->zip_suffix, "lzma");
     467        bkpinfo->use_lzo = FALSE;
     468        bkpinfo->use_gzip = FALSE;
     469        bkpinfo->use_lzma = TRUE;
    455470    }
    456471    if (bkpinfo->zip_exe == NULL) {
  • branches/2.2.10/mondo/src/common/mondostructures.h

    r2328 r2338  
    380380  /**
    381381   * The extension your compression program uses. lzop uses lzo, bzip uses
    382    * bz2, gzip uses gz, etc. Do not include the dot.
     382   * bz2, gzip uses gz, lzma uses lzma etc. Do not include the dot.
    383383   */
    384384    char *zip_suffix;
     
    419419   */
    420420    bool use_gzip;
     421
     422/**
     423   * If TRUE, then use @c lzma to compress data.
     424   * This is used mainly in estimates. The backup/restore may or may
     425   * not work if you do not set this. You should also set @p zip_exe
     426   * and @p zip_suffix.
     427   */
     428    bool use_lzma;
    421429
    422430  /**
  • branches/2.2.10/mondo/src/do-not-compress-these

    r30 r2338  
    6868.LZh
    6969.LZH
     70.lzma
    7071.lzo
    7172.lzop
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2334 r2338  
    253253    if (strstr(tarball_fname, ".bz2")) {
    254254        mr_asprintf(compressor_exe, "bzip2");
     255    } else if (strstr(tarball_fname, ".lzma")) {
     256        mr_asprintf(compressor_exe, "lzma");
    255257    } else if (strstr(tarball_fname, ".gz")) {
    256258        mr_asprintf(compressor_exe, "gzip");
     
    384386            mr_free(tarball_fname);
    385387            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzo", current_tarball_number);
     388        }
     389        if (!does_file_exist(tarball_fname)) {
     390            mr_free(tarball_fname);
     391            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%d.afio.lzma", current_tarball_number);
    386392        }
    387393        if (!does_file_exist(tarball_fname)) {
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2334 r2338  
    897897mr_free(value);
    898898
     899value = read_cfg_var(cfg_file, "use-lzma");
     900if (value && strstr(value, "yes")) {
     901    bkpinfo->use_lzma = TRUE;
     902    bkpinfo->use_lzo = FALSE;
     903    bkpinfo->use_gzip = FALSE;
     904    mr_free(bkpinfo->zip_exe);
     905    mr_asprintf(bkpinfo->zip_exe, "lzma");
     906    mr_free(bkpinfo->zip_suffix);
     907    mr_asprintf(bkpinfo->zip_suffix, "lzma");
     908}
     909mr_free(value);
     910
    899911value = read_cfg_var(cfg_file, "use-lzo");
    900912if (value && strstr(value, "yes")) {
     913    bkpinfo->use_lzma = FALSE;
    901914    bkpinfo->use_lzo = TRUE;
    902915    bkpinfo->use_gzip = FALSE;
     
    910923value = read_cfg_var(cfg_file, "use-gzip");
    911924if (value && strstr(value, "yes")) {
     925    bkpinfo->use_lzma = FALSE;
    912926    bkpinfo->use_lzo = FALSE;
    913927    bkpinfo->use_gzip = TRUE;
     
    921935value = read_cfg_var(cfg_file, "use-comp");
    922936if (value && strstr(value, "yes")) {
     937    bkpinfo->use_lzma = FALSE;
    923938    bkpinfo->use_lzo = FALSE;
    924939    bkpinfo->use_gzip = FALSE;
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2334 r2338  
    11561156            !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzo")) &&
    11571157            !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "gz")) &&
     1158            !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzma")) &&
    11581159            !does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) {
    11591160            log_msg(3, "Cannot find a data slice or terminator slice on CD %d", g_current_media_number);
     
    11831184                    mr_asprintf(suffix, "gz");
    11841185                } else
     1186                    if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "lzma"))) {
     1187                    mr_asprintf(bzip2_command, "lzma");
     1188                    mr_asprintf(suffix, "lzma");
     1189                } else
    11851190                    if (does_file_exist(slice_fname(bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) {
    11861191                    mr_asprintf(bzip2_command, "bzip2");
     
    15981603        if (strstr(tarball_fname, ".bz2")) {
    15991604            mr_asprintf(executable, "bzip2");
     1605        } else if (strstr(tarball_fname, ".lzma")) {
     1606            mr_asprintf(executable, "lzma");
    16001607        } else if (strstr(tarball_fname, ".gz")) {
    16011608            mr_asprintf(executable, "gzip");
     
    20992106        if (!does_file_exist(tarball_fname)) {
    21002107            mr_free(tarball_fname);
     2108            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzma", current_tarball_number);
     2109        }
     2110        if (!does_file_exist(tarball_fname)) {
     2111            mr_free(tarball_fname);
    21012112            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);
    21022113        }
Note: See TracChangeset for help on using the changeset viewer.