Changeset 3111 in MondoRescue for branches/3.0/mindi/mindi
- Timestamp:
- May 5, 2013, 4:55:42 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.0/mindi/mindi
r3107 r3111 756 756 757 757 # say where we are. 758 LogFile "INFO: 758 LogFile "INFO: GetInitrdFilesystemToUse(): called with parameter: $lvKernelImage" 759 759 760 760 # verify that file exists 761 761 [ ! -f $lvKernelImage ] && Die "File $lvKernelImage not found. Terminating." 762 762 763 # Kernel may be gzip compressed 763 # Kernel may be gzip compressed - Case of RHEL5 - SLES11SP1 764 764 file $lvKernelImage 2>&1 | grep -q gzip 765 765 if [ $? -eq 0 ]; then 766 lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs"` 767 768 # determine which filesystem to use for initrd image: ext2|3fs, gzip'ed cpio (initramfs) or cramfs 769 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 770 lvUseFilesystem="ext2fs" 771 elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then 772 lvUseFilesystem="ext3fs" 773 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 774 lvUseFilesystem="initramfs" 775 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 776 lvUseFilesystem="cramfs" 766 LogFile "INFO: Found a gzip compressed kernel $lvKernelImage" 767 lvScanRes=`gzip -cd $lvKernelImage | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs" 2> /dev/null` 768 else 769 LogFile "INFO: Found a non gzip compressed kernel $lvKernelImage" 770 # kernel is x86 boot sector in RHEL3/4 with embedded gzip content 771 # get offet of gzip magic "1f8b0800" in file (for these older kernels) 772 lvOffset=`od -vA n -t x1 $lvKernelImage | tr -d '[:space:]' | awk '{ print match($0, "1f8b0800")}' 2> /dev/null` 773 if [ $lvOffset -eq 0 ]; then 774 LogFile "INFO: gzip magic not found in file $lvKernelImage. Supposing initramfs." 775 lvScanRes=$lcMagicInitfs 777 776 else 778 lvUseFilesystem="UNSUPPORTED" 779 fi 780 781 else 782 # In that case, we are after 2.6.30 and use the supported initramfs 777 lvOffset=`expr $lvOffset / 2` 778 LogFile "INFO: GetInitrdFilesystemToUse(): gzip magic found at lvOffset $lvOffset." 779 # scan again kernel image 780 lvScanRes=`dd ibs=1 skip=$lvOffset if=$lvKernelImage obs=1M 2>/dev/null | gunzip -c 2> /dev/null | strings | grep -E "$lcMagicCramfs|$lcMagicExt2fs|$lcMagicExt3fs|$lcMagicInitfs" 2> /dev/null` 781 fi 782 fi 783 784 # determine which filesystem to use for initrd image: ext2|3fs, gzip'ed cpio (initramfs) or cramfs 785 if [ `echo $lvScanRes | grep -Ec "$lcMagicExt2fs"` -eq 1 ]; then 786 lvUseFilesystem="ext2fs" 787 elif [ `echo $lvScanRes | grep -Ec "$lcMagicExt3fs"` -eq 1 ]; then 788 lvUseFilesystem="ext3fs" 789 elif [ `echo $lvScanRes | grep -Ec "$lcMagicInitfs"` -eq 1 ]; then 783 790 lvUseFilesystem="initramfs" 784 fi 791 elif [ `echo $lvScanRes | grep -Ec "$lcMagicCramfs"` -eq 1 ]; then 792 lvUseFilesystem="cramfs" 793 else 794 # In that case, we are most probably after 2.6.30 and use the supported initramfs 795 LogFile "No automatic detection found previously. Supposing initramfs." 796 LogFile "Report on the MondoRescue mailing-list withyour log files" 797 lvUseFilesystem="initramfs" 798 fi 799 785 800 # say what we are using 786 LogFile "INFO: 801 LogFile "INFO: GetInitrdFilesystemToUse(): Filesytem to use for initial ram disk is $lvUseFilesystem." 787 802 788 803 # return file system to use … … 922 937 file="$1" 923 938 924 echo $file | grep -q '\.\./' 925 if [ $? -eq 0 ]; then 939 while [ `echo $file | grep -Ec '\.\./'` -ne 0 ]; do 926 940 # We need to normalise the path with .. in it 927 file=`echo $file | perl -pi -e 's|([^/] +)/([^/]+)/\.\./([^/]+)|$1/$3|'`928 fi941 file=`echo $file | perl -pi -e 's|([^/]*)/([^/]+)/\.\./([^/]+)|$1/$3|g'` 942 done 929 943 echo "$file" 930 944 if [ ! -h $file ]; then … … 1804 1818 for i in $options ; do 1805 1819 ooo=$i 1806 [ "$ooo" = "RESTORE" ] && ooo=" nuke"1820 [ "$ooo" = "RESTORE" ] && ooo="RESTORE nuke" 1807 1821 if [ "$type" = "elilo" ]; then 1808 1822 outstr="image=/vmlinuz\n\tlabel=$i\n\tinitrd=/initrd.img\n\troot=/dev/ram0 append=\" rw ramdisk_size=$ramdisk_size $ooo $MINDI_ADDITIONAL_BOOT_PARAMS \"\n" … … 2588 2602 fi 2589 2603 done 2590 tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xUf - || LogIt " ERROR: Problem in minimal analysis" $MINDI_TMP/$$.log2604 tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xUf - || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log 2591 2605 2592 2606 # To improve support for distribution scripts, we now prefer to use bash as the std shell. Also fixes #600 … … 3231 3245 3232 3246 for i in loop cdrom ide-cd isofs linear raid0 raid1 raid5 ; do 3233 modinfo 2> /dev/null 1> /dev/null3247 modinfo $i 2> /dev/null 1> /dev/null 3234 3248 if [ $? -eq 0 ]; then 3235 3249 modprobe $i 2>&1 > /dev/null
Note:
See TracChangeset
for help on using the changeset viewer.