Changeset 618 in MondoRescue for trunk/mindi/mindi


Ignore:
Timestamp:
Jun 3, 2006, 12:16:18 AM (18 years ago)
Author:
bcornec
Message:

merge -r 591:617 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mindi/mindi

    r588 r618  
    13661366   
    13671367    if [ -d "/proc/lvm" ] || [ -d "/dev/mapper" ]; then
    1368     echo -en "\rAnalyzing LVM...\r"
    1369     all_partitions=`$MINDI_LIB/analyze-my-lvm | fgrep ">>>" | cut -d' ' -f2-32`
     1368        echo -en "\rAnalyzing LVM...\r"
     1369        all_partitions=`$MINDI_LIB/analyze-my-lvm | fgrep ">>>" | cut -d' ' -f2-32`
    13701370    fi
    13711371    all_partitions="$all_partitions `ListAllPartitions 2> /dev/null`"
     
    13781378    for c_p in $all_partitions ; do
    13791379#        echo "c_p = $c_p" > /dev/stderr
    1380     [ "`echo "/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw" | fgrep "$c_p"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/scd"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/ram"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | fgrep ":/"`" != "" ] && continue
     1380        [ "`echo "/dev/floppy /dev/fd0h1440 /dev/fd0H1440 /dev/cdrom /dev/cdrom/cdrom /dev/cdrom/cdrom1 /dev/cdrom/cdrom2 /dev/cdrom0 /dev/cdrom1 /dev/cdrom2 /dev/cdrom3 /dev/cdrw" | fgrep "$c_p"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/scd"`" != "" ] || [ "`echo "$c_p" | fgrep "/dev/ram"`" != "" ] || [ "`echo "$c_p" | grep ":"`" != "" ] || [ "`echo "$c_p" | fgrep ":/"`" != "" ] && continue
    13811381        [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | fgrep "$c_p"`" ] && continue
    1382     [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue
    1383     if [ -h "$c_p" ] && [ "`echo "$c_p" | fgrep "/dev/hd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/sd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/md"`" = "" ] ; then
    1384         current_partition=`ResolveSoftlink $c_p`
    1385         [ "`echo "$current_partition" | fgrep "/dev/mapper"`" != "" ] && current_partition="$c_p"
    1386         [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | fgrep "$current_partition"`" ] && continue
    1387     else
    1388         current_partition="$c_p"
    1389     fi
    1390     [ "$c_p" = "none" ] && continue
    1391     absolute_partition=`ResolveSoftlink $c_p`
    1392     partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
    1393 
    1394     # This part tries to retrieve the correct device from a LABEL line in /etc/fstab
    1395     # current_partition contains only first column of /etc/fstab
    1396     if [ "`echo "$current_partition" | /bin/grep -f -i "LABEL="`" != "" ] ; then
    1397         str_to_find_fmt_with=$current_partition
    1398         redhat_label=`echo "$current_partition" | /bin/cut -d'=' -f2`
    1399         actual_dev=""
    1400 
     1382        [ "`echo "$c_p" | grep -x "/dev/cdroms.*"`" ] && continue
     1383        if [ -h "$c_p" ] && [ "`echo "$c_p" | fgrep "/dev/hd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/sd"`" = "" ] && [ "`echo "$c_p" | fgrep "/dev/md"`" = "" ] ; then
     1384            current_partition=`ResolveSoftlink $c_p`
     1385            [ "`echo "$current_partition" | fgrep "/dev/mapper"`" != "" ] && current_partition="$c_p"
     1386            [ "`echo "/dev/scd0 /dev/scd1 /dev/sr0 /dev/sr1 /dev/cdrom /dev/cdrom1" | fgrep "$current_partition"`" ] && continue
     1387        else
     1388            current_partition="$c_p"
     1389        fi
     1390        [ "$c_p" = "none" ] && continue
     1391        absolute_partition=`ResolveSoftlink $c_p`
     1392        partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
     1393
     1394        # This part tries to retrieve the correct device from a LABEL line in /etc/fstab
     1395        # current_partition contains only first column of /etc/fstab
     1396        if [ "`echo "$current_partition" | /bin/grep -i "LABEL="`" != "" ]; then
     1397            str_to_find_fmt_with=$current_partition
     1398            redhat_label=`echo "$current_partition" | /bin/cut -d'=' -f2`
     1399            actual_dev=""
     1400   
    14011401        # 1st try : blkid, the good way
    1402         if [ -x "/sbin/blkid" ] ; then
     1402        if [ -x "/sbin/blkid" ]; then
    14031403            actual_dev=`/sbin/blkid | /bin/grep "$current_partition" | /bin/cut -d':' -f1`
    14041404        fi
    14051405
    14061406        # 2nd try, which works on a standard partition (ext2/3), but not on swap
    1407         if [ "x$actual_dev" = "x" ] ; then
    1408             actual_dev=`/bin/mount -l | /bin/grep " [$redhat_label]" | /bin/cut -d' ' -f1`
     1407        if [ "x$actual_dev" = "x" ]; then
     1408            actual_dev=`/bin/mount -l | /bin/grep "\[$redhat_label\]" | /bin/cut -d' ' -f1`
    14091409        fi
    14101410
    14111411        # 3rd try, with vol_id (which works with swap)
    1412         if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ] ; then
     1412        if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then
    14131413                list_swaps=`cat /proc/swaps | /bin/grep "/dev/" | /bin/awk '{ print $1 }' `
    14141414                for dev_swap in $list_swaps ; do
    14151415                    dev_exists=`/sbin/vol_id $dev_swap | /bin/grep "$redhat_label"`
    1416                     if [ "x$dev_exists" != "x" ] ; then
     1416                    if [ "x$dev_exists" != "x" ]; then
    14171417                        actual_dev=$dev_swap
    14181418                        break;
     
    14221422
    14231423        # 4th try : pre-formated LABEL. Format is : LABEL=SWAP-mydevice. e.g. : LABEL=SWAP-hda5
    1424         if [ "x$actual_dev" = "x" -a  "`echo "$current_partition" | /bin/grep -i "LABEL=SWAP"`" != ""] ; then
     1424        if [ "x$actual_dev" = "x" -a  _"`echo $current_partition | /bin/grep -i 'LABEL=SWAP'`" != _"" ]; then
    14251425                try_dev="`echo "$redhat_label" | /bin/cut -d '-' -f2`"
    14261426                present_dev="`/bin/cat /proc/swaps | /bin/grep -w /dev/$try_dev`"
     
    14311431
    14321432        # Check if one of all those tries has known success
    1433         if [ "x$actual_dev" != "x" ] ; then
     1433        if [ "x$actual_dev" != "x" ]; then
    14341434                current_partition=$actual_dev
    14351435        else
     
    14411441
    14421442    partition_format=`$AWK '$1 == "'"$str_to_find_fmt_with"'" {print $3}' $MY_FSTAB`
    1443     if [ -d "/proc/lvm" ] && [ "`lvdisplay $current_partition 2> /dev/null`" ] ; then
     1443    if [ -d "/proc/lvm" ] && [ "`lvdisplay $current_partition 2> /dev/null`" ]; then
    14441444        partition_size="lvm"
    1445     elif [ -d "/dev/mapper" ] && [ "`lvm lvdisplay $current_partition 2> /dev/null`" ] ; then
     1445    elif [ -d "/dev/mapper" ] && [ "`lvm lvdisplay $current_partition 2> /dev/null`" ]; then
    14461446        partition_size="lvm"
    14471447    else
Note: See TracChangeset for help on using the changeset viewer.