Changeset 3795 in MondoRescue for branches/3.3/mindi/mindi


Ignore:
Timestamp:
Feb 15, 2024, 3:55:18 PM (3 months ago)
Author:
Bruno Cornec
Message:

Untag v3.3.0 never really published in the past - will start from here

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.3/mindi/mindi

    r3785 r3795  
    302302    local outdir incoming counter d found tdir templog
    303303    outdir=$1
     304    noof_lines=$2
     305    counter=$3
    304306    templog=$MINDI_TMP/$$.log
    305307    mkdir -p $outdir
    306308    incoming=`ReadLine`
    307     counter=$3
    308309    > $templog
    309310
    310311    while [ "$incoming" != "" ] ; do
    311         if [ "$3" = "1" ]; then
     312        LogFile "DEBUG: Handling $incoming"
     313        if [ "$noof_lines" != "0" ]; then
    312314            counter=$(($counter+1))
    313             LogProgress $counter $2
     315            LogProgress $counter $noof_lines
    314316        fi
    315317        # Non absolute file names should not arrive till here => skipped
    316318        if [ `echo "$incoming" | cut -c1` != '/' ]; then
    317             LogFile "WARNING: Unable to handle non-full pathname $incoming"
     319            LogAll "WARNING: Unable to handle $incoming"
    318320            incoming=`ReadLine`
    319321            continue
    320322        fi
     323        if [ -e "$incoming" ]; then
     324            LogFile "DEBUG: Adding $incoming"
     325            listfile="$listfile $incoming"
     326        fi
     327        incoming=`ReadLine`
     328    done
     329
     330    LogAll "Creating mindi tar file"
     331    tar cf - -C / $listfile 2> $templog | (cd "$outdir" ; tar xf -) # || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $templog
     332}
     333
     334bidon() {
     335
    321336        # no parent directory of incoming should be a link, copy is not possible in that case
    322337        d=`dirname "$incoming"`
    323338        found="false"
    324339        while [ $d != "/" -a $found = "false" ]; do
    325             [ -h "$d" ] && found="true"
     340            if [ -h "$d" ]; then
     341                found="true"
     342                LogFile "WARNING: skipping $d as link"
     343                incoming=`ReadLine`
     344                continue
     345            fi
    326346            d=`dirname "$d"`
    327347        done
     348
    328349        if [ -d "$incoming" -a ! -h "$incoming" ]; then
    329             find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 0
     350            LogFile "DEBUG: Finding in $incoming"
     351            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 0 0
    330352        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    331353            if [ ! -h "$incoming" ]; then
     354                LogFile "DEBUG: Tarring $incoming"
    332355                tar cf - -C / $incoming 2> $templog | (cd "$outdir" ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?" $templog
    333356            else
     357                LogFile "DEBUG: Copying $incoming"
    334358                tdir=`dirname "$incoming"`
    335359                if [ ! -e "$outdir/$tdir" ]; then
     
    340364            # Only uncompress modules if not using udevd
    341365            if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
    342                 gunzip -f $outdir/$incoming || LogAll "WARNING: Cannot gunzip $outdir/$incoming"
     366                    gunzip -f $outdir/$incoming || LogAll "WARNING: Cannot gunzip $outdir/$incoming"
    343367            fi
    344368            [ -x "$outdir" ] && StripExecutable $outdir
    345369        fi
    346370        incoming=`ReadLine`
    347     done
    348371}
    349372
     
    356379    done
    357380    echo $r
    358 }
    359 
    360 
    361 DropOptimizedLibraries() {
    362     local outdir filelist list_of_optimized_libraries optimized_lib_name vanilla_lib_name reason msg resolved res
    363     filelist=$1
    364     outdir=$2
    365 
    366     list_of_optimized_libraries=`grep "lib/i[5-7]86/" $filelist`
    367     if [ "$list_of_optimized_libraries" = "" ] ; then
    368         return 0
    369     fi
    370     echo -en "Dropping i686-optimized libraries if appropriate"
    371     for optimized_lib_name in $list_of_optimized_libraries ; do
    372         echo -en "."
    373         reason=""
    374         vanilla_lib_name=`echo "$optimized_lib_name" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'`
    375         echo "$vanilla_lib_name" >> $filelist
    376         LogFile "INFO: Adding $vanilla_lib_name to filelist"
    377         mkdir -p $outdir$optimized_lib_name > /dev/null 2> /dev/null
    378         rmdir $outdir$optimized_lib_name > /dev/null 2> /dev/null
    379 
    380         # This may return multiple files
    381         for resolved in `mr-read-all-link $vanilla_lib_name`; do
    382             LogFile "INFO: Adding as deps $resolved to filelist"
    383             vanilla_resolved_name=`echo "$resolved" | sed -e 's/i[5-7]86//' -e 's/cmov//' -e 's/nosegneg//' | tr -s '/' '/'`
    384             if [ "$vanilla_resolved_name" != "$resolved" ]; then
    385                 mkdir -p $outdir$resolved> /dev/null 2> /dev/null
    386                 rmdir $outdir$resolved > /dev/null 2> /dev/null
    387                 ln -sf $vanilla_resolved_name $outdir$resolved
    388                 LogFile "INFO: Excluding deps $resolved"
    389                 grep -Fvx "$resolved" "$filelist" > $filelist.tmp
    390                 LogFile "INFO: Replacing it with $vanilla_resolved_name"
    391                 echo "$vanilla_resolved_name" >> $filelist.tmp
    392                 mv -f $filelist.tmp $filelist
    393             fi
    394         done
    395     done
    396     $AWK '{ print $1; }' $filelist | sort -u > $filelist.tmp
    397     mv -f $filelist.tmp $filelist
    398     echo -e "$DONE"
    399381}
    400382
     
    23502332
    23512333PrepareBigDir() {
    2352     local needlist diskdir res i j k lines lfiles includefile ti
     2334    local needlist diskdir res i j k lines lfiles includefile ti templog
    23532335
    23542336    rm -f $MINDI_CACHE/mindi.iso
    2355     needlist=$MINDI_TMP/what-we-need.txt
    2356     mkdir -p $bigdir/usr/bin
    2357     mkdir -p $bigdir/usr/sbin
    2358     includefile=$MINDI_TMP/$$.includefile.txt
    2359 
    2360     lfiles=`ls $DEPLIST_DIR/* | grep -v /minimal`
     2337    mkdir -p $targetdir
     2338    templog=$MINDI_TMP/$$.log
     2339    needlist=$MINDI_TMP/kernel-modules.conf
     2340    mkdir -p $bigdir/usr/bin $bigdir/usr/sbin $bigdir/tmp
     2341    # Generated file
     2342    includefile=$MINDI_TMP/include-modules.conf
     2343
     2344    lfiles=`ls $DEPLIST_DIR/* | grep -Ev '/minimal|/udev|/drbd'`
    23612345    if [ -e "$DEPLIST_FILE" ]; then
    23622346        lfiles="$DEPLIST_FILE $lfiles"
    23632347    fi
    2364     lines=`grep -vx " *#.*" $lfiles | grep -vx "" | wc -l`
    23652348    ParseModprobeForIncludes $includefile
    2366     lines=$(($lines+`cat $includefile | wc -l`))
    2367     cat $lfiles $includefile | GenerateGiantDependencyList $needlist $lines
    2368     res=$?
     2349    ListKernelModulePaths > $needlist
     2350    for f in $lfiles $includefile $needlist; do
     2351        CopyFromConf $f $targetdir
     2352    done
    23692353    rm -f $includefile
    2370     ListKernelModulePaths >> $needlist
    2371     if [ "$res" -ne "0" ] ; then
    2372         Die "You have $res files present in dependency list\nbut absent from filesystem."
    2373     fi
    2374     mkdir -p $bigdir/tmp
     2354
    23752355    if [ _"$MONDO_SHARE" != _"" ]; then
    23762356        # TODO: no reason to have the cfg file stored twice
     
    23832363
    23842364    [ -d "/mnt/.boot.d" ] && echo "GENTOO" > $bigdir/tmp/DUMBASS-GENTOO
    2385     DropOptimizedLibraries $needlist $bigdir
    2386     echo -en "INFO: Assembling dependency files"
    2387 
    2388     CopyDependenciesToDirectory < $needlist $bigdir `wc -l $needlist` 1
    2389     rm -f $needlist
    2390     echo -e "$DONE"
    23912365
    23922366    # also copy io.sys and msdos.sys, if we can find them
     
    24192393    done
    24202394    if [ -e "$MONDO_SHARE/restore-scripts" ]; then
     2395        mkdir -p $bigdir/usr/bin $bigdir/etc
    24212396        cp -Rdf $MONDO_SHARE/restore-scripts/mondo/* $bigdir/usr/bin 2>> $LOGFILE
    24222397        [ $? -ne 0 ] && [ _"$MONDO_SHARE" != _"" ] && Die "Cannot find/install $MONDO_SHARE/restore-scripts"
     
    24732448    PrepareBootDir
    24742449
     2450    LogFile "---------------------------"
     2451    LogFile "Content of initial bigdir:"
     2452    LogFile "---------------------------- "
     2453    (cd "$bigdir" ; ls -Rla ) >> $LOGFILE
     2454    LogFile "---------------------------"
    24752455}
    24762456
     
    27142694    conf=$1
    27152695    mp=$2
    2716     echo -en "INFO: Gathering dependencies of $conf.conf..."
    2717     LogFile "INFO: Gathering dependencies of $conf.conf..."
    2718     lis2=`grep -Ev '^#' $DEPLIST_DIR/$conf.conf | sort -u`
     2696    if [ ! -e $conf ]; then
     2697        # Invoked with a conf file short name fixing...
     2698        conf="$DEPLIST_DIR/$1.conf"
     2699    fi
     2700    if [ ! -e $conf ]; then
     2701        LogAll "Unable to find conf file $conf please report upstream"
     2702        return
     2703    fi
     2704    bconf=`basename $conf .conf`
     2705    echo -en "INFO: Gathering dependencies of $bconf..."
     2706    LogFile "INFO: Gathering dependencies of $conf..."
     2707    lis2=`grep -Ev '^#' $conf | sort -u`
    27192708    noof_lines=`echo $lis2 | wc -w`
    27202709    progress=0
     2710    LogFile "DEBUG: targetdir: `ls -l $mp/`"
     2711    LogFile "DEBUG: lis2=$lis2"
    27212712    # Get only the files which exist in that list
    27222713    # and potentially their symlink structure
    27232714    # put apart directories for later handling
     2715    touch $MINDI_TMP/$bconf.lis $MINDI_TMP/$bconf.lis2
    27242716    for f in $lis2; do
    27252717        if [ -d $f ]; then
    27262718            for g in `find $f`; do
    2727                 echo $g >> $MINDI_TMP/$conf.lis
    2728                 LocateDeps $g  >> $MINDI_TMP/$conf.lis2
     2719                echo $g >> $MINDI_TMP/$bconf.lis
     2720                LocateDeps $g  >> $MINDI_TMP/$bconf.lis2
    27292721            done
    27302722            lis3="$lis3 $f"
    27312723        else
    27322724            if [ -r $f ]; then
    2733                 echo $f >> $MINDI_TMP/$conf.lis
    2734                 LocateDeps $f >> $MINDI_TMP/$conf.lis2
     2725                echo $f >> $MINDI_TMP/$bconf.lis
     2726                LocateDeps $f >> $MINDI_TMP/$bconf.lis2
    27352727            fi
    27362728        fi
     
    27382730        LogProgress $progress $noof_lines
    27392731    done
    2740     echo -e "$DONE"
    2741     LogAll "INFO: Processing all dependencies links for $conf.conf..."
     2732    LogFile "DEBUG: lis3=$lis3"
     2733    #LogAll "INFO: Processing all dependencies links for $conf..."
    27422734    # And their deps except dirs
    2743     lines=`sort -u $MINDI_TMP/$conf.lis $MINDI_TMP/$conf.lis2`
    2744     rm -f $MINDI_TMP/$conf.lis2
     2735    lines=`sort -u $MINDI_TMP/$bconf.lis $MINDI_TMP/$bconf.lis2`
     2736    rm -f $MINDI_TMP/$bconf.lis2
    27452737    finallist=""
    27462738    # Remove directories from the list, as cp will create them anyway
     
    27482740    # recent bash says that -d is true for a link to a dir !
    27492741    for f in $lines; do
     2742        LogFile "DEBUG: f=$f"
    27502743        if [ -e "$f" -a ! -d "$f" ] || [ -h "$f" ]; then
     2744            LogFile "DEBUG: Test OK"
    27512745            # Do not overwrite files already in destination (avoid using option -n of cp not portable)
    27522746            if [ ! -e "$mp/$f" ]; then
    27532747                finallist="$finallist $f"
     2748                LogFile "DEBUG: Creating $mp/$f"
     2749            else
     2750                LogFile "DEBUG: Target exist `ls -al $mp/$f`"
    27542751            fi
    27552752        fi
    27562753    done
     2754    LogFile "DEBUG: finallist=$finallist"
    27572755    # But adds the directory useful in $lis3
    27582756    fnllist=`echo $finallist $lis3 | tr ' ' '\n' | sort -u | tr '\n' ' '`
    2759     LogFile "INFO: Copying $conf related files with cp -a --parents $fnllist -t $mp/"
    2760     cp -a --parents $fnllist -t $mp/ 2> $templog  || LogAll "WARNING: Problem in $conf analysis" $templog
    2761     rm -f $MINDI_TMP/$conf.lis
     2757    echo -e "$DONE"
     2758    if [ _"$fnllist" != _"" ] && [ _"$fnllist" != _" " ]; then
     2759        LogFile "INFO: Copying $conf related files with cp -a --parents $fnllist -t $mp/"
     2760        cp -a --parents $fnllist -t $mp/ 2>$templog  || LogAll "WARNING: Problem in $conf analysis" $templog
     2761    fi
     2762    rm -f $MINDI_TMP/$bconf.lis
    27622763}
    27632764
     
    27722773    > $templog
    27732774
    2774     mkdir -p $targetdir
    27752775    # Check whether /lib64 or /lib or /sbin or /bin is a link and if so explicitly create one in rootfs (Fedora 17 crazyness)
    27762776    for d in bin sbin lib lib64; do
     
    27782778            thelink=`readlink /$d`
    27792779            mkdir -p $targetdir/$thelink || LogAll "ERROR: Unable to create $thelink in $targetdir"
    2780             mv $targetdir/$d/* $targetdir/$d/.??* $targetdir/$thelink 2> /dev/null
     2780            mv $targetdir/$d/* $targetdir/$d/.??* $targetdir/$thelink
    27812781            if [ -d "$targetdir/$d" -a ! -h "$targetdir/$d" ]; then
    27822782                rmdir $targetdir/$d
     
    30303030
    30313031    mkdir -p $targetdir/proc
     3032    cp -a $MY_FSTAB $targetdir/tmp
    30323033    LogFile "---------------------------"
    30333034    LogFile "Content of initial targetdir:"
Note: See TracChangeset for help on using the changeset viewer.