Ignore:
Timestamp:
May 5, 2013, 4:55:42 AM (6 years ago)
Author:
bruno
Message:
  • revert patch 3106-2107 from SVK which had removed good code and fixes !!
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mindi/mindi

    r3107 r3111  
    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
     763    # Kernel may be gzip compressed - Case of RHEL5 - SLES11SP1
    764764    file $lvKernelImage 2>&1 | grep -q gzip
    765765    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
    777776        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
    783790        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
    785800    # say what we are using
    786     LogFile "INFO:   GetInitrdFilesystemToUse(): Filesytem to use for initial ram disk is $lvUseFilesystem."
     801    LogFile "INFO: GetInitrdFilesystemToUse(): Filesytem to use for initial ram disk is $lvUseFilesystem."
    787802
    788803    # return file system to use
     
    922937    file="$1"
    923938
    924     echo $file | grep -q '\.\./'
    925     if [ $? -eq 0 ]; then
     939    while [ `echo $file | grep -Ec '\.\./'` -ne 0 ]; do
    926940        # We need to normalise the path with .. in it
    927         file=`echo $file | perl -pi -e 's|([^/]+)/([^/]+)/\.\./([^/]+)|$1/$3|'`
    928     fi
     941        file=`echo $file | perl -pi -e 's|([^/]*)/([^/]+)/\.\./([^/]+)|$1/$3|g'`
     942    done
    929943    echo "$file"
    930944    if [ ! -h $file ]; then
     
    18041818    for i in $options ; do
    18051819        ooo=$i
    1806         [ "$ooo" = "RESTORE" ] && ooo="nuke"
     1820        [ "$ooo" = "RESTORE" ] && ooo="RESTORE nuke"
    18071821        if [ "$type" = "elilo" ]; then
    18081822            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"
     
    25882602        fi
    25892603    done
    2590     tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xUf - || LogIt "ERROR: Problem in minimal analysis" $MINDI_TMP/$$.log
     2604    tar cf - $finallist 2>> $MINDI_TMP/$$.log | tar xUf - || LogIt "WARNING: Problem in minimal analysis" $MINDI_TMP/$$.log
    25912605
    25922606    # To improve support for distribution scripts, we now prefer to use bash as the std shell. Also fixes #600
     
    32313245
    32323246for i in loop cdrom ide-cd isofs linear raid0 raid1 raid5 ; do
    3233     modinfo 2> /dev/null 1> /dev/null
     3247    modinfo $i 2> /dev/null 1> /dev/null
    32343248    if [ $? -eq 0 ]; then
    32353249        modprobe $i 2>&1 > /dev/null
Note: See TracChangeset for help on using the changeset viewer.