Changeset 1297 in MondoRescue


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)
Location:
branches/stable/mondo
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/ChangeLog

    r1292 r1297  
    33MONDO CHANGES
    442.2.2 (2007-04-08)
     5- support UUID in mondorestore (Fix #103) (Bruno Cornec)
     6- Fix a bug in size computation for cciss and similar devices needing a p before their partition name (Bruno Cornec)
     7- Fix 2 references to grep -x (Fix for #96) (Bruno Cornec)
    58- Add build support for Mandriva 2007.1, RREL 5 and Debian 4.0 (Bruno Cornec)
    69- Handle no compression + verify correctly (Scott Cummings)
  • branches/stable/mondo/src/common/libmondo-mountlist-EXT.h

    r128 r1297  
    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/stable/mondo/src/common/libmondo-mountlist.c

    r1180 r1297  
    411411
    412412    for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) {
    413         mr_asprintf(&device, "%s%d", drive, curr_part_no);
     413        if ((strstr(device, "/cciss/") != NULL) ||
     414            (strstr(device, "/ataraid/") != NULL) ||
     415            (strstr(device, "/ida/") != NULL) ||
     416            (strstr(device, "/rd/") != NULL)) {
     417                mr_asprintf(&device, "%sp%d", drive, curr_part_no);
     418                sprintf(device, "%sp%d", drive, curr_part_no);
     419            } else {   
     420                mr_asprintf(&device, "%s%d", drive, curr_part_no);
     421            }
    414422        pos = find_device_in_mountlist(mountlist, device);
    415423        if (pos < 0) {
     
    418426        if (physical_drive_size < 0) {
    419427            mr_asprintf(&tmp, " %s refers to non-existent hardware.", device);
     428            log_it(tmp);
    420429            strcat(flaws_str, tmp);
    421430            res++;
     
    848857#if linux
    849858        sscanf(incoming,
    850                "%s %s %s %s %s",
     859               "%s %s %s %s %s %s",
    851860               mountlist->el[items].device,
    852861               mountlist->el[items].mountpoint,
    853862               mountlist->el[items].format,
    854                siz, mountlist->el[items].label);
     863               siz, mountlist->el[items].label, mountlist->el[items].uuid);
    855864#elif __FreeBSD__
    856865        sscanf(incoming,
     
    860869               mountlist->el[items].format, siz);
    861870        strcpy(mountlist->el[items].label, "");
     871        strcpy(mountlist->el[items].uuid, "");
    862872#endif
    863873
     
    914924                     mountlist->el[items].format,
    915925                     mountlist->el[items].size,
    916                      mountlist->el[items].label);
     926                    mountlist->el[items].label,
     927                    mountlist->el[items].uuid);
    917928            items++;
    918929        }
     
    956967                mountlist->el[i].device, mountlist->el[i].mountpoint,
    957968                mountlist->el[i].format, mountlist->el[i].size,
    958                 mountlist->el[i].label);
     969                mountlist->el[i].label, mountlist->el[i].uuid);
    959970    }
    960971    paranoid_fclose(fout);
  • branches/stable/mondo/src/common/libmondo-mountlist.h

    r128 r1297  
    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/stable/mondo/src/common/mondostructures.h

    r1113 r1297  
    4545   */
    4646    char label[256];
     47
     48    /**
     49     * This is the filesystem UUID (if there is one). If not, this should be "".
     50     */
     51    char uuid[64];
    4752};
    4853
     
    785790};
    786791
    787 
    788792/**
    789793 * A tape catalog, made of a list of @p s_tapecat_entry.
    790794 */
    791795struct s_tapecatalog {
    792         /**
    793     * The number of entries in the tape catalog.
    794     */
    795     int entries;
    796 
    797         /**
    798     * The entries themselves, all @p entries of them.
    799     */
    800     struct s_tapecat_entry el[MAX_TAPECATALOG_ENTRIES];
    801 };
     796               /**
     797        * The number of entries in the tape catalog.
     798        */
     799       int entries;
     800
     801               /**
     802        * The entries themselves, all @p entries of them.
     803        */
     804       struct s_tapecat_entry el[MAX_TAPECATALOG_ENTRIES];
     805};
  • branches/stable/mondo/src/mondorestore/mondo-rstr-newt.h

    r1200 r1297  
    105105                   struct raidlist_itself *);
    106106void edit_raidrec_additional_vars(struct raid_device_record *);
    107 int evaluate_drive_within_mountlist(struct mountlist_itself *, char *,
    108                                     char *);
    109107int evaluate_mountlist(struct mountlist_itself *, char *, char *, char *);
    110108int find_device_in_mountlist(struct mountlist_itself *, char *);
  • branches/stable/mondo/src/mondorestore/mondorestore.c

    r1269 r1297  
    585585    /*  if (restore_some || restore_all || */
    586586    if (ask_me_yes_or_no
    587         (_("Label your ext2 and ext3 partitions if necessary?"))) {
     587        (_("Label/Identify your ext2 and ext3 partitions if necessary?"))) {
    588588        mvaddstr_and_log_it(g_currentY, 0,
    589                             _("Using e2label to label your ext2,3 partitions"));
     589                            _("Using tune2fs to identify your ext2,3 partitions"));
    590590        if (does_file_exist("/tmp/fstab.new")) {
    591591            mr_asprintf(&fstab_fname, "/tmp/fstab.new");
     
    838838    mvaddstr_and_log_it(g_currentY,
    839839                        0,
    840                         _("Using e2label to label your ext2,3 partitions"));
     840                        _("Using tune2fs to identify your ext2,3 partitions"));
    841841
    842842    mr_asprintf(&tmp, "label-partitions-as-necessary %s < /tmp/fstab",
  • 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.