Changeset 3292 for branches/3.2


Ignore:
Timestamp:
May 27, 2014, 5:53:14 PM (5 years ago)
Author:
bruno
Message:
  • Remove from mindi 2 functions replaced by perl code (ReadAllLink? by mr-read-all-link and ProcessLDD by mr-process-ldd)
  • Redirect mindi execution to mondo log on the fly to try to improve percentage display with newt (not finished yet)
  • Introduce a new global var MINDI_LOGFILE and use it everywhere
  • Fix some memory free mising (thanks valgrind)
  • Remove a call to rpm to log packages - not portable
  • Works with valgrind locally to create images in dir
Location:
branches/3.2
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi/mindi

    r3281 r3292  
    874874
    875875
    876 # Give all symlinks recursively of a full path name
    877 ReadAllLink() {
    878     file="$1"
    879 
    880     while [ `echo $file | grep -Ec '\.\./'` -ne 0 ]; do
    881         # We need to normalise the path with .. in it
    882         file=`echo $file | perl -p -e 's|([^/]*)/([^/]+)/\.\./([^/]+)|$1/$3|g'`
    883     done
    884     echo "$file"
    885     if [ ! -h $file ]; then
    886         return 0
    887     fi
    888 
    889     link=`readlink $file`
    890     d=`dirname $file`
    891     # Is link a relative or full path name
    892     fchar=`echo $link | cut -c1`
    893     # If mother dir is a link print it
    894     if [ -h "$d" ]; then
    895         echo "$d"
    896         d2=`readlink $d`
    897         c2=`echo $d2 | cut -c1`
    898         if [ "$c2" != "/" ]; then
    899             if [ "$c2" != "." ]; then
    900                 d="/$d2"
    901             else
    902                 d="$d/$d2"
    903             fi
    904         fi
    905         echo "$d/`basename $file`"
    906     fi
    907     if [ "$fchar" != "/" ]; then
    908         # Relative or local link
    909         ReadAllLink "$d/$link"
    910     else
    911         # Absolute path
    912         ReadAllLink $link
    913     fi
    914 }
    915 
    916 
    917876LocateFile() {
    918877    local i j path fname_to_find location output resolved tmp stub cache_id loclist
     
    21942153    rm -rf $bigdir
    21952154    rm -f $needlist
    2196 }
    2197 
    2198 
    2199 ProcessLDD() {
    2200     local incoming f d nd bd bnd
    2201     read incoming
    2202     while [ "$incoming" != "" ]; do
    2203         # We take the full path name of the dyn. lib. we want
    2204         incoming=`echo "$incoming" | $AWK '{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'`
    2205         for f in $incoming ; do
    2206             # echo modified file name if one of the parent dir is a link
    2207             # by replacing the original dirname by the destination of the link
    2208             d="`dirname $f`"
    2209             found="false"
    2210             while [ "$d" != "/" ]; do
    2211                 if [ -h "$d" ]; then
    2212                     nd=`readlink -f $d`
    2213                     bd=`basename $d`
    2214                     bnd=`basename $nd`
    2215                     f=`echo $f | sed "s~/$bd/~/$bnd/~"`
    2216                     echo $d
    2217                 fi
    2218                 d="`dirname $d`"
    2219             done
    2220 
    2221             echo "$f"
    2222             echo "`ReadAllLink $f`"
    2223         done
    2224         read incoming
    2225     done
    22262155}
    22272156
  • branches/3.2/mondo/src/common/libmondo-archive.c

    r3288 r3292  
    843843    mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' \
    844844'%s' %ld '%s' '%s' '%s' \
    845 '%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir,    // parameter #2
     845'%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s' 2>&1 > %s", tmp2, bkpinfo->tmpdir,  // parameter #2
    846846            bkpinfo->scratchdir,    // parameter #3
    847847            bkpinfo->kernel_path,   // parameter #4
     
    864864            use_lzma_sz,        // parameter #20 (STRING)
    865865            value,              // parameter #21 (STRING)
     866            MONDO_LOGFILE,      // redirect to log file
    866867            MONDO_LOGFILE);
    867868
     
    888889//  popup_and_OK("Pausing");
    889890
    890     res = run_program_and_log_output(command, FALSE);
     891    // BCO old call :
     892    //res = run_program_and_log_output(command, FALSE);
     893    res = run_external_binary_with_percentage_indicator_NEW("Calling MINDI for boot disk",command);
     894    /* May crash now that we changed the call
    891895    update_evalcall_form(99);
     896    */
    892897    paranoid_free(command);
    893898
     
    929934    } else {
    930935        log_to_screen("Mindi failed to create your boot+data disks.");
    931         mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log");
     936        mr_asprintf(command, "grep 'Fatal error' %s", MINDI_LOGFILE);
    932937        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    933938        mr_free(command);
     
    16381643        mr_free(tmp3);
    16391644    }
     1645    mr_free(tmp);
    16401646    mr_free(tmp2);
    16411647    mr_free(tmp3);
  • branches/3.2/mondo/src/common/libmondo-devices.c

    r3291 r3292  
    21762176        }
    21772177        setup_scratchdir(tmp);
     2178        mr_free(tmp);
    21782179    }
    21792180    log_msg(3, "media type = %s", bkptype_to_string(bkpinfo->backup_media_type));
  • branches/3.2/mondo/src/common/libmondo-filelist.c

    r3271 r3292  
    390390    }
    391391    if (filelist->down) {
    392 /*      if (!(i++ %39999)) { update_evalcall_form(0); } */
    393392        free_filelist(filelist->down);
    394393        filelist->down = NULL;
     
    13311330        }
    13321331    }
    1333     mr_asprintf(find_excludes, " ");
    13341332
    13351333    if (!depth) {
     1334        mr_asprintf(find_excludes, " ");
    13361335        while((token = mr_strtok(sth, delims, &lastpos)) != NULL) {
    13371336          mr_strcat(find_excludes," -path %s -prune -o", token);
  • branches/3.2/mondo/src/common/libmondo-files.c

    r3278 r3292  
    278278    // If we didn't get anything back, check whether mindi raised a fatal error
    279279    if (!kernel[0]) {
    280         mr_asprintf(command, "%s", "grep 'Fatal error' /var/log/mindi.log");
     280        mr_asprintf(command, "grep 'Fatal error' %s", MINDI_LOGFILE);
    281281        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    282282        if (strlen(tmp) > 1) {
     
    284284            mr_free(tmp);
    285285            mr_free(command);
    286             fatal_error("Mindi gave a fatal error. Please check '/var/log/mindi.log'.");
     286            fatal_error("Mindi gave a fatal error. Please check "MINDI_LOGFILE);
    287287        }
    288288        mr_free(tmp);
  • branches/3.2/mondo/src/common/libmondo-fork.c

    r3205 r3292  
    649649
    650650    for (sleep(1); command[0] != '\0'; sleep(1)) {
    651         pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
     651        if (strstr(cmd,"mindi") != NULL) {
     652            pcno = grab_percentage_from_last_line_of_file(MINDI_LOGFILE);
     653        } else {
     654            pcno = grab_percentage_from_last_line_of_file(MONDO_LOGFILE);
     655        }
    652656        if (pcno < 0 || pcno > 100) {
    653657            log_msg(8, "Weird pc# %d", pcno);
  • branches/3.2/mondo/src/common/libmondo-tools.c

    r3278 r3292  
    391391#else
    392392    run_program_and_log_output("cat /proc/cpuinfo", 5);
    393     run_program_and_log_output
    394         ("rpm -q newt newt-devel slang slang-devel ncurses ncurses-devel gcc",
    395          5);
     393    /*
     394    run_program_and_log_output("rpm -q newt newt-devel slang slang-devel ncurses ncurses-devel gcc", 5);
     395    */
    396396#endif
    397397
     
    985985        log_to_screen("%s failed for some reason.", tmp);
    986986        mr_free(tmp);
    987         log_to_screen("Please run that command by hand and examine /var/log/mindi.log");
     987        log_to_screen("Please run that command by hand and examine "MINDI_LOGFILE);
    988988        log_to_screen("for more information. Perhaps your /etc/fstab file is insane.");
    989989        log_to_screen("Perhaps Mindi's MakeMountlist() subroutine has a bug. We'll see.");
  • branches/3.2/mondo/src/common/newt-specific.c

    r3235 r3292  
    420420        mr_free(bkpinfo->exclude_devs);
    421421        mr_free(bkpinfo->exclude_paths);
     422        mr_free(bkpinfo->include_paths);
    422423        mr_free(bkpinfo->subdir);
    423424        /* Then free the structure */
     
    609610            g_isoform_scale = newtScale(3, 3, 34, 100);
    610611            newtCenteredWindow(40, 7, ttl);
     612            if (g_isoform_main != NULL) {
     613                newtFormDestroy(g_isoform_main);
     614            }
    611615            g_isoform_main = newtForm(NULL, NULL, 0);
    612616            g_isoform_timeline = newtLabel(1, 5, "                    ");
  • branches/3.2/mondo/src/include/my-stuff.h

    r3193 r3292  
    7676#define MINDI_CACHE_REL "var/cache/mindi"   /* Should be coherent with mindi */
    7777#define MINDI_CACHE "/"MINDI_CACHE_REL
     78#define MINDI_LOGFILE "/var/log/mindi.log"
    7879
    7980/**
  • branches/3.2/mondo/src/lib/mr_mem.c

    r3208 r3292  
    7474    size_t n = 0;
    7575
     76    if (*lineptr != NULL) {
     77        /* free a variable which should be already free */
     78        mr_msg_int(1,line,file,"mr_getline_ found a non freed variable here");
     79        mr_free_int(lineptr,line,file);
     80    }
    7681    ret = getline(lineptr,&n,fd);
    7782    if ((ret == -1) && (! feof(fd))) {
     
    8186    /*  We reached end of file, allocating empty string */
    8287    if (ret == -1) {
    83         mr_asprintf_int(lineptr, line, file, "");
     88        mr_free_int(lineptr,line,file);
     89        mr_asprintf_int(lineptr,line,file,"");
    8490    }
    8591}
  • branches/3.2/mondo/src/mondorestore/mondo-prep.c

    r3287 r3292  
    4545
    4646FILE *g_fprep = NULL;
    47 extern char *g_mondo_cfg_file;  // where m*ndo-restore.cfg (the config file) is stored
     47extern char *g_mondo_cfg_file;  // where mondorestore.cfg (the config file) is stored
    4848
    4949int g_partition_table_locked_up = 0;
  • branches/3.2/mondo/src/mondorestore/mondo-rstr-tools.c

    r3278 r3292  
    6767extern char *g_imagedevs_restthese; // of the imagedevs listed in FILELIST_IMAGEDEVS,
    6868                      // restore only these
    69 extern char *g_mondo_cfg_file;  // where m*ndo-restore.cfg (the config file) is stored
     69extern char *g_mondo_cfg_file;  // where mondorestore.cfg (the config file) is stored
    7070extern char *g_mountlist_fname; // where mountlist.txt (the mountlist file) is stored
    7171extern char *g_mondo_home;      // homedir of Mondo; usually /usr/local/share/mondo
Note: See TracChangeset for help on using the changeset viewer.