Ignore:
Timestamp:
May 5, 2013, 4:23:30 AM (6 years ago)
Author:
bruno
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/mindi

    r3103 r3107  
    756756
    757757    # say where we are.
    758     LogFile "INFO: GetInitrdFilesystemToUse(): called with parameter: $lvKernelImage"
     758    LogFile "INFO:   GetInitrdFilesystemToUse(): called with parameter: $lvKernelImage"
    759759
    760760    # verify that file exists
    761761    [ ! -f $lvKernelImage ] && Die "File $lvKernelImage not found. Terminating."
    762762
    763     # Kernel may be gzip compressed - Case of RHEL5 - SLES11SP1
     763    # Kernel may be gzip compressed
    764764    file $lvKernelImage 2>&1 | grep -q gzip
    765765    if [ $? -eq 0 ]; then
    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
     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"
    776777        else
    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
     778            lvUseFilesystem="UNSUPPORTED"
     779        fi
     780
     781    else
     782        # In that case, we are after 2.6.30 and use the supported initramfs
    790783        lvUseFilesystem="initramfs"
    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 
     784    fi
    800785    # say what we are using
    801     LogFile "INFO: GetInitrdFilesystemToUse(): Filesytem to use for initial ram disk is $lvUseFilesystem."
     786    LogFile "INFO:   GetInitrdFilesystemToUse(): Filesytem to use for initial ram disk is $lvUseFilesystem."
    802787
    803788    # return file system to use
     
    937922    file="$1"
    938923
    939     while [ `echo $file | grep -Ec '\.\./'` -ne 0 ]; do
     924    echo $file | grep -q '\.\./'
     925    if [ $? -eq 0 ]; then
    940926        # We need to normalise the path with .. in it
    941         file=`echo $file | perl -pi -e 's|([^/]*)/([^/]+)/\.\./([^/]+)|$1/$3|g'`
    942     done
     927        file=`echo $file | perl -pi -e 's|([^/]+)/([^/]+)/\.\./([^/]+)|$1/$3|'`
     928    fi
    943929    echo "$file"
    944930    if [ ! -h $file ]; then
     
    18181804    for i in $options ; do
    18191805        ooo=$i
    1820         [ "$ooo" = "RESTORE" ] && ooo="RESTORE nuke"
     1806        [ "$ooo" = "RESTORE" ] && ooo="nuke"
    18211807        if [ "$type" = "elilo" ]; then
    18221808            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"
     
    26022588        fi
    26032589    done
    2604     tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xUf - || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log
     2590    tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xUf - || LogIt "ERROR: Problem in minimal analysis" $MINDI_TMP/$$.log
    26052591
    26062592    # To improve support for distribution scripts, we now prefer to use bash as the std shell. Also fixes #600
     
    32453231
    32463232for i in loop cdrom ide-cd isofs linear raid0 raid1 raid5 ; do
    3247     modinfo $i 2> /dev/null 1> /dev/null
     3233    modinfo 2> /dev/null 1> /dev/null
    32483234    if [ $? -eq 0 ]; then
    32493235        modprobe $i 2>&1 > /dev/null
Note: See TracChangeset for help on using the changeset viewer.