Changeset 2444 in MondoRescue for branches/2.2.10/mindi/mindi
- Timestamp:
- Sep 30, 2009, 4:44:40 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2.10/mindi/mindi
r2428 r2444 19 19 KERVER=$KERVERRUN 20 20 21 ADDITIONAL_BOOT_PARAMS="devfs=nomount noresume selinux=0 barrier=off" 21 # In case of problem with udev you can try to add udevdebug 22 ADDITIONAL_BOOT_PARAMS="devfs=nomount noresume selinux=0 barrier=off udevtimeout=10" 22 23 23 24 MINDI_REV=PBREV … … 471 472 [ "$r" -ne "0" ] && LogAll "$incoming not found" 472 473 res=$(($res+$r)) 473 # echo "'$incoming' generates filelist '$filelist'" >> $LOGFILE474 # LogFile "'$incoming' generates filelist '$filelist'" 474 475 for fname in $filelist ; do 475 476 [ "$fname" != "" ] && echo "$fname" >> $tempfile … … 611 612 612 613 # Check kernel filesystem capabilites for accessing initrd image 614 # Could be ext2 FS (old mode) or initramfs (new mode) 613 615 # 614 616 # Interface definition: … … 646 648 if [ $? -eq 0 ]; then 647 649 lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 648 else 649 # Since 2.6.30 kernel can use lzma and bzip2 in addition to gzip for initramfs compression 650 # get offet of gzip magic "1f8b0800" in file (or 1f8b9e ??) 651 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}'` 652 if [ $lvOffset -eq 0 ]; then 653 # get offet of bzip2 magic "425a" in file 654 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "425a")}'` 655 if [ $lvOffset -eq 0 ]; then 656 # get offet of lzma magic "5d00" in file 657 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "5d00")}'` 658 if [ $lvOffset -eq 0 ]; then 659 Die "No magic compression pattern found in file $lvKernelImage. Terminating." 660 else 661 comp="lzma" 662 fi 663 else 664 comp="bzip2" 665 fi 650 651 # determine which filesystem to use for initrd image: ext2|3fs, gzip'ed cpio (initramfs) or cramfs 652 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 653 lvUseFilesystem="ext2fs" 654 elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then 655 lvUseFilesystem="ext3fs" 656 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 657 lvUseFilesystem="initramfs" 658 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 659 lvUseFilesystem="cramfs" 666 660 else 667 comp="gzip" 668 fi 669 670 lvOffset=`expr $lvOffset / 2` 671 LogFile " GetInitrdFilesystemToUse(): $comp magic found in $lvKernelImage at lvOffset $lvOffset.\n" 672 673 # scan kernel image for initrd filessystem support 674 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | $comp -dc 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 675 fi 676 677 # determine which filesystem to use for initrd image: ext2fs, gzip'ed cpio (initramfs ) or cramfs 678 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 679 lvUseFilesystem="ext2fs" 680 elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then 681 lvUseFilesystem="ext3fs" 682 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 661 lvUseFilesystem="UNSUPPORTED" 662 fi 663 664 else 665 # In that case, we are after 2.6.30 and use the supported initramfs 683 666 lvUseFilesystem="initramfs" 684 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 685 lvUseFilesystem="cramfs" 686 else 687 lvUseFilesystem="UNSUPPORTED" 688 fi 689 667 fi 690 668 # say what we are using 691 LogFile " GetInitrdFilesystemToUse(): Filesytem to use for init rdis $lvUseFilesystem.\n"669 LogFile " GetInitrdFilesystemToUse(): Filesytem to use for initial ramdisk is $lvUseFilesystem.\n" 692 670 693 671 # return file system to use … … 734 712 if [ -e "/vmfs/volumes" ]; then 735 713 # For VMWare ESX 3 get the device names of these volumes 736 vdf -P | grep -E '/vmfs/volumes' | awk'{print $1}'714 vdf -P | grep -E '/vmfs/volumes' | $AWK '{print $1}' 737 715 fi 738 716 return … … 1297 1275 else 1298 1276 if [ "$partition_format" = "dos" ] || [ "$partition_format" = "msdos" ] ; then 1299 LogFile "Stupid bastard..."1277 LogFile "vfat should be used instead of dos/msdos as a partition format" 1300 1278 partition_format="vfat" 1301 1279 fi … … 1306 1284 } 1307 1285 1286 CheckMountlist() { 1287 local file=$1 1288 # Coherency verification 1289 ML0=`cat $file | wc -l` 1290 ML1=`$AWK '{print $1}' $file | sort -u | wc -l` 1291 ML2=`$AWK '{print $2}' $file | sort -u | wc -l` 1292 if [ "$ML0" -ne "$ML1" ]; then 1293 LogFile "--------------------------------------------" 1294 echo "WARNING: Duplicate device entry in mountlist" | tee -a $LOGFILE 1295 LogFile "--------------------------------------------" 1296 fi 1297 if [ "$ML0" -ne "$ML2" ]; then 1298 LogFile "--------------------------------------------" 1299 echo "WARNING: Duplicate mountpoint entry in mountlist" | tee -a $LOGFILE 1300 LogFile "------------------------------------------------" 1301 fi 1302 } 1308 1303 1309 1304 MakeSureNumberIsInteger() { … … 1822 1817 touch $mpincfile 1823 1818 if [ -a $MODPROBE_CONF ]; then 1824 includes=$( awk'/^[ \t]*include[ \t]+/ {if(NF>=2){print $2}}' $MODPROBE_CONF|sort -u)1819 includes=$($AWK '/^[ \t]*include[ \t]+/ {if(NF>=2){print $2}}' $MODPROBE_CONF|sort -u) 1825 1820 if [ -n "$includes" ]; then 1826 1821 for include in $includes … … 1930 1925 TOTAL_BIGDIR_SIZE=`du -sk $bigdir | cut -f1` 1931 1926 MakeMountlist $MINDI_TMP/mountlist.txt 1927 CheckMountlist $MINDI_TMP/mountlist.txt 1932 1928 mkdir -p $bigdir/tmp 1933 1929 cp -f $MINDI_TMP/mountlist.txt $bigdir/tmp/mountlist.txt 2>> $LOGFILE || Die "Cannot copy mountlist.txt from $MINDI_TMP to data disk" … … 1943 1939 fi 1944 1940 cat $bigdir/tmp/mountlist.txt >> $LOGFILE 1941 LogFile "-----------------------------------" 1942 1943 LogFile -en "$FILES_IN_FILELIST" > $bigdir/FILES-IN-FILELIST 1945 1944 echo -en "$LAST_FILELIST_NUMBER" > $bigdir/LAST-FILELIST-NUMBER 2>> $LOGFILE 1946 1945 if [ _"$MONDO_SHARE" != _"" ]; then … … 1968 1967 while [ "$incoming" != "" ]; do 1969 1968 # We take the full path name of the dyn. lib. we want 1970 incoming=`echo "$incoming" | awk'{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'`1969 incoming=`echo "$incoming" | $AWK '{if (match($1,/\//)) {print $1} else {if (match($3,/\//)) print $3} fi}'` 1971 1970 for f in $incoming ; do 1972 1971 # echo modified file name if one of the parent dir is a link … … 2236 2235 # We want to use the real mount and all the supported variants (nfs, cifs, ...) 2237 2236 rm -f bin/mount $MINDI_TMP/busy.lis 2238 mountlis=`grep -E "mount|fuse|ssh" $DEPLIST_FILE $DEPLIST_DIR/* | cut -d: -f2`2239 for f in $MINDI_LIB/rootfs/bin/busybox $mountlis ; do2240 if [ -f $f ]; then2241 LocateDeps $f >> $MINDI_TMP/busy.lis2242 fi2237 mountlis=`grep -E "mount|fuse|ssh" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2 | sort -u` 2238 LocateDeps $MINDI_LIB/rootfs/bin/busybox $mountlis >> $MINDI_TMP/busy.lis 2239 # Special for libs 2240 for f in `grep -E "libnss" $DEPLIST_FILE $DEPLIST_DIR/* | grep -v " *#.*" | cut -d: -f2`; do 2241 echo "`ReadAllLink $f`" >> $MINDI_TMP/busy.lis 2243 2242 done 2243 # Initial / are trucated by tar 2244 2244 tar cf - $mountlis `sort -u $MINDI_TMP/busy.lis` 2>> $MINDI_TMP/$$.log | tar xf - || LogAll "Problem in mount analysis" $MINDI_TMP/$$.log 2245 2245 rm -f $MINDI_TMP/busy.lis 2246 2246 fi 2247 2248 # Copy of files mandatory for ssh to automate mount if sshfs is used 2249 mkdir $mountpoint/.ssh 2250 cp -rp ~root/.ssh/*.pub ~root/.ssh/config ~root/.ssh/known* $mountpoint/.ssh 2> /dev/null 2251 echo > $mountpoint/tmp/myssh << EOF 2252 ssh -o StrictHostKeyChecking=no $* 2253 EOF 2254 chmod 755 $mountpoint/tmp/myssh 2247 2255 2248 2256 # Copy of files mandatory for ld.so … … 2396 2404 mkdir -p $mountpoint/proc 2397 2405 echo "$BOOT_SIZE" > $mountpoint/tmp/$BOOT_SIZE.siz 2406 2407 LogFile "---------------------------" 2408 LogFile "Content of initial ramdisk:" 2409 LogFile "---------------------------" 2410 (cd $mountpoint ; ls -Rla ) >> $LOGFILE 2411 LogFile "---------------------------" 2412 2398 2413 # Determine what filesystem to use for initrd image 2399 2414 LogFile "Call GetInitrdFilesystemToUse() with parameter ${kernelpath} to get filesystem to use for initrd." … … 2596 2611 LogFile "-------------" 2597 2612 lsmod >> $LOGFILE 2598 MODULES="`cat /proc/modules | awk'{print $1}'`"2613 MODULES="`cat /proc/modules | $AWK '{print $1}'`" 2599 2614 if [ -x /usr/sbin/esxcfg-module ]; then 2600 2615 LogFile "-------------" … … 2604 2619 LogFile "-------------" 2605 2620 /usr/sbin/esxcfg-module -l >> $LOGFILE 2606 MODULES="$MODULES `/usr/sbin/esxcfg-module -l | awk'{print $1}'`"2621 MODULES="$MODULES `/usr/sbin/esxcfg-module -l | $AWK '{print $1}'`" 2607 2622 fi 2608 2623 LogFile "FORCE_MODS:" … … 2669 2684 elif [ "$1" = "--locatedeps" ] ; then 2670 2685 [ ! "$2" ] && Die "Please specify the binary to look at" 2671 LocateDeps $ 22686 LocateDeps $* 2672 2687 # Avoids logfile content for mondo 2673 2688 export MONDO_SHARE="" … … 2682 2697 [ ! "$2" ] && Die "Please specify the output file" 2683 2698 MakeMountlist $2 2699 CheckMountlist $2 2684 2700 # Avoids logfile content for mondo 2685 2701 export MONDO_SHARE="" … … 2818 2834 MakeMondoConfigFile $MINDI_TMP/mondo-restore.cfg 2819 2835 MakeMountlist $MINDI_TMP/mountlist.txt 2836 CheckMountlist $MINDI_TMP/mountlist.txt 2820 2837 mkdir -p $MINDI_TMP/small-all/tmp 2821 2838 cd $MINDI_TMP/small-all
Note:
See TracChangeset
for help on using the changeset viewer.