Changeset 1903 in MondoRescue for branches/stable/mondo


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
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1770 r1903  
    4242#define DVDRWFORMAT 1
    4343
    44 #ifndef __FreeBSD__
    4544#ifndef _SEMUN_H
    4645#define _SEMUN_H
     
    5655};
    5756#endif
    58 #endif                          /* __FreeBSD__ */
    5957
    6058extern struct mr_ar_conf *mr_conf;
     
    615613        }
    616614#else
     615#ifdef __IA64__
     616        strcpy(bootdev, call_program_and_get_last_line_of_output
     617               ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     618#else
    617619        strcpy(bootdev, call_program_and_get_last_line_of_output
    618620               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     621#endif
    619622        if (strstr(bootdev, "/dev/cciss/")) {
     623#ifdef __IA64__
     624            strcpy(bootdev, call_program_and_get_last_line_of_output
     625                   ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     626#else
    620627            strcpy(bootdev, call_program_and_get_last_line_of_output
    621628                   ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
     629#endif
    622630        }
    623631        if (!bootdev[0]) {
     
    31923200    /*@ bool ******************************************************** */
    31933201    bool that_one_was_ok;
    3194     bool using_nfs;
    31953202    bool orig_vfy_flag_val;
    31963203
     
    32043211    }
    32053212
    3206     if (strlen(bkpinfo->nfs_mount) > 1) {
    3207         using_nfs = TRUE;
    3208     } else {
    3209         using_nfs = FALSE;
    3210     }
    32113213    mr_msg(1, "OK, time to make %s #%d",
    32123214            bkpinfo->backup_media_string,
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1842 r1903  
    15761576    }
    15771577    if (bkpinfo->backup_media_type == tape && bkpinfo->restore_data) {
    1578         popup_and_OK(_("Please remove CD from drive"));
     1578        popup_and_OK(_("Please remove media from drive"));
    15791579    }
    15801580    mr_msg(3, "media type = %s",
     
    18041804
    18051805    case nfs:
     1806        /* Never try to eject a NFS device */
     1807        bkpinfo->please_dont_eject = TRUE;
     1808
     1809        /* Initiate bkpinfo nfs_mount path from running environment if not already done */
    18061810        if (!bkpinfo->nfs_mount[0]) {
    18071811            strcpy(bkpinfo->nfs_mount,
     
    18401844            mr_free(command);
    18411845
    1842             mr_asprintf(&comment,
     1846            if (!bkpinfo->restore_data) {
     1847                mr_asprintf(&comment,
    18431848                    _("How much data (in Megabytes) will each media store?"));
    1844             if (!popup_and_get_string(_("Size"), comment, sz_size, 5)) {
    1845                 log_to_screen(_("User has chosen not to backup the PC"));
    1846                 finish(1);
     1849                if (!popup_and_get_string(_("Size"), comment, sz_size, 5)) {
     1850                    log_to_screen(_("User has chosen not to backup the PC"));
     1851                    finish(1);
     1852                }
     1853            } else {
     1854                sz_size = 0;
    18471855            }
    18481856            mr_free(comment);
     
    18631871            }
    18641872        }
    1865         if (!is_this_device_mounted(bkpinfo->nfs_mount)) {
     1873        /* Initiate bkpinfo isodir path from running environment if mount already done */
     1874        if (is_this_device_mounted(bkpinfo->nfs_mount)) {
     1875            strcpy(bkpinfo->isodir,
     1876                   call_program_and_get_last_line_of_output
     1877                   ("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
     1878        } else {
    18661879            sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir);
    18671880            mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir);
  • branches/stable/mondo/src/common/libmondo-filelist.c

    r1817 r1903  
    15271527    time_t time_of_last_full_backup = 0;
    15281528    struct stat statbuf;
     1529    char *tmp1 = NULL;
     1530    char *tmp2 = NULL;
    15291531
    15301532    malloc_string(sz_datefile);
     
    15861588        mr_msg(2, "include_paths = '%s'", include_paths);
    15871589        mr_msg(1, "Calculating filelist");
    1588         mr_asprintf(&exclude_paths, " %s %s %s %s %s %s %s . .. \
    1589 " MNT_CDROM " /mnt/floppy /media \
    1590 /proc /sys /tmp /var/log/lastlog /root/images/mondo " MINDI_CACHE " " MONDO_CACHE, excp, call_program_and_get_last_line_of_output("locate /win386.swp 2> /dev/null"), call_program_and_get_last_line_of_output("locate /hiberfil.sys 2> /dev/null"), call_program_and_get_last_line_of_output("locate /pagefile.sys 2> /dev/null"), (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1590        mr_asprintf(&tmp2, call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|fat|vfat|dos' | awk '{print $3}'"));
     1591        if (strlen(tmp2) < 1) {
     1592            mr_asprintf(&tmp1,"");
     1593        } else {
     1594            mr_msg(2, "Found windows FS: %s",tmp2);
     1595            mr_asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1596            mr_free(tmp2);
     1597            mr_asprintf(&tmp2, call_program_and_get_last_line_of_output(tmp1));
     1598            mr_msg(2, "Found windows files: %s",tmp2);
     1599        }
     1600        mr_free(tmp1);
    15911601
    15921602        mr_msg(2, "Excluding paths = '%s'", exclude_paths);
     1603        mr_asprintf(&exclude_paths, " %s %s %s %s %s %s . .. \
     1604" MNT_CDROM " " MNT_FLOPPY " /media /tmp /var/log/lastlog \
     1605/proc /sys /root/images/mondo ", MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1606        paranoid_free(tmp2);
     1607
    15931608        mr_msg(2,
    15941609                "Generating skeleton filelist so that we can track our progress");
  • branches/stable/mondo/src/common/libmondo-stream.c

    r1663 r1903  
    885885        return (1);
    886886    }
     887    /* Not used
    887888    mr_asprintf(&tmp, "Reading file from tape; writing to '%s'; %ld KB",
    888889             outfname, (long) size >> 10);
    889     log_to_screen(tmp);
    890     mr_free(tmp);
     890            */
    891891
    892892    if (foutstream) {
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1842 r1903  
    901901
    902902    // abort if Windows partition but no ms-sys and parted
    903     if (!run_program_and_log_output
    904         ("mount | grep -w vfat | grep -vE \"/dev/fd|nexdisk\"", 0)
    905         ||
    906         !run_program_and_log_output
    907         ("mount | grep -w dos | grep -vE \"/dev/fd|nexdisk\"", 0)) {
     903    if (!run_program_and_log_output("mount | grep -Ew 'vfat|fat|dos' | grep -vE \"/dev/fd|nexdisk\"", 0)) {
    908904        log_to_screen(_("I think you have a Windows 9x partition."));
    909905        retval += whine_if_not_found("parted");
    910 #ifndef __IA64__
    911         /* IA64 always has one vfat partition for EFI even without Windows */
    912         // retval +=
    913         if (!find_home_of_exe("ms-sys")) {
    914             log_to_screen("Please install ms-sys just in case.");
    915         }
    916 #endif
    917906    }
    918907
  • branches/stable/mondo/src/common/newt-specific.c

    r1770 r1903  
    259259    kill_anything_like_this(char *str) {
    260260
    261     char *tmp = NULL;
    262 
    263     mr_asprintf(&tmp,"kill `ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"`", ps_options, str, ps_proc_id);
     261char *tmp = NULL;
     262char *tmp1 = NULL;
     263
     264    mr_asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str, ps_proc_id);
    264265    run_program_and_log_output(tmp, TRUE);
     266    if (strlen(tmp) > 0) {
     267        mr_asprintf(&tmp1,"kill `%s`", tmp);
     268        run_program_and_log_output(tmp1, TRUE);
     269        paranoid_free(tmp1);
     270    }
    265271    mr_free(tmp);
    266272}
  • branches/stable/mondo/src/mondoarchive/mondo-cli.c

    r1842 r1903  
    472472    if (flag_set['n']) {
    473473        bkpinfo->backup_media_type = nfs;
     474        /* Never try to eject a NFS device */
     475        bkpinfo->please_dont_eject = TRUE;
    474476    }
    475477    if (flag_set['r']) {
     
    761763                (_("Your kernel appears not to support vfat filesystems. I am therefore"));
    762764            log_to_screen
    763                 (_("using LILO instead of SYSLINUX as the CD's boot loader."));
     765                (_("using LILO instead of SYSLINUX as the media boot loader."));
    764766        }
    765767        if (run_program_and_log_output("which mkfs.vfat", 2)) {
  • 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.