Changeset 839 in MondoRescue for trunk/mondo/src


Ignore:
Timestamp:
Sep 26, 2006, 9:47:32 AM (18 years ago)
Author:
Bruno Cornec
Message:

merge -r814:838 $SVN_M/branches/stable

Location:
trunk/mondo/src
Files:
7 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/mondo/src/common/Makefile.am

    r826 r839  
    88
    99libmondo_a_SOURCES  = libmondo-archive.c libmondo-devices.c libmondo-fifo.c \
    10                     libmondo-filelist.c libmondo-files.c libmondo-fork.c \
    11                     libmondo-mountlist.c libmondo-raid.c libmondo-msg.c \
    12                     libmondo-stream.c libmondo-string.c libmondo-tools.c \
    13                     libmondo-verify.c newt-specific.c \
    14                     libmondo-archive.h libmondo-devices.h \
    15                     libmondo-filelist.h libmondo-files.h libmondo-fork.h \
    16                     libmondo-mountlist.h libmondo-raid.h \
    17                     libmondo-stream.h libmondo-string.h libmondo-tools.h \
    18                     libmondo-verify.h libmondo-fifo.h \
    19                     libmondo-archive-EXT.h my-stuff.h mondostructures.h \
    20                     libmondo-devices-EXT.h libmondo-fifo-EXT.h \
    21                     libmondo-files-EXT.h libmondo-fork-EXT.h \
    22                     libmondo-filelist-EXT.h \
    23                     libmondo-mountlist-EXT.h libmondo-raid-EXT.h  \
    24                     libmondo-string-EXT.h libmondo-tools-EXT.h \
    25                     libmondo-verify-EXT.h  libmondo-stream-EXT.h \
    26                     newt-specific.h
     10                    libmondo-msg.c \
     11                       libmondo-filelist.c libmondo-files.c libmondo-fork.c \
     12                       libmondo-mountlist.c libmondo-raid.c \
     13                       libmondo-stream.c libmondo-string.c libmondo-tools.c \
     14                       libmondo-verify.c newt-specific.c \
     15                       libmondo-archive.h libmondo-devices.h \
     16                       libmondo-filelist.h libmondo-files.h libmondo-fork.h \
     17                       libmondo-gui.h libmondo-mountlist.h libmondo-raid.h \
     18                       libmondo-stream.h libmondo-string.h libmondo-tools.h \
     19                       libmondo-verify.h libmondo-fifo.h \
     20                       libmondo-archive-EXT.h my-stuff.h mondostructures.h \
     21                       libmondo-devices-EXT.h libmondo-fifo-EXT.h \
     22                       libmondo-files-EXT.h libmondo-fork-EXT.h \
     23                       libmondo-gui-EXT.h libmondo-filelist-EXT.h \
     24                       libmondo-mountlist-EXT.h libmondo-raid-EXT.h  \
     25                       libmondo-string-EXT.h libmondo-tools-EXT.h \
     26                       libmondo-verify-EXT.h  libmondo-stream-EXT.h \
     27                       newt-specific.h
  • trunk/mondo/src/common/libmondo-devices.c

    r835 r839  
    20262026    asprintf(&exclude_these_devices,
    20272027           call_program_and_get_last_line_of_output
    2028            ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|afs|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2028           ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    20292029           */
    20302030}
  • trunk/mondo/src/common/libmondo-filelist.c

    r795 r839  
    1717#include "newt-specific-EXT.h"
    1818#include "libmondo-tools-EXT.h"
    19 
     19#include "mr_string.h"
    2020
    2121#include <time.h>
     
    13181318                      char *skeleton_filelist)
    13191319{
     1320    const char delims[] = " ";
    13201321    DIR *dip = NULL;
    13211322    struct dirent *dit = NULL;
     1323
    13221324    struct stat statbuf;
    13231325    char *new = NULL;
     
    13291331    static char *name_of_evalcall_form = NULL;
    13301332    int i = 0;
     1333    char *strtmp = NULL;
     1334    char *token = NULL;
     1335    char *find_excludes = NULL;
     1336    int lastpos = 0;
    13311337    static int depth = 0;
    13321338    char *p = NULL;
     
    13471353    if (!depth) {
    13481354        malloc_string(find_skeleton_marker);
     1355        asprintf(&find_excludes, " ");
     1356        while((token = mr_strtok (sth, delims, &lastpos))) {
     1357          asprintf(&strtmp,"%s", find_excludes);
     1358          paranoid_free(find_excludes);
     1359          asprintf(&find_excludes,"%s -path %s -prune -o", strtmp, token);
     1360          paranoid_free(strtmp);
     1361          paranoid_free(token);
     1362        }
    13491363#if linux
    13501364        // 2.6 has /sys as a proc-type thing -- must be excluded
    1351         asprintf(&tmp,
    1352                 "find %s -maxdepth %d -fstype mvfs -prune -o -fstype afs -prune -o -path /proc -prune -o -path /sys -prune -o -path /dev/shm -prune -o -path /media/floppy -prune -o -type d -a -print > %s 2> /dev/null",
    1353                  dir, MAX_SKEL_DEPTH, skeleton_filelist);
     1365        asprintf(&strtmp,
     1366             "find %s -maxdepth %d -fstype mvfs -prune -o -path /dev/shm -prune -o %s -type d -print > %s 2> /dev/null",
     1367             dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
    13541368#else
    13551369        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1356         asprintf(&tmp,
    1357                 "find %s -maxdepth %d -fstype mvfs -prune -o -fstype afs -prune -o -path /proc -prune -o -type d -a -print > %s 2> /dev/null",
    1358                  dir, MAX_SKEL_DEPTH, skeleton_filelist);
     1370        asprintf(&strtmp,
     1371             "find %s -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null",
     1372                dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
     1373>>>>>>> .merge-right.r838
    13591374#endif
    1360         system(tmp);
     1375        paranoid_free(find_excludes);
     1376        log_msg(5, "find command = %s", strtmp);
     1377        system(strtmp);
     1378        paranoid_free(strtmp);
    13611379        paranoid_free(tmp);
    13621380
  • trunk/mondo/src/common/libmondo-files.c

    r808 r839  
    772772
    773773    asprintf(&command, "du -sk %s", mountpt);
     774    errno = 0;
    774775    fin = popen(command, "r");
    775     paranoid_free(command);
    776 
    777     (void) getline(&tmp, &n, fin);
    778     paranoid_pclose(fin);
    779     p = strchr(tmp, '\t');
    780     if (p) {
    781         *p = '\0';
    782     }
    783     for (p = tmp, llres = 0; *p != '\0'; p++) {
    784         llres *= 10;
    785         llres += (int) (*p - '0');
    786     }
     776    if (errno) {
     777      log_it("popen() FAILED: command=%s, mountpt=%s, fin=%d, errno=%d, strerror=%s", command, mountpt, fin, errno, strerror(errno));
     778      llres = 0;
     779    } else {
     780        (void) getline(&tmp, &n, fin);
     781        paranoid_pclose(fin);
     782        p = strchr(tmp, '\t');
     783        if (p) {
     784            *p = '\0';
     785        }
     786        for (p = tmp, llres = 0; *p != '\0'; p++) {
     787            llres *= 10;
     788            llres += (int) (*p - '0');
     789        }
     790    }
     791
     792    paranoid_free(command);
    787793    paranoid_free(tmp);
    788794    return (llres);
  • trunk/mondo/src/common/libmondo-raid.c

    r783 r839  
    1616#include "libmondo-string-EXT.h"
    1717#include "libmondo-raid.h"
     18#include "mr_string.h"
    1819
    1920#ifdef __FreeBSD__
  • trunk/mondo/src/mondorestore/mondo-restore.c

    r815 r839  
    749749            paranoid_free(tmp);
    750750            retval = interactive_mode(bkpinfo, mountlist, raidlist);
    751             finish(retval);
     751            goto after_the_nuke;
    752752        } else {
    753753            paranoid_free(tmp);
     
    853853    }
    854854    retval += res;
    855     call_me_after_the_nuke(retval);
    856     return(retval);
     855
     856  after_the_nuke:
     857    if (retval) {
     858        log_to_screen("Errors occurred during the nuke phase.");
     859    } else if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "RESTORE"))    // Bruno's thing
     860    {
     861        log_to_screen
     862            ("PC was restored successfully. Thank you for using Mondo Rescue.");
     863        log_to_screen
     864            ("Please visit our website at http://www.mondorescue.org for more information.");
     865    } else {
     866        strcpy(tmp,"Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");
     867        if (strstr(call_program_and_get_last_line_of_output("cat /proc/cmdline"), "restore") == NULL) {
     868            popup_and_OK(tmp);
     869        }
     870        log_to_screen
     871          ("Mondo has restored your system. Please wait for the command prompt.");
     872        log_to_screen
     873            ("Then remove the backup media and reboot.");
     874        log_to_screen
     875            ("Please visit our website at http://www.mondorescue.org for more information.");
     876    }
     877    g_I_have_just_nuked = TRUE;
     878/*
     879  if (!boot_loader_installed && !does_file_exist(DO_MBR_PLEASE))
     880    {
     881      log_to_screen("PLEASE RUN 'mondorestore --mbr' NOW TO INITIALIZE YOUR BOOT SECTOR");
     882      write_one_liner_data_file(DO_MBR_PLEASE, "mondorestore --mbr");
     883    }
     884*/
     885    return (retval);
     886>>>>>>> .merge-right.r838
    857887}
    858888/**************************************************************************
     
    26542684    struct s_node *filelist = NULL;
    26552685    char *a = NULL, *b = NULL;
     2686    bool run_postnuke = FALSE;
    26562687
    26572688  /**************************************************************************
     
    30673098
    30683099// g_I_have_just_nuked is set true by nuke_mode() just before it returns
    3069     if (g_I_have_just_nuked || does_file_exist("/POST-NUKE-ANYWAY")) {
    3070         if (!system("which post-nuke > /dev/null 2> /dev/null")) {
    3071             log_msg(1, "post-nuke found; running...");
    3072             if (mount_all_devices(mountlist, TRUE)) {
    3073                 log_to_screen
    3074                     (_
    3075                      ("Unable to re-mount partitions for post-nuke stuff"));
    3076             } else {
    3077                 log_msg(1, "Re-mounted partitions for post-nuke stuff");
    3078                 asprintf(&tmp, "post-nuke %s %d", bkpinfo->restore_path,
    3079                         retval);
    3080                 if (!g_text_mode) {
    3081                     newtSuspend();
    3082                 }
    3083                 log_msg(2, "Calling '%s'", tmp);
    3084                 if ((res = system(tmp))) {
    3085                     log_OS_error(tmp);
    3086                 }
    3087                 paranoid_free(tmp);
    3088                 if (!g_text_mode) {
    3089                     newtResume();
    3090                 }
    3091 //              newtCls();
    3092                 log_msg(1, "post-nuke returned w/ res=%d", res);
    3093             }
    3094             unmount_all_devices(mountlist);
    3095             log_msg(1, "I've finished post-nuking.");
    3096         }
    3097     }
     3100    if (!system("which post-nuke > /dev/null 2> /dev/null")) {
     3101      log_msg(1, "post-nuke found; find out whether we should run it...");
     3102      if (g_I_have_just_nuked || does_file_exist("/POST-NUKE-ANYWAY")) {
     3103        run_postnuke = TRUE;
     3104        log_msg(1, "Yes, will run post-nuke because in nuke mode or file /POST-NUKE-ANYWAY exists.");
     3105      } else if (ask_me_yes_or_no("post-nuke script found. Do you want to run it?")) {
     3106        run_postnuke = TRUE;
     3107        log_msg(1, "Yes, will run post-nuke because user interactively asked for it.");
     3108      } else {
     3109        run_postnuke = FALSE;
     3110        log_msg(1, "No, will not run post-nuke.");
     3111      }
     3112    } else {
     3113      log_msg(1, "No post-nuke found.");
     3114    }
     3115    if (run_postnuke) {
     3116      log_to_screen("Running post-nuke...");
     3117      if (mount_all_devices(mountlist, TRUE)) {
     3118        log_to_screen
     3119          ("Unable to re-mount partitions for post-nuke stuff");
     3120      } else {
     3121        log_msg(1, "Re-mounted partitions for post-nuke stuff");
     3122        sprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path,
     3123            retval);
     3124        log_msg(2, "Calling '%s'", tmp);
     3125        if ((res = run_program_and_log_output(tmp, 0))) {
     3126          log_OS_error(tmp);
     3127        }
     3128        log_msg(1, "post-nuke returned w/ res=%d", res);
     3129      }
     3130      unmount_all_devices(mountlist);
     3131      log_to_screen("I've finished post-nuking.");
     3132    }
     3133
    30983134/* 
    30993135  log_to_screen("If you are REALLY in a hurry, hit Ctrl-Alt-Del now.");
  • trunk/mondo/src/restore-scripts/mondo/stabgrub-me

    r588 r839  
    3434    old_fstab=/mnt/RESTORING/etc/fstab
    3535    old_grubconf=/mnt/RESTORING/etc/grub.conf
     36        # For some distros, e.g. Debian, /etc/grub.conf is a symbolic link
     37    # which we need to resolve and prepend with /mnt/RESTORING because
     38    # we run this outside the chroot.
     39    if [ -L "$old_grubconf" ] ; then
     40        old_grubconf=/mnt/RESTORING`readlink "$old_grubconf"`
     41    fi 
    3642    return 0
    3743    elif [ -f "/mnt/cdrom/archives/CUCKOO" ] ; then
Note: See TracChangeset for help on using the changeset viewer.