Changeset 525 for branches/2.0.8


Ignore:
Timestamp:
May 5, 2006, 11:52:49 AM (13 years ago)
Author:
bcornec
Message:

merge -r 522:523 $SVN_M/branches/stable (swap label v2)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0.8/mindi/mindi

    r519 r525  
    13381338    [ "$c_p" = "none" ] && continue
    13391339    absolute_partition=`ResolveSoftlink $c_p`
    1340     partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | grep -w "$current_partition" | grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
     1340    partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
    13411341
    13421342    # This part tries to retrieve the correct device from a LABEL line in /etc/fstab
    13431343    # current_partition contains only first column of /etc/fstab
    1344     redhat_label=""
    13451344    if [ "`echo "$current_partition" | /bin/grep -f -i "LABEL="`" != "" ] ; then
    13461345        str_to_find_fmt_with=$current_partition
     
    13501349        # 1st try : blkid, the good way
    13511350        if [ -x "/sbin/blkid" ] ; then
    1352             actual_dev=`/sbin/blkid | grep "$current_partition" | /bin/cut -d':' -f1`
    1353         fi
     1351            actual_dev=`/sbin/blkid | /bin/grep "$current_partition" | /bin/cut -d':' -f1`
     1352        fi
     1353
    13541354        # 2nd try, which works on a standard partition (ext2/3), but not on swap
    1355         if [ $actual_dev="" ] ; then
     1355        if [ -n $actual_dev ] ; then
    13561356            actual_dev=`/bin/mount -l | /bin/grep " [$redhat_label]" | /bin/cut -d' ' -f1`
    13571357        fi
     1358
    13581359        # 3rd try, with vol_id (which works with swap)
    1359         if [ $actual_dev="" -a -x "/sbin/vol_id" ] ; then
     1360        if [ -n $actual_dev -a -x "/sbin/vol_id" ] ; then
    13601361                list_swaps=`cat /proc/swaps | /bin/grep "/dev/" | /bin/awk '{ print $1 }' `
    13611362                for dev_swap in $list_swaps ; do
    1362                     dev_exists=`/sbin/vol_id $dev_swap | /bin/grep -f "$redhat_label"`
     1363                    dev_exists=`/sbin/vol_id $dev_swap | /bin/grep "$redhat_label"`
    13631364                    if [ -n "$dev_exists" ] ; then
    13641365                        actual_dev=$dev_swap
     
    13671368                done
    13681369        fi
     1370
    13691371        # 4th try : pre-formated LABEL. Format is : LABEL=SWAP-mydevice. e.g. : LABEL=SWAP-hda5
    1370         if [ $actual_dev="" -a  "`echo "$current_partition" | /bin/grep -f -i "LABEL=SWAP"`" != ""] ; then
    1371                 actual_dev="/dev/`echo "$redhat_label" | /bin/cut -d '-' -f2`"
    1372         fi
     1372        if [ -n $actual_dev -a  "`echo "$current_partition" | /bin/grep -i "LABEL=SWAP"`" != ""] ; then
     1373                try_dev="`echo "$redhat_label" | /bin/cut -d '-' -f2`"
     1374                present_dev="`/bin/cat /proc/swaps | /bin/grep -w /dev/$try_dev`"
     1375                if [ -n "$present_dev" ] ; then
     1376                    actual_dev="/dev/$try_dev"
     1377                fi
     1378        fi
     1379
    13731380        # Check if one of all those tries has known success
    1374         if [  $actual_dev != "" ] ; then
     1381        if [ ! -n $actual_dev ] ; then
    13751382                current_partition=$actual_dev
    13761383        else
    1377             Die "Your system uses a labelled swap partition, but you lack the tool to su
    1378 pport it.\nPlease replace swap labels with their correct devices in /etc/fstab\n"
     1384            Die "Your system uses a labelled swap partition, but you lack the tool to support it.\nPlease replace swap labels with their correct devices in /etc/fstab\n"
    13791385        fi
    13801386    else
Note: See TracChangeset for help on using the changeset viewer.