Changeset 1295 for branches/2.2.2/mondo


Ignore:
Timestamp:
Apr 11, 2007, 8:59:49 PM (12 years ago)
Author:
bruno
Message:
  • evaluate_drive_within_mountlist is a private function
  • support UUID in mondorestore (Improvements for #103)
  • Fix a bug in size computation for cciss and similar devices needing a p before their partition name
Location:
branches/2.2.2/mondo/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.2/mondo/src/common/libmondo-mountlist-EXT.h

    r128 r1295  
    11/* libmondo-mountlist-EXT.h */
    22
    3 extern int evaluate_drive_within_mountlist(struct mountlist_itself
    4                                            *mountlist, char *drive,
    5                                            char *flaws_str);
    63extern int evaluate_mountlist(struct mountlist_itself *mountlist,
    74                              char *flaws_str_A, char *flaws_str_B,
  • branches/2.2.2/mondo/src/common/libmondo-mountlist.c

    r1236 r1295  
    400400
    401401    /*@ long *********************************************************** */
    402     long physical_drive_size = 0;
    403     long amount_allocated = 0;
     402    long physical_drive_size = 0L;
     403    long amount_allocated = 0L;
    404404
    405405    /*@ pointers ******************************************************* */
     
    433433
    434434    for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) {
    435         sprintf(device, "%s%d", drive, curr_part_no);
     435        if ((strstr(device, "/cciss/") != NULL) ||
     436            (strstr(device, "/ataraid/") != NULL) ||
     437            (strstr(device, "/ida/") != NULL) ||
     438            (strstr(device, "/rd/") != NULL)) {
     439                sprintf(device, "%sp%d", drive, curr_part_no);
     440            } else {   
     441                sprintf(device, "%s%d", drive, curr_part_no);
     442            }
    436443        pos = find_device_in_mountlist(mountlist, device);
    437444        if (pos < 0) {
     
    440447        if (physical_drive_size < 0) {
    441448            sprintf(tmp, " %s refers to non-existent hardware.", device);
     449            log_it(tmp);
    442450            strcat(flaws_str, tmp);
    443451            res++;
     
    969977#if linux
    970978        sscanf(incoming,
    971                "%s %s %s %s %s",
     979               "%s %s %s %s %s %s",
    972980               mountlist->el[items].device,
    973981               mountlist->el[items].mountpoint,
    974982               mountlist->el[items].format,
    975                siz, mountlist->el[items].label);
     983               siz, mountlist->el[items].label, mountlist->el[items].uuid);
    976984#elif __FreeBSD__
    977985        sscanf(incoming,
     
    981989               mountlist->el[items].format, siz);
    982990        strcpy(mountlist->el[items].label, "");
     991        strcpy(mountlist->el[items].uuid, "");
    983992#endif
    984993
     
    10291038
    10301039            sprintf(tmp,
    1031                     "%s %s %s %lld %s",
     1040                    "%s %s %s %lld %s %s",
    10321041                    mountlist->el[items].device,
    10331042                    mountlist->el[items].mountpoint,
    10341043                    mountlist->el[items].format,
    1035                     mountlist->el[items].size, mountlist->el[items].label);
     1044                    mountlist->el[items].size,
     1045                    mountlist->el[items].label,
     1046                    mountlist->el[items].uuid);
    10361047
    10371048            log_it(tmp);
     
    10791090                mountlist->el[i].device, mountlist->el[i].mountpoint,
    10801091                mountlist->el[i].format, mountlist->el[i].size,
    1081                 mountlist->el[i].label);
     1092                mountlist->el[i].label, mountlist->el[i].uuid);
    10821093    }
    10831094    paranoid_fclose(fout);
  • branches/2.2.2/mondo/src/common/libmondo-mountlist.h

    r128 r1295  
    44
    55
    6 int evaluate_drive_within_mountlist(struct mountlist_itself *mountlist,
    7                                     char *drive, char *flaws_str);
    86int evaluate_mountlist(struct mountlist_itself *mountlist,
    97                       char *flaws_str_A, char *flaws_str_B,
  • branches/2.2.2/mondo/src/common/mondostructures.h

    r998 r1295  
    6262   */
    6363    char label[256];
     64
     65    /**
     66     * This is the filesystem UUID (if there is one). If not, this should be "".
     67     */
     68    char uuid[64];
    6469};
    6570
  • branches/2.2.2/mondo/src/mondorestore/mondo-restore.c

    r1240 r1295  
    601601    /*  if (restore_some || restore_all || */
    602602    if (ask_me_yes_or_no
    603         ("Label your ext2 and ext3 partitions if necessary?")) {
     603        ("Label/Identify your ext2 and ext3 partitions if necessary?")) {
    604604        mvaddstr_and_log_it(g_currentY, 0,
    605                             "Using e2label to label your ext2,3 partitions");
     605                            "Using tune2fs to identify your ext2,3 partitions");
    606606        if (does_file_exist("/tmp/fstab.new")) {
    607607            strcpy(fstab_fname, "/tmp/fstab.new");
     
    840840    mvaddstr_and_log_it(g_currentY,
    841841                        0,
    842                         "Using e2label to label your ext2,3 partitions");
     842                        "Using tune2fs to identify your ext2,3 partitions");
    843843
    844844    sprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab",
  • branches/2.2.2/mondo/src/mondorestore/mondo-rstr-newt.h

    r541 r1295  
    137137                   struct raidlist_itself *);
    138138void edit_raidrec_additional_vars(struct raid_device_record *);
    139 int evaluate_drive_within_mountlist(struct mountlist_itself *, char *,
    140                                     char *);
    141139int evaluate_mountlist(struct mountlist_itself *, char *, char *, char *);
    142140int find_device_in_mountlist(struct mountlist_itself *, char *);
  • branches/2.2.2/mondo/src/restore-scripts/mondo/label-partitions-as-necessary

    r901 r1295  
    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.