Ignore:
Timestamp:
Dec 23, 2014, 7:49:06 AM (9 years ago)
Author:
Bruno Cornec
Message:
  • mindi now generates UUIDs in mountlist.txt if no LABEL nor UUID exist
  • Fix label-partitions-as-necessary to put back the original UUIDs to the partitions even if no LABEL or UUID line was used in fstab
  • Improve btrfs support
File:
1 edited

Legend:

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

    r3328 r3330  
    77
    88read_partition_line() {
    9     local label mountpt command format
     9    local label mountpt command format device d m
    1010
    11     label=`echo "$1" | awk '{print $1}' | cut -d'=' -f2`
     11    device=`echo "$1" | awk '{print $1}'`
     12    d=`echo "$device" | cut -c1`
    1213    format=`echo "$1" | awk '{print $3}'`
     14    label=`echo "$device" | cut -s -d'=' -f2`
     15    if [ "$d" = "/" ] && [ "$label" = "" ]; then
     16        m=`echo "$1" | awk '{print $2}'`
     17        # We force UUID even if nothing in fstab as some new distro like RHEL7 rely on it
     18        [ "$format" = "reiserfs" ] && opttun="-u" || opttun="-U"
     19        label=`awk '{print $2,$5}' $mountlist | grep -E "^$m " | awk '{print $2}'`
     20    else
     21        if [ "`echo "$1" | grep -E 'LABEL='`" != "" ] ; then
     22            [ "$format" = "reiserfs" ] && opttun="-l" || opttun="-L"
     23        elif [ "`echo "$1" | grep -E 'UUID='`" != "" ] ; then
     24            [ "$format" = "reiserfs" ] && opttun="-u" || opttun="-U"
     25        else
     26            LogIt "Nothing to do on $1"
     27            return
     28        fi
     29    fi
    1330    mountpt=`awk '{print $1,$5}' $mountlist | grep " $label$" | awk '{print $1}'`
    14 
    15     if [ "`echo "$1" | grep -E 'LABEL='`" != "" ] ; then
    16         [ "$format" = "reiserfs" ] && opttun="-l" || opttun="-L"
    17     elif [ "`echo "$1" | grep -E 'UUID='`" != "" ] ; then
    18         [ "$format" = "reiserfs" ] && opttun="-u" || opttun="-U"
    19     else
    20         LogIt "Nothing to do on $1"
    21         return
    22     fi
    2331
    2432    if [ ! "$mountpt" ] ; then
    2533        LogIt "Not labeling anything as ($label) because ($mountpt) is not a mountpoint"
    2634    elif [ ! "$label" ] ; then
    27         LogIt "Not labeling ($mountpt) as anything because ($label) is not a label"
     35        LogIt "Not labeling ($mountpt) as anything because ($label) is not a label/uuid"
    2836    else
    2937        if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] || [ "$format" = "ext4" ]; then
     
    3745        elif [ "$format" = "reiserfs" ]; then
    3846            command="reiserfstune $opttun $label $mountpt"
     47            LogIt "Running $command"
     48            $command
     49        elif [ "$format" = "btrfs" ]; then
     50            # Also see https://btrfs.wiki.kernel.org/index.php/Project_ideas#Filesystem_UUID_change_-_off-line
     51            command="btrfs filesystem label $mountpt $label"
    3952            LogIt "Running $command"
    4053            $command
Note: See TracChangeset for help on using the changeset viewer.