Ignore:
Timestamp:
Jan 11, 2006, 10:10:31 AM (18 years ago)
Author:
andree
Message:

Replaced partimagehack with ntfsclone from ntfsprogs package. Replaced
all occurrences of strings 'partimagehack' and 'partimage' with 'ntfsprog'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.06/mondo/mondo/mondorestore/mondo-restore.c

    r273 r296  
    13651365  /** malloc ***/
    13661366    char *checksum, *outfile_fname, *tmp, *bzip2_command,
    1367         *partimagehack_command, *suffix, *sz_devfile;
     1367        *ntfsprog_command, *suffix, *sz_devfile;
    13681368    char *bigblk;
    13691369    char *p;
     
    13721372    long sliceno;
    13731373    long siz;
    1374     char partimagehack_fifo[MAX_STR_LEN];
     1374    char ntfsprog_fifo[MAX_STR_LEN];
    13751375    char *file_to_openout = NULL;
    13761376    struct s_filename_and_lstat_info biggiestruct;
    13771377    struct utimbuf the_utime_buf, *ubuf;
    1378     bool use_partimage_hack = FALSE;
     1378    bool use_ntfsprog_hack = FALSE;
    13791379    pid_t pid;
    13801380    int res = 0;
     
    13911391    malloc_string(tmp);
    13921392    malloc_string(bzip2_command);
    1393     malloc_string(partimagehack_command);
     1393    malloc_string(ntfsprog_command);
    13941394    malloc_string(suffix);
    13951395    malloc_string(sz_devfile);
     
    14481448
    14491449    log_msg(1, "DEFINITELY restoring %s", biggiestruct.filename);
    1450     if (biggiestruct.use_partimagehack) {
     1450    if (biggiestruct.use_ntfsprog) {
    14511451        if (strncmp(biggiestruct.filename, "/dev/", 5)) {
    14521452            log_msg(1,
    1453                     "I was in error when I set biggiestruct.use_partimagehack to TRUE.");
     1453                    "I was in error when I set biggiestruct.use_ntfsprog to TRUE.");
    14541454            log_msg(1, "%s isn't even in /dev", biggiestruct.filename);
    1455             biggiestruct.use_partimagehack = FALSE;
    1456         }
    1457     }
    1458 
    1459     if (biggiestruct.use_partimagehack) // if it's an NTFS device
     1455            biggiestruct.use_ntfsprog = FALSE;
     1456        }
     1457    }
     1458
     1459    if (biggiestruct.use_ntfsprog)  // if it's an NTFS device
    14601460//  if (!strncmp ( biggiestruct.filename, "/dev/", 5))
    14611461    {
    14621462        g_loglevel = 4;
    1463         use_partimage_hack = TRUE;
     1463        use_ntfsprog_hack = TRUE;
    14641464        log_msg(2,
    1465                 "Calling partimagehack in background because %s is an NTFS /dev entry",
     1465                "Calling ntfsclone in background because %s is an NTFS /dev entry",
    14661466                outfile_fname);
    14671467        sprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    14681468                (int) (random() % 32768));
    14691469        mkfifo(sz_devfile, 0x770);
    1470         strcpy(partimagehack_fifo, sz_devfile);
    1471         file_to_openout = partimagehack_fifo;
     1470        strcpy(ntfsprog_fifo, sz_devfile);
     1471        file_to_openout = ntfsprog_fifo;
    14721472        switch (pid = fork()) {
    14731473        case -1:
     
    14751475        case 0:
    14761476            log_msg(3,
    1477                     "CHILD - fip - calling feed_outfrom_partimage(%s, %s)",
    1478                     biggiestruct.filename, partimagehack_fifo);
     1477                    "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)",
     1478                    biggiestruct.filename, ntfsprog_fifo);
    14791479            res =
    1480                 feed_outfrom_partimage(biggiestruct.filename,
    1481                                        partimagehack_fifo);
     1480                feed_outfrom_ntfsprog(biggiestruct.filename,
     1481                                       ntfsprog_fifo);
    14821482//          log_msg(3, "CHILD - fip - exiting");
    14831483            exit(res);
     
    14851485        default:
    14861486            log_msg(3,
    1487                     "feed_into_partimage() called in background --- pid=%ld",
     1487                    "feed_into_ntfsprog() called in background --- pid=%ld",
    14881488                    (long int) (pid));
    14891489        }
    14901490    } else {
    1491         use_partimage_hack = FALSE;
    1492         partimagehack_fifo[0] = '\0';
     1491        use_ntfsprog_hack = FALSE;
     1492        ntfsprog_fifo[0] = '\0';
    14931493        file_to_openout = outfile_fname;
    14941494        if (!does_file_exist(outfile_fname))    // yes, it looks weird with the '!' but it's correct that way
     
    15171517        return (1);
    15181518    }
    1519     log_msg(3, "Opened out to %s", outfile_fname);  // CD/DVD --> mondorestore --> partimagehack --> hard disk itself
     1519    log_msg(3, "Opened out to %s", outfile_fname);  // CD/DVD --> mondorestore --> ntfsclone --> hard disk itself
    15201520
    15211521    for (sliceno = 1, finished = FALSE; !finished;) {
     
    16261626    g_loglevel = old_loglevel;
    16271627
    1628     if (use_partimage_hack) {
    1629         log_msg(3, "Waiting for partimage to finish");
     1628    if (use_ntfsprog_hack) {
     1629        log_msg(3, "Waiting for ntfsclone to finish");
    16301630        sprintf(tmp,
    1631                 " ps ax | grep \" partimagehack \" | grep -v grep > /dev/null 2> /dev/null");
     1631                " ps ax | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    16321632        while (system(tmp) == 0) {
    16331633            sleep(1);
    16341634        }
    1635         log_it("OK, partimage has really finished");
     1635        log_it("OK, ntfsclone has really finished");
    16361636    }
    16371637
     
    16491649    paranoid_free(tmp);
    16501650    paranoid_free(bzip2_command);
    1651     paranoid_free(partimagehack_command);
     1651    paranoid_free(ntfsprog_command);
    16521652    paranoid_free(suffix);
    16531653    paranoid_free(sz_devfile);
     
    16791679                                     long long biggiefile_size, //UNUSED
    16801680                                     struct s_node *filelist,
    1681                                      int use_partimagehack,
     1681                                     int use_ntfsprog,
    16821682                                     char *pathname_of_last_file_restored)
    16831683{
     
    16891689    char *command;
    16901690    char *outfile_fname;
    1691     char *partimagehack_command;
     1691    char *ntfsprog_command;
    16921692    char *sz_devfile;
    1693     char *partimagehack_fifo;
     1693    char *ntfsprog_fifo;
    16941694    char *file_to_openout = NULL;
    16951695
     
    17031703    long long slice_siz;
    17041704    bool dummy_restore = FALSE;
    1705     bool use_partimage_hack = FALSE;
     1705    bool use_ntfsprog_hack = FALSE;
    17061706    pid_t pid;
    17071707    struct s_filename_and_lstat_info biggiestruct;
     
    17101710
    17111711    malloc_string(tmp);
    1712     malloc_string(partimagehack_fifo);
     1712    malloc_string(ntfsprog_fifo);
    17131713    malloc_string(outfile_fname);
    17141714    malloc_string(command);
    17151715    malloc_string(sz_devfile);
    1716     malloc_string(partimagehack_command);
     1716    malloc_string(ntfsprog_command);
    17171717    old_loglevel = g_loglevel;
    17181718    assert(bkpinfo != NULL);
     
    17211721
    17221722    pathname_of_last_file_restored[0] = '\0';
    1723     if (use_partimagehack == BLK_START_A_PIHBIGGIE) {
    1724         use_partimagehack = 1;
     1723    if (use_ntfsprog == BLK_START_A_PIHBIGGIE) {
     1724        use_ntfsprog = 1;
    17251725        log_msg(1, "%s --- pih=YES", orig_bf_fname);
    1726     } else if (use_partimagehack == BLK_START_A_NORMBIGGIE) {
    1727         use_partimagehack = 0;
     1726    } else if (use_ntfsprog == BLK_START_A_NORMBIGGIE) {
     1727        use_ntfsprog = 0;
    17281728        log_msg(1, "%s --- pih=NO", orig_bf_fname);
    17291729    } else {
    1730         use_partimagehack = 0;
     1730        use_ntfsprog = 0;
    17311731        log_msg(1, "%s --- pih=NO (weird marker though)", orig_bf_fname);
    17321732    }
     
    17541754    }
    17551755
    1756     if (use_partimagehack) {
     1756    if (use_ntfsprog) {
    17571757        if (strncmp(orig_bf_fname, "/dev/", 5)) {
    17581758            log_msg(1,
    1759                     "I was in error when I set use_partimagehack to TRUE.");
     1759                    "I was in error when I set use_ntfsprog to TRUE.");
    17601760            log_msg(1, "%s isn't even in /dev", orig_bf_fname);
    1761             use_partimagehack = FALSE;
    1762         }
    1763     }
    1764 
    1765     if (use_partimagehack) {
     1761            use_ntfsprog = FALSE;
     1762        }
     1763    }
     1764
     1765    if (use_ntfsprog) {
    17661766        g_loglevel = 4;
    17671767        strcpy(outfile_fname, orig_bf_fname);
    1768         use_partimage_hack = TRUE;
     1768        use_ntfsprog_hack = TRUE;
    17691769        log_msg(2,
    1770                 "Calling partimagehack in background because %s is a /dev entry",
     1770                "Calling ntfsclone in background because %s is a /dev entry",
    17711771                outfile_fname);
    17721772        sprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    17731773                (int) (random() % 32768));
    17741774        mkfifo(sz_devfile, 0x770);
    1775         strcpy(partimagehack_fifo, sz_devfile);
    1776         file_to_openout = partimagehack_fifo;
     1775        strcpy(ntfsprog_fifo, sz_devfile);
     1776        file_to_openout = ntfsprog_fifo;
    17771777        switch (pid = fork()) {
    17781778        case -1:
     
    17801780        case 0:
    17811781            log_msg(3,
    1782                     "CHILD - fip - calling feed_outfrom_partimage(%s, %s)",
    1783                     outfile_fname, partimagehack_fifo);
     1782                    "CHILD - fip - calling feed_outfrom_ntfsprog(%s, %s)",
     1783                    outfile_fname, ntfsprog_fifo);
    17841784            res =
    1785                 feed_outfrom_partimage(outfile_fname, partimagehack_fifo);
     1785                feed_outfrom_ntfsprog(outfile_fname, ntfsprog_fifo);
    17861786//          log_msg(3, "CHILD - fip - exiting");
    17871787            exit(res);
     
    17891789        default:
    17901790            log_msg(3,
    1791                     "feed_into_partimage() called in background --- pid=%ld",
     1791                    "feed_into_ntfsprog() called in background --- pid=%ld",
    17921792                    (long int) (pid));
    17931793        }
     
    18011801                    orig_bf_fname);
    18021802        }
    1803         use_partimage_hack = FALSE;
    1804         partimagehack_fifo[0] = '\0';
     1803        use_ntfsprog_hack = FALSE;
     1804        ntfsprog_fifo[0] = '\0';
    18051805        file_to_openout = outfile_fname;
    18061806        if (!does_file_exist(outfile_fname))    // yes, it looks weird with the '!' but it's correct that way
     
    18791879            pathname_of_last_file_restored);
    18801880
    1881     if (use_partimage_hack) {
    1882         log_msg(3, "Waiting for partimage to finish");
     1881    if (use_ntfsprog_hack) {
     1882        log_msg(3, "Waiting for ntfsclone to finish");
    18831883        sprintf(tmp,
    1884                 " ps ax | grep \" partimagehack \" | grep -v grep > /dev/null 2> /dev/null");
     1884                " ps ax | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    18851885        while (system(tmp) == 0) {
    18861886            sleep(1);
    18871887        }
    1888         log_msg(3, "OK, partimage has really finished");
     1888        log_msg(3, "OK, ntfsclone has really finished");
    18891889    }
    18901890
     
    19031903    paranoid_free(outfile_fname);
    19041904    paranoid_free(command);
    1905     paranoid_free(partimagehack_command);
     1905    paranoid_free(ntfsprog_command);
    19061906    paranoid_free(sz_devfile);
    1907     paranoid_free(partimagehack_fifo);
     1907    paranoid_free(ntfsprog_fifo);
    19081908    g_loglevel = old_loglevel;
    19091909    return (retval);
Note: See TracChangeset for help on using the changeset viewer.