Changeset 1297 in MondoRescue for branches/stable/mondo/src/restore-scripts


Ignore:
Timestamp:
Apr 12, 2007, 1:56:35 AM (17 years ago)
Author:
Bruno Cornec
Message:
  • evaluate_drive_within_mountlist is a private function
  • support UUID in mondorestore (Fix for #103)
  • Fix a bug in size computation for cciss and similar devices needing a p before their partition name
  • Fix 2 references to grep -x which are not working during a restore process due to busybox limits of grep command (Fix for #96)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/restore-scripts/mondo/label-partitions-as-necessary

    r901 r1297  
    77
    88read_partition_line() {
    9     local tmp label mountpt mountline command format
    10     if [ "`echo "$1" | grep "LABEL="`" != "" ] ; then
     9    local tmp label mountpt command format
     10
     11    if [ "`echo "$1" | grep -E 'LABEL='`" != "" ] ; then
     12        opttun="-L"
     13    elif [ "`echo "$1" | grep -E 'UUID='`" != "" ] ; then
     14        opttun="-U"
     15    else
     16        # Nothing to do
     17        return
     18    fi
     19
    1120    tmp=`echo "$1" | tr -s ' ' '\t' | cut -f1`
    1221    label=`echo "$tmp" | cut -d'=' -f2`
    1322    format=`echo "$1" | tr -s ' ' '\t' | cut -f3`
    14     mountline=`mount | grep " $label "`
    15 #   mountpt=`echo "$mountline" | cut -d' ' -f1`
    16 !   mountpt=`grep " $label " $mountlist | cut -d' ' -f1`
    17         if [ ! "$mountpt" ] ; then
    18             LogIt "Not labeling anything as $label because $mountpt is not a mountpoint"
    19         elif [ ! "$label" ] ; then
    20             LogIt "Not labeling $mountpt as anything because $label is not a label"
    21         else
    22             if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then
    23                 command="e2label $mountpt $label"
    24                 LogIt "Running $command"
    25                 $command
    26             elif [ "$format" = "swap" ] ; then
    27                 command="mkswap -L $label $mountpt"
    28                 LogIt "Running $command"
    29             else
    30                 LogIt "I am NOT going to run e2label: the partition is format '$format', which doesn't like e2label anyway"
    31             fi
     23    mountpt=`grep -w " $label" $mountlist | cut -d' ' -f1`
     24    if [ ! "$mountpt" ] ; then
     25        LogIt "Not labeling anything as $label because $mountpt is not a mountpoint"
     26    elif [ ! "$label" ] ; then
     27        LogIt "Not labeling $mountpt as anything because $label is not a label"
     28    else
     29        if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then
     30            command="tune2fs $opttun $label $mountpt"
     31            LogIt "Running $command"
     32            $command
     33        elif [ "$format" = "swap" ] ; then
     34            if [ "$opttun" = "-U" ]; then
     35                echo "Unable yet to identify swap with UUID"
     36            else
     37                command="mkswap $opttun $label $mountpt"
     38                LogIt "Running $command"
     39                $command
     40            fi
     41        else
     42            LogIt "I am NOT going to run tune2fs: the partition is format '$format', which doesn't like tune2fs anyway"
     43        fi
    3244    fi
    33     fi
    3445}
    35 
    3646
    3747
    3848# ---------------------------------------------
    3949
    40 LogIt "Labeling your drives with e2label"
     50LogIt "Identifying your drives with tune2fs"
    4151if [ "$#" -ne "1" ] ; then
    4252    LogIt "label-partitions-as-necessary /tmp/mountlist.txt < /tmp/fstab.new" 1
Note: See TracChangeset for help on using the changeset viewer.