Changeset 1989 in MondoRescue for branches/2.2.7/mindi/mindi


Ignore:
Timestamp:
Jun 22, 2008, 10:17:59 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Rwmove ChopUpAndCopyFile in mindi
  • mindi doesn't use slices anymore (no need as no floppy anymore)
  • Removal of sone useless scripts under restore-scripts/mondo
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.7/mindi/mindi

    r1986 r1989  
    160160
    161161
    162 ChopUpAndCopyFile() {
    163     local filename slicesize outdir res biggienumber filesize sliceno noof_slices testfile scratchfile
    164     filename=$1
    165     outdir=$2
    166     slicesize=$3
    167     biggienumber=$4
    168 
    169     [ -d "$filename" ] && Die "Cannot chop up $filename: it's a directory. Please amend $DEPLIST_FILE accordingly."
    170     mkdir -p $outdir
    171 
    172     sliceno=0
    173     scratchfile=$MINDI_TMP/blah.$$.dat
    174     cp -f $filename $scratchfile 2>> $LOGFILE || Die "CUACF -- cannot copy $filename to $scratchfile - did you run out of disk space?"
    175     [ "`head $scratchfile -n1 | grep -F "bin/sh"`" != "" ] && StripComments $scratchfile "-$filename-"
    176     [ "`echo "$filename" | grep -F "etc/termcap"`" != "" ] && StripComments $scratchfile "-$filename-"
    177 
    178     # Uncompress modules only if not using udevd
    179     if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
    180         mv $scratchfile $scratchfile.gz
    181         gunzip -f $scratchfile || LogIt "Cannot gunzip $scratchfile.gz"
    182         filename=`echo "$filename" | tr '.' '#' | sed s/#o#gz/#o/ | sed s/#ko#gz/#ko/ | tr '#' '.'`
    183     fi
    184     filesize=`du -sk $scratchfile | cut -f1`
    185     noof_slices=$(($filesize/$slicesize))
    186     echo "$filename" > $outdir/slice-$biggienumber.name
    187     echo "$filesize" > $outdir/slice-$biggienumber.size
    188     [ -x "$scratchfile" ] && StripExecutable $scratchfile "-$filename-"
    189     while [ "$sliceno" -le "$noof_slices" ] ; do
    190         dd if=$scratchfile skip=$(($sliceno*$slicesize)) of=$outdir/slice-$biggienumber.`printf "%03d" $sliceno` bs=1k count=$slicesize &> /dev/null
    191         sliceno=$(($sliceno+1))
    192     done
    193     rm -f $scratchfile
    194 }
    195 
    196 
    197162CopyDependenciesToDirectory() {
    198     local outdir incoming fname filesize counter d found
     163    local outdir incoming fname counter d found
    199164    outdir=$1
    200165    mkdir -p $outdir
     
    218183            find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir
    219184        elif [ -e "$incoming" ] && [ $found = "false" ]; then
    220             filesize=`du -sk $incoming | cut -f1`
    221             if [ "$filesize" -gt "$(($CHOPSIZE*2))" ] && [ ! -h "$incoming" ] ; then
    222                 ChopUpAndCopyFile $incoming $outdir $CHOPSIZE $BIGNO
    223                 BIGNO=$(($BIGNO+1))
    224             else
    225                 tar cf - $incoming 2> /dev/null | (cd $outdir ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
    226    
    227                 # Only uncompress modules if not using udevd
    228                 if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
    229                     gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming"
    230                 fi
    231                 [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
     185            tar cf - $incoming 2> /dev/null | (cd $outdir ; tar xf -) || Die "Cannot copy $incoming to $outdir - did you run out of disk space?"
     186
     187            # Only uncompress modules if not using udevd
     188            if [ "`echo "$incoming" | grep "lib/modules/.*\..*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then
     189                gunzip -f $outdir/$incoming || LogIt "Cannot gunzip $outdir/$incoming"
    232190            fi
     191            [ -x "$outdir" ] && StripExecutable $outdir "-$filename-"
    233192            counter=$(($counter+1))
    234193            if [ "$counter" -ge "5" ] ; then
     
    18081767        for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do
    18091768            tar cf - ./$i 2>> $LOGFILE | (cd $bigdir ; tar xf -) || Die "PDDI can't copy $i->$bigdir"
    1810             if [ "`du -sk $i | cut -f1`" -lt "$(($CHOPSIZE*2))" ] ; then
    1811                 tar cf - $i 2>> $LOGFILE | (cd $bigdir ; tar xf -)
    1812             else
    1813                 ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO
    1814                 BIGNO=$(($BIGNO+1))
    1815             fi
    18161769        done
    18171770        for i in $EXTRA_MODS ; do
     
    18191772            [ ! "$j" ] && echo "WARNING - cannot find failsafe module $i.o.gz" >> $LOGFILE
    18201773            for k in $j ; do
    1821                 if [ "`du -sk $k | cut -f1`" -lt "$CHOPSIZE" ] ; then
    1822                     tar cf - $k 2>> $LOGFILE | (cd $bigdir ; tar xf -)
    1823                 else
    1824                     ChopUpAndCopyFile $k $bigdir $CHOPSIZE $BIGNO
    1825                     BIGNO=$(($BIGNO+1))
    1826                 fi
     1774                tar cf - $k 2>> $LOGFILE | (cd $bigdir ; tar xf -)
    18271775                echo "Added failsafe module $k to ramdisk" >> $LOGFILE
    18281776            done
     
    24842432trap "Aborted" SIGTERM
    24852433DONE="\r\t\t\t\t\t\t\t\tDone.         "
    2486 CHOPSIZE=240
    2487 BIGNO=0
    2488 MAX_COMPRESSED_SIZE=1300
    24892434kernelpath=""
    24902435MONDO_ROOT=/var/cache/mondo
     
    25592504fi
    25602505
    2561 if [ "$#" -ge "2" ] ; then
    2562     if [ "$1" = "--max-compressed-size" ] ; then
    2563         MAX_COMPRESSED_SIZE=$2
    2564         shift; shift
    2565     fi
    2566 fi
    2567 
    25682506FLOPPY_WAS_MOUNTED=""
    25692507for mtpt in /media/floppy /mnt/floppy /floppy ; do
Note: See TracChangeset for help on using the changeset viewer.