Changeset 1989 in MondoRescue for branches/2.2.7/mindi/mindi
- Timestamp:
- Jun 22, 2008, 10:17:59 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.7/mindi/mindi
r1986 r1989 160 160 161 161 162 ChopUpAndCopyFile() {163 local filename slicesize outdir res biggienumber filesize sliceno noof_slices testfile scratchfile164 filename=$1165 outdir=$2166 slicesize=$3167 biggienumber=$4168 169 [ -d "$filename" ] && Die "Cannot chop up $filename: it's a directory. Please amend $DEPLIST_FILE accordingly."170 mkdir -p $outdir171 172 sliceno=0173 scratchfile=$MINDI_TMP/blah.$$.dat174 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 udevd179 if [ "`echo "$filename" | grep -F "lib/modules/" | grep "\.*o\.gz"`" != "" ] && [ "`ps auxww | grep -v grep | grep -qw udevd`" != "" ]; then180 mv $scratchfile $scratchfile.gz181 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 fi184 filesize=`du -sk $scratchfile | cut -f1`185 noof_slices=$(($filesize/$slicesize))186 echo "$filename" > $outdir/slice-$biggienumber.name187 echo "$filesize" > $outdir/slice-$biggienumber.size188 [ -x "$scratchfile" ] && StripExecutable $scratchfile "-$filename-"189 while [ "$sliceno" -le "$noof_slices" ] ; do190 dd if=$scratchfile skip=$(($sliceno*$slicesize)) of=$outdir/slice-$biggienumber.`printf "%03d" $sliceno` bs=1k count=$slicesize &> /dev/null191 sliceno=$(($sliceno+1))192 done193 rm -f $scratchfile194 }195 196 197 162 CopyDependenciesToDirectory() { 198 local outdir incoming fname filesizecounter d found163 local outdir incoming fname counter d found 199 164 outdir=$1 200 165 mkdir -p $outdir … … 218 183 find $incoming/* -maxdepth 0 2> /dev/null | CopyDependenciesToDirectory $outdir 219 184 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" 232 190 fi 191 [ -x "$outdir" ] && StripExecutable $outdir "-$filename-" 233 192 counter=$(($counter+1)) 234 193 if [ "$counter" -ge "5" ] ; then … … 1808 1767 for i in `ListKernelModulePaths | HackPathsToFailsafe` ; do 1809 1768 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))" ] ; then1811 tar cf - $i 2>> $LOGFILE | (cd $bigdir ; tar xf -)1812 else1813 ChopUpAndCopyFile $i $bigdir $CHOPSIZE $BIGNO1814 BIGNO=$(($BIGNO+1))1815 fi1816 1769 done 1817 1770 for i in $EXTRA_MODS ; do … … 1819 1772 [ ! "$j" ] && echo "WARNING - cannot find failsafe module $i.o.gz" >> $LOGFILE 1820 1773 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 -) 1827 1775 echo "Added failsafe module $k to ramdisk" >> $LOGFILE 1828 1776 done … … 2484 2432 trap "Aborted" SIGTERM 2485 2433 DONE="\r\t\t\t\t\t\t\t\tDone. " 2486 CHOPSIZE=2402487 BIGNO=02488 MAX_COMPRESSED_SIZE=13002489 2434 kernelpath="" 2490 2435 MONDO_ROOT=/var/cache/mondo … … 2559 2504 fi 2560 2505 2561 if [ "$#" -ge "2" ] ; then2562 if [ "$1" = "--max-compressed-size" ] ; then2563 MAX_COMPRESSED_SIZE=$22564 shift; shift2565 fi2566 fi2567 2568 2506 FLOPPY_WAS_MOUNTED="" 2569 2507 for mtpt in /media/floppy /mnt/floppy /floppy ; do
Note:
See TracChangeset
for help on using the changeset viewer.