Ignore:
Timestamp:
Nov 6, 2007, 1:37:38 AM (16 years ago)
Author:
Bruno Cornec
Message:

Continue on configuration file items (compression)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-verify.c

    r1663 r1769  
    4141/**
    4242 * Generate the filename of a tarball to verify.
    43  * @param bkpinfo The backup information structure. @c bkpinfo->zip_suffix is the only field used.
     43 * @param bkpinfo The backup information structure. @c bkpinfo->compression_suffix is the only field used.
    4444 * @param mountpoint The directory where the CD/DVD/ISO is mounted.
    4545 * @param setno The afioball number to get the location of.
     
    5656    assert_string_is_neither_NULL_nor_zerolength(mountpoint);
    5757    sprintf(output, "%s/archives/%d.star.%s", mountpoint, setno,
    58             bkpinfo->zip_suffix);
     58            bkpinfo->compression_suffix);
    5959    if (!does_file_exist(output)) {
    6060        sprintf(output, "%s/archives/%d.afio.%s", mountpoint, setno,
    61                 bkpinfo->zip_suffix);
     61                bkpinfo->compression_suffix);
    6262    }
    6363    return (output);
     
    211211 * - @c compression_level
    212212 * - @c restore_path
    213  * - @c use_lzo
    214  * - @c zip_suffix
     213 * - @c compression_suffix
    215214 * @param mtpt The mountpoint the CD/DVD/ISO is mounted on.
    216215 * @return The number of differences (0 for perfect biggiefiles).
     
    224223    char *mountpoint = NULL;
    225224    char *command = NULL;
    226     char *sz_exe = NULL;
    227225    static char *bufblkA = NULL;
    228226    static char *bufblkB = NULL;
     
    252250    assert(bkpinfo != NULL);
    253251    assert_string_is_neither_NULL_nor_zerolength(mtpt);
    254 
    255     if (bkpinfo->compression_level > 0) {
    256         if (bkpinfo->use_lzo) {
    257             mr_asprintf(&sz_exe, "lzop");
    258         } else if (bkpinfo->use_gzip) {
    259             mr_asprintf(&sz_exe, "gzip");
    260         } else {
    261             mr_asprintf(&sz_exe, "bzip2");
    262         }
    263     } else {
    264         mr_asprintf(&sz_exe, "");
    265     }
    266252
    267253    iamhere("before vsbf");
     
    286272    while (does_file_exist
    287273           (slice_fname
    288             (bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix))
     274            (bigfile_num, slice_num, mountpoint, bkpinfo->compression_suffix))
    289275           ||
    290276           does_file_exist(slice_fname
     
    340326                    g_current_media_number, bigfile_num, slice_num);
    341327            if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) {
    342                 mr_asprintf(&command, "%s -dc %s 2>> %s", sz_exe,
    343                         slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix),
     328                mr_asprintf(&command, "%s -dc %s 2>> %s", bkpinfi->compression_tool,
     329                        slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->compression_suffix),
    344330                        MONDO_LOGFILE);
    345331            } else {
     
    392378    mr_free(tmp);
    393379    mr_free(mountpoint);
    394     mr_free(sz_exe);
    395380
    396381    last_bigfile_num = bigfile_num;
     
    414399 * You should be changed to the root directory (/) for this to work.
    415400 * @param bkpinfo The backup information structure. Fields used:
    416  * - @c bkpinfo->use_lzo
    417401 * - @c bkpinfo->tmpdir
    418  * - @c bkpinfo->zip_exe
    419  * - @c bkpinfo->zip_suffix
     402 * - @c bkpinfo->compression_tool
     403 * - @c bkpinfo->compression_suffix
    420404 * @param tarball_fname The filename of the afioball to verify.
    421405 * @return 0, always.
     
    442426
    443427    mr_asprintf(&outlog, "%s/afio.log", bkpinfo->tmpdir);
    444 
    445     /* if programmer forgot to say which compression thingy to use then find out */
    446     if (strstr(tarball_fname, ".lzo")
    447         && strcmp(bkpinfo->zip_suffix, "lzo")) {
    448         mr_msg(2, "OK, I'm going to start using lzop.");
    449         strcpy(bkpinfo->zip_exe, "lzop");
    450         strcpy(bkpinfo->zip_suffix, "lzo");
    451         bkpinfo->use_lzo = TRUE;
    452         bkpinfo->use_gzip = FALSE;
    453     }
    454     if (strstr(tarball_fname, ".gz")
    455         && strcmp(bkpinfo->zip_suffix, "gz")) {
    456         mr_msg(2, "OK, I'm going to start using gzip.");
    457         strcpy(bkpinfo->zip_exe, "gzip");
    458         strcpy(bkpinfo->zip_suffix, "gz");
    459         bkpinfo->use_lzo = FALSE;
    460         bkpinfo->use_gzip = TRUE;
    461     }
    462     if (strstr(tarball_fname, ".bz2")
    463         && strcmp(bkpinfo->zip_suffix, "bz2")) {
    464         mr_msg(2, "OK, I'm going to start using bzip2.");
    465         strcpy(bkpinfo->zip_exe, "bzip2");
    466         strcpy(bkpinfo->zip_suffix, "bz2");
    467         bkpinfo->use_lzo = FALSE;
    468         bkpinfo->use_gzip = FALSE;
    469     }
    470428    unlink(outlog);
     429
    471430    if (strstr(tarball_fname, ".star")) {
    472431        bkpinfo->use_star = TRUE;
     
    483442        bkpinfo->use_star = FALSE;
    484443        mr_asprintf(&command, "afio -r -P %s -Z %s >> %s 2>> %s",
    485                  bkpinfo->zip_exe, tarball_fname, outlog, outlog);
     444                 bkpinfo->compression_tool, tarball_fname, outlog, outlog);
    486445    }
    487446    mr_msg(6, "command=%s", command);
Note: See TracChangeset for help on using the changeset viewer.