Changeset 839 in MondoRescue for trunk/mondo/src/mondorestore/mondo-restore.c


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

merge -r814:838 $SVN_M/branches/stable

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.");
Note: See TracChangeset for help on using the changeset viewer.