Changeset 3292 in MondoRescue for branches/3.2/mindi/mindi


Ignore:
Timestamp:
May 27, 2014, 5:53:14 PM (10 years ago)
Author:
Bruno Cornec
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
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.