Changeset 957


Ignore:
Timestamp:
Nov 21, 2006, 11:07:15 AM (12 years ago)
Author:
bruno
Message:

Preliminary UUID support (for Ubuntu and VMWare)
(they are not yet restored, just handled in mindi)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi/mindi

    r953 r957  
    924924    local res currline partition all_partitions ap_orig remaining i j
    925925
    926     grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
     926    grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||^LABEL\=\/|^UUID=/ && !/fdd|cdr|zip|floppy/ {print $1}'
    927927    [ -e "/etc/raidtab" ] && $AWK '/^ *device/ {print $2}' /etc/raidtab
    928928    return
     
    12111211        [ "$c_p" = "none" ] && continue
    12121212        redhat_label=""
     1213        uuid=""
    12131214        absolute_partition=`readlink -f $c_p`
    12141215        partition_mountpt=`tr -s '\t' ' ' < $MY_FSTAB | /bin/grep -w "$current_partition" | /bin/grep -vx " *#.*" | $AWK '{print $2}' | head -n1`
     
    12841285            fi
    12851286
     1287        # This part tries to retrieve the correct device from a UUID line in /etc/fstab
     1288        # current_partition contains only first column of /etc/fstab
     1289        if [ "`echo "$current_partition" | /bin/grep -i "UUID="`" != "" ]; then
     1290            str_to_find_fmt_with=$current_partition
     1291            uuid=`echo "$current_partition" | /bin/cut -d'=' -f2`
     1292            actual_dev=""
     1293
     1294            # 1st try, findfs - the RHEL way of finding labels and their partitions
     1295            if [ -x "/sbin/findfs" ]; then
     1296                actual_dev=`/sbin/findfs UUID=${uuid} 2> /dev/null`
     1297            fi
     1298   
     1299            # 2nd try : blkid, the good way for all LABEL except swap
     1300            if [ "x$actual_dev" = "x" -a -x "/sbin/blkid" ]; then
     1301                actual_dev=`/sbin/blkid | /bin/grep "$uuid" | grep UUID= | /bin/cut -d':' -f1`
     1302                # For LVM FS it will give a /dev/dm-# which should then be converted
     1303                if [ $LVM = "v2" ] && [ "`echo $actual_dev | grep '/dev/dm'`" ]; then
     1304                    major=`/bin/ls -l $actual_dev | awk '{print $5}'`
     1305                    minor=`/bin/ls -l $actual_dev | awk '{print $6}'`
     1306                    for dev in `ls /dev/mapper/*`; do
     1307                        major1=`/bin/ls -l $dev | awk '{print $5}'`
     1308                        minor1=`/bin/ls -l $dev | awk '{print $6}'`
     1309                        if [ $major1 = $major ] && [ $minor1 = $minor ]; then
     1310                            actual_dev=`/bin/ls -l $dev | awk '{print $10}'`
     1311                            break
     1312                        fi
     1313                    done
     1314                fi
     1315            fi
     1316   
     1317            # 3th try, with vol_id
     1318            if [ "x$actual_dev" = "x" -a -x "/sbin/vol_id" ]; then
     1319                list_dev=`mount | /bin/grep -E '^/' | /bin/awk '{ print $1 }' `
     1320                for dev in $list_dev ; do
     1321                    dev_exists=`/sbin/vol_id $dev | /bin/grep "$uuid"`
     1322                    if [ "x$dev_exists" != "x" ]; then
     1323                        actual_dev=$dev
     1324                        break;
     1325                    fi
     1326                done
     1327            fi
     1328
    12861329            # Check if one of all those tries has known success
    12871330            if [ "x$actual_dev" != "x" ]; then
    12881331                current_partition=$actual_dev
    12891332            else
    1290                 Die "Your system uses a labelled partition ($current_partition), but you lack the tool to support it.\nPlease replace labels with their correct devices in /etc/fstab or install findfs|blkid|vol_id\n"
     1333                Die "Your system uses a UUID partition ($current_partition), but you lack the tool to support it.\nPlease replace labels with their correct devices in /etc/fstab or install findfs|blkid|vol_id\n"
    12911334            fi
    12921335        else
Note: See TracChangeset for help on using the changeset viewer.