Changeset 1903 in MondoRescue for branches/stable/mondo/src/mondorestore


Ignore:
Timestamp:
Apr 10, 2008, 1:13:58 AM (16 years ago)
Author:
Bruno Cornec
Message:

merge -r 1842:1889 2.2.5

Location:
branches/stable/mondo/src/mondorestore
Files:
2 edited

Legend:

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

    r1842 r1903  
    5656char *g_getfacl = NULL;
    5757
     58extern void kill_anything_like_this(char *str);
     59
    5860/**
    5961 * @addtogroup restoreUtilityGroup
     
    387389
    388390    char *command = NULL;
     391    char *tmp = NULL;
    389392    char *mountdir = NULL;
    390393    char *mountpoint = NULL;
     
    439442        mr_msg(2, "command='%s'", command);
    440443    }
     444
    441445    res = run_program_and_log_output(command, TRUE);
     446    if (res && (strstr(command, "xattr") || strstr(command, "acl"))) {
     447        mr_msg(1, "Re-trying without the fancy extra parameters");
     448        mr_asprintf(&tmp, "mount -t %s %s %s 2>> %s", format, device,
     449            mountdir, MONDO_LOGFILE);
     450        res = run_program_and_log_output(tmp, TRUE);
     451        mr_free(tmp);
     452    }
    442453    if (res) {
    443454        mr_msg(1, "Unable to mount device %s (type %s) at %s", device,
     
    449460        } else {
    450461            mr_msg(2, "Retrying w/o the '-t' switch");
    451             mr_free(command);
    452 
    453             mr_asprintf(&command, "mount %s %s 2>> %s", device, mountdir,
     462            mr_asprintf(&tmp, "mount %s %s 2>> %s", device, mountdir,
    454463                    MONDO_LOGFILE);
    455             mr_msg(2, "2nd command = '%s'", command);
    456             res = run_program_and_log_output(command, TRUE);
     464            mr_msg(2, "2nd command = '%s'", tmp);
     465            res = run_program_and_log_output(tmp, TRUE);
     466            mr_free(tmp);
    457467            if (res == 0) {
    458468                mr_msg(1,
     
    473483    }
    474484    mr_free(mountpoint);
    475 
    476485    return (res);
    477486}
     
    623632            mr_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    624633        }
     634
    625635#ifdef __FreeBSD__
    626636        mr_asprintf(&mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir,
     
    687697            break;
    688698        } else {
    689             mr_msg(2, "Failed to mount CD-ROM drive.");
     699            mr_msg(2, "Failed to mount device.");
    690700            sleep(5);
    691701            run_program_and_log_output("sync", FALSE);
     
    806816        } else if (!strcmp(value, "nfs")) {
    807817            bkpinfo->backup_media_type = nfs;
     818            bkpinfo->please_dont_eject = TRUE;
    808819            if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    809820                mr_allocstr(bkpinfo->prefix,value);
     
    842853        fatal_error("backup-media-type not specified!");
    843854    }
     855
    844856    if (bkpinfo->disaster_recovery) {
    845857        if (bkpinfo->backup_media_type == cdstream) {
     
    12861298#endif
    12871299    char *name = NULL;
     1300    char *cmd = NULL;
    12881301
    12891302    malloc_string(device);
    12901303    malloc_string(name);
     1304
     1305    /* In order to have a working bootloader, we need to have all devices
     1306     * ready in the chroot. If they are not there (udev) then copy them from
     1307     * the current /dev location
     1308     */
     1309    asprintf(&cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
     1310    run_program_and_log_output(cmd, 3);
     1311    paranoid_free(cmd);
     1312
    12911313    backup_crucial_file(MNT_RESTORING, "/etc/fstab");
    12921314    backup_crucial_file(MNT_RESTORING, "/etc/grub.conf");
    12931315    backup_crucial_file(MNT_RESTORING, "/etc/lilo.conf");
    12941316    backup_crucial_file(MNT_RESTORING, "/etc/elilo.conf");
     1317    backup_crucial_file(MNT_RESTORING, "/boot/grub/device.map");
     1318    backup_crucial_file(MNT_RESTORING, "/etc/mtab");
    12951319    read_cfg_var(g_mondo_cfg_file, "bootloader.device", device);
    12961320    read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
     
    13121336        mr_free(tmp);
    13131337    } else {
    1314         mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].*$'", device);
     1338        mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
    13151339        if (!system(tmp)) {
    13161340            mr_free(tmp);
     
    15341558                    newtSuspend();
    15351559                }
    1536                 mr_asprintf(&tmp, "%s " MNT_RESTORING "/etc/fstab", editor);
     1560                mr_asprintf(&tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
    15371561                paranoid_system(tmp);
    15381562                mr_free(tmp);
    15391563
    1540                 mr_asprintf(&tmp, "%s " MNT_RESTORING "/etc/elilo.conf", editor);
     1564                mr_asprintf(&tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor);
    15411565                paranoid_system(tmp);
    15421566                mr_free(tmp);
     
    21732197            if (!does_file_exist("tmp/mondo-restore.cfg")) {
    21742198                log_to_screen(_
    2175                               ("Cannot find config info on tape/CD"));
     2199                              ("Cannot find config info on media"));
    21762200                return (1);
    21772201            }
  • branches/stable/mondo/src/mondorestore/mondorestore.c

    r1770 r1903  
    437437    read_cfg_file_into_bkpinfo(g_mondo_cfg_file);
    438438    iamhere("Done loading config file; resizing ML");
    439     if (bkpinfo->backup_media_type != usb) {
     439    if (bkpinfo->backup_media_type == nfs) {
    440440        mr_asprintf(&tmp,bkpinfo->prefix);
    441441        if (popup_and_get_string
     
    19941994                       _("Please wait. This may take some time."),
    19951995                       "", total_slices);
    1996     for (bigfileno = 0, finished = FALSE; !finished;) {
     1996    for (bigfileno = 0 ; bigfileno < noof_biggiefiles ;) {
    19971997        mr_msg(2, "Thinking about restoring bigfile %ld", bigfileno + 1);
    19981998        if (!does_file_exist(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""))) {
     
    20042004                    g_current_media_number);
    20052005            mr_msg(3, "Slicename would have been %s",
    2006                     slice_fname(bigfileno + 1, 0, ARCHIVES_PATH, ""));
     2006                    slice_fname(bigfileno, 0, ARCHIVES_PATH, ""));
    20072007            // I'm not positive 'just_changed_cds' is even necessary...
    20082008            if (just_changed_cds) {
     
    20172017                just_changed_cds = TRUE;
    20182018            } else {
     2019                /* That big file doesn't exist, but the followings may */
     2020                /* So we need to continue looping */
    20192021                mr_msg(2, "There was no bigfile #%ld. That's OK.",
    2020                         bigfileno + 1);
     2022                    bigfileno + 1);
    20212023                mr_msg(2, "I'm going to stop restoring bigfiles now.");
    2022                 finished = TRUE;
     2024                retval++;
     2025                bigfileno++;
    20232026            }
    20242027        } else {
     
    30123015    }
    30133016
     3017    if (argc == 3 && strcmp(argv[1], "-K") == 0) {
     3018        g_loglevel = atoi(argv[2]);
     3019        log_msg(1,"Loglevel forced to %s",g_loglevel);
     3020    }
    30143021
    30153022    if (argc == 2 && strcmp(argv[1], "--live-grub") == 0) {
     
    31693176            mvaddstr_and_log_it(g_currentY++,
    31703177                                0,
    3171                                 _("Run complete. Please remove CD/media and reboot."));
     3178                                _("Run complete. Please remove media and reboot."));
    31723179        } else {
    31733180            run_program_and_log_output("sync", FALSE);
     
    32263233    unlink("/tmp/mondo-run-prog.tmp");
    32273234    set_signals(FALSE);
    3228     mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir);
    3229     run_program_and_log_output(tmp, FALSE);
    3230     mr_free(tmp);
    32313235
    32323236    log_to_screen
     
    32433247        run_program_and_log_output("mount / -o remount,rw", 2);
    32443248    }                           // for b0rken distros
     3249    mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir);
     3250    run_program_and_log_output(tmp, FALSE);
     3251    mr_free(tmp);
     3252
    32453253    paranoid_MR_finish(retval); // frees global stuff plus bkpinfo
    32463254    free_libmondo_global_strings(); // it's fine to have this here :) really :)
Note: See TracChangeset for help on using the changeset viewer.