Ignore:
Timestamp:
Jan 29, 2007, 11:51:36 PM (17 years ago)
Author:
Bruno Cornec
Message:

Fixes to allow trunk to build under rpm format at least

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/mondorestore/mondo-rstr-tools.c

    r1081 r1084  
    200200        retval = 0;
    201201    }
    202 <<<<<<< .courant
    203202    mr_free(orig_fname);
    204 =======
    205     mr_free(mountpt);
    206     mr_free(command);
    207     mr_free(orig_fname);
    208 >>>>>>> .fusion-droit.r1080
    209203    return (retval);
    210204}
     
    270264
    271265    res = run_program_and_log_output(command, FALSE);
    272 <<<<<<< .courant
    273266    mr_free(command);
    274 =======
    275     mr_free(command);
    276     mr_free(file);
    277     mr_free(tmp);
    278 >>>>>>> .fusion-droit.r1080
    279267    if (res) {
    280268        return (FALSE);
     
    374362    log_msg(2, "%ld: bkpinfo->isodir is now %s", __LINE__,
    375363            bkpinfo->isodir);
    376 <<<<<<< .courant
    377 =======
    378     mr_free(mount_isodir_command);
    379     mr_free(tmp);
    380     mr_free(command);
    381 >>>>>>> .fusion-droit.r1080
    382364    return (retval);
    383365}
     
    436418        return (0);
    437419    }
    438 <<<<<<< .courant
    439420    if (!strcmp(mountpoint, "image")) {
    440421        mr_free(mountpoint);
    441422        return (0);
    442 =======
    443     if (!does_file_exist(rclocal_fname)) {
    444         mr_free(rclocal_fname);
    445         mr_free(newfile_fname);
    446         mr_free(tmp);
    447         return (1);
    448 >>>>>>> .fusion-droit.r1080
    449423    }
    450424    mr_asprintf(&tmp, "Mounting device %s   ", device);
     
    456430        mr_asprintf(&p1, "-o ro");
    457431    }
    458 <<<<<<< .courant
    459432    tmp = find_home_of_exe("setfattr");
    460433    if (tmp) {
     
    464437    }
    465438    mr_free(tmp);
    466 =======
    467     sprintf(tmp, "echo -en \"#!/bin/sh\
    468 \\n\
    469 \\n\
    470 grep -v mondorescue %s > %s\\n\
    471 rm -f /var/lock/subsys/*xfs*\\n\
    472 rm -f /var/run/xfs.*\\n\
    473 killall xfs\\n\
    474 service xfs start\\n\
    475 yes | rm -f %s\\n\
    476 \" > %s", rclocal_fname, rclocal_fname, newfile_fname, newfile_fname);
    477     sprintf(tmp, "chmod +x \"%s\"", newfile_fname);
    478     run_program_and_log_output(tmp, FALSE);
    479     mr_free(rclocal_fname);
    480     mr_free(newfile_fname);
    481     mr_free(tmp);
    482     return (0);
    483 }
    484 >>>>>>> .fusion-droit.r1080
    485439
    486440    tmp = find_home_of_exe("setfacl");
     
    666620    }
    667621    run_program_and_log_output("df -m", 3);
    668 <<<<<<< .courant
    669622    mr_free(mountlist);
    670 =======
    671     mr_free(mountlist);
    672     mr_free(tmp);
    673     mr_free(format);
    674     mr_free(these_failed);
    675 >>>>>>> .fusion-droit.r1080
    676623    return (retval);
    677624}
     
    703650        || bkpinfo->backup_media_type == udev) {
    704651        log_msg(8, "Tape/udev. Therefore, no need to mount CDROM.");
    705 <<<<<<< .courant
    706 =======
    707         mr_free(mount_cmd);
    708 >>>>>>> .fusion-droit.r1080
    709652        return 0;
    710653    }
     
    712655    if (!run_program_and_log_output("mount | grep -F " MNT_CDROM, FALSE)) {
    713656        log_msg(2, "mount_cdrom() - CD already mounted. Fair enough.");
    714 <<<<<<< .courant
    715 =======
    716         mr_free(mount_cmd);
    717 >>>>>>> .fusion-droit.r1080
    718657        return (0);
    719658    }
     
    807746        log_msg(2, "Mounted CD-ROM drive OK");
    808747    }
    809 <<<<<<< .courant
    810 =======
    811     mr_free(mount_cmd);
    812 >>>>>>> .fusion-droit.r1080
    813748    return (res);
    814749}
     
    819754
    820755/**
    821 <<<<<<< .courant
    822 =======
    823  * Mount @p device at @p mpt as @p format.
    824  * @param device The device (/dev entry) to mount.
    825  * @param mpt The directory to mount it on.
    826  * @param format The filesystem type of @p device.
    827  * @param writeable If TRUE, mount read-write; if FALSE, mount read-only.
    828  * @return 0 for success, nonzero for failure.
    829  */
    830 int mount_device(char *device, char *mpt, char *format, bool writeable)
    831 {
    832     int res = 0;
    833 
    834   /** malloc **/
    835     char *tmp, *command, *mountdir, *mountpoint, *additional_parameters;
    836 
    837     assert_string_is_neither_NULL_nor_zerolength(device);
    838     assert_string_is_neither_NULL_nor_zerolength(mpt);
    839     assert(format != NULL);
    840     malloc_string(tmp);
    841     malloc_string(command);
    842     malloc_string(mountdir);
    843     malloc_string(mountpoint);
    844     malloc_string(additional_parameters);
    845 
    846     if (!strcmp(mpt, "/1")) {
    847         strcpy(mountpoint, "/");
    848         log_msg(3, "Mommm! SME is being a dildo!");
    849     } else {
    850         strcpy(mountpoint, mpt);
    851     }
    852 
    853     if (!strcmp(mountpoint, "lvm")) {
    854         return (0);
    855     }
    856     if (!strcmp(mountpoint, "image")) {
    857         return (0);
    858     }
    859     sprintf(tmp, "Mounting device %s   ", device);
    860     log_msg(1, tmp);
    861     if (writeable) {
    862         strcpy(additional_parameters, "-o rw");
    863     } else {
    864         strcpy(additional_parameters, "-o ro");
    865     }
    866     if (find_home_of_exe("setfattr")) {
    867         strcat(additional_parameters, ",user_xattr");
    868     }
    869     if (find_home_of_exe("setfacl")) {
    870         strcat(additional_parameters, ",acl");
    871     }
    872 
    873     if (!strcmp(mountpoint, "swap")) {
    874         sprintf(command, "swapon %s", device);
    875     } else {
    876         if (!strcmp(mountpoint, "/")) {
    877             strcpy(mountdir, MNT_RESTORING);
    878         } else {
    879             sprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint);
    880         }
    881         sprintf(command, "mkdir -p %s", mountdir);
    882         run_program_and_log_output(command, FALSE);
    883         sprintf(command, "mount -t %s %s %s %s 2>> %s", format, device,
    884                 additional_parameters, mountdir, MONDO_LOGFILE);
    885         log_msg(2, "command='%s'", command);
    886     }
    887     res = run_program_and_log_output(command, TRUE);
    888     if (res && (strstr(command, "xattr") || strstr(command, "acl"))) {
    889         log_msg(1, "Re-trying without the fancy extra parameters");
    890         sprintf(command, "mount -t %s %s %s 2>> %s", format, device,
    891                 mountdir, MONDO_LOGFILE);
    892         res = run_program_and_log_output(command, TRUE);
    893     }
    894     if (res) {
    895         log_msg(1, "Unable to mount device %s (type %s) at %s", device,
    896                 format, mountdir);
    897         log_msg(1, "command was '%s'", command);
    898         if (!strcmp(mountpoint, "swap")) {
    899             log_to_screen(tmp);
    900         } else {
    901             log_msg(2, "Retrying w/o the '-t' switch");
    902             sprintf(command, "mount %s %s 2>> %s", device, mountdir,
    903                     MONDO_LOGFILE);
    904             log_msg(2, "2nd command = '%s'", command);
    905             res = run_program_and_log_output(command, TRUE);
    906             if (res == 0) {
    907                 log_msg(1,
    908                         "That's OK. I called mount w/o a filesystem type and it worked fine in the end.");
    909             } else {
    910                 log_to_screen(tmp);
    911             }
    912         }
    913     }
    914     if (res && !strcmp(mountpoint, "swap")) {
    915         log_msg(2, "That's ok. It's just a swap partition.");
    916         log_msg(2, "Non-fatal error. Returning 0.");
    917         res = 0;
    918     }
    919 
    920     mr_free(tmp);
    921     mr_free(command);
    922     mr_free(mountdir);
    923     mr_free(mountpoint);
    924     mr_free(additional_parameters);
    925 
    926     return (res);
    927 }
    928 
    929 /**************************************************************************
    930  *END_MOUNT_DEVICE                                                        *
    931  **************************************************************************/
    932 
    933 
    934 
    935 /**
    936 >>>>>>> .fusion-droit.r1080
    937756 * Fix some miscellaneous things in the filesystem so the system will come
    938757 * up correctly on the first boot.
     
    13091128    }
    13101129    g_backup_media_type = bkpinfo->backup_media_type;
    1311 <<<<<<< .courant
    13121130    bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
    13131131    g_backup_media_string = bkpinfo->backup_media_string;
    1314 =======
    1315     mr_free(value);
    1316     mr_free(tmp);
    1317     mr_free(command);
    1318     mr_free(iso_mnt);
    1319     mr_free(iso_path);
    1320     mr_free(old_isodir);
    1321 >>>>>>> .fusion-droit.r1080
    13221132    return (0);
    13231133}
     
    15091319                                      TRUE);
    15101320    }
    1511 <<<<<<< .courant
    1512 =======
    1513 
    1514     mr_free(command);
    1515     mr_free(tmp);
    1516 >>>>>>> .fusion-droit.r1080
    15171321    return (filelist);
    15181322}
     
    15391343    mr_asprintf(&command, "cp -f %s/%s %s/%s.pristine", path_root, filename,path_root, filename);
    15401344    res = run_program_and_log_output(command, 5);
    1541 <<<<<<< .courant
    15421345    mr_free(command);
    1543 =======
    1544     mr_free(tmp);
    1545     mr_free(command);
    1546 >>>>>>> .fusion-droit.r1080
    15471346    return (res);
    15481347}
     
    16271426        log_to_screen(_("Your boot loader ran OK"));
    16281427    }
    1629 <<<<<<< .courant
    1630 =======
    1631     mr_free(device);
    1632     mr_free(tmp);
    1633     mr_free(name);
    1634 >>>>>>> .fusion-droit.r1080
    16351428    return (retval);
    16361429}
     
    17851578        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    17861579    }
    1787 <<<<<<< .courant
    1788 =======
    1789     mr_free(rootdev);
    1790     mr_free(rootdrive);
    1791     mr_free(conffile);
    1792     mr_free(command);
    1793     mr_free(boot_device);
    1794     mr_free(tmp);
    1795     mr_free(editor);
    1796 
    1797 >>>>>>> .fusion-droit.r1080
    17981580    return (res);
    17991581}
     
    18661648        res = TRUE;
    18671649    }
    1868 <<<<<<< .courant
    1869 =======
    1870     mr_free(command);
    1871     mr_free(tmp);
    1872     mr_free(editor);
    1873 >>>>>>> .fusion-droit.r1080
    18741650    return (res);
    18751651}
     
    19851761                                   " lilo -M /dev/sda", 3);
    19861762    }
    1987 <<<<<<< .courant
    1988 =======
    1989     mr_free(command);
    1990     mr_free(tmp);
    1991     mr_free(editor);
    1992 >>>>>>> .fusion-droit.r1080
    19931763    return (res);
    19941764}
     
    20711841        mvaddstr_and_log_it(g_currentY++, 74, _("Done."));
    20721842    }
    2073 <<<<<<< .courant
    2074 =======
    2075     mr_free(command);
    2076     mr_free(boot_device);
    2077     mr_free(tmp);
    2078     mr_free(editor);
    2079 >>>>>>> .fusion-droit.r1080
    20801843    return (res);
    20811844}
     
    21781941    paranoid_fclose(fout);
    21791942    paranoid_fclose(fin);
    2180 <<<<<<< .courant
    2181 =======
    2182     mr_free(incoming);
    2183 >>>>>>> .fusion-droit.r1080
    21841943}
    21851944/**************************************************************************
     
    22281987    }
    22291988    close_progress_form();
    2230 <<<<<<< .courant
    2231 =======
    2232     mr_free(tmp);
    2233 >>>>>>> .fusion-droit.r1080
    22341989}
    22351990/**************************************************************************
     
    23652120        log_to_screen(_("All partitions were unmounted OK."));
    23662121    }
    2367 <<<<<<< .courant
    2368     free(mountlist);
    2369 =======
    23702122    mr_free(mountlist);
    2371     mr_free(command);
    2372     mr_free(tmp);
    2373 >>>>>>> .fusion-droit.r1080
    23742123    return (retval);
    23752124}
     
    24072156        res = 0;
    24082157    }
    2409 <<<<<<< .courant
    2410 =======
    2411     mr_free(command);
    2412 >>>>>>> .fusion-droit.r1080
    24132158    return (res);
    24142159}
     
    26792424
    26802425    g_backup_media_type = bkpinfo->backup_media_type;
    2681 <<<<<<< .courant
    26822426    bkpinfo->backup_media_string = bkptype_to_string(bkpinfo->backup_media_type);
    26832427    g_backup_media_string = bkpinfo->backup_media_string;
    2684 =======
    2685     mr_free(device);
    2686     mr_free(command);
    2687     mr_free(tmp);
    2688     mr_free(cfg_file);
    2689     mr_free(mounted_cfgf_path);
    2690     mr_free(mountpt);
    2691     mr_free(ramdisk_fname);
    2692     mr_free(mountlist_file);
    2693 >>>>>>> .fusion-droit.r1080
    26942428    return (retval);
    26952429}
     
    27452479        }
    27462480    }
    2747 <<<<<<< .courant
    27482481    mr_free(raidlist);
    2749 =======
    2750     mr_free(screen_message);
    2751     mr_free(raidlist);
    2752 >>>>>>> .fusion-droit.r1080
    2753 }
     2482}
Note: See TracChangeset for help on using the changeset viewer.