Changeset 1967 in MondoRescue for branches/2.2.6/mondo/src/mondorestore


Ignore:
Timestamp:
May 29, 2008, 5:40:05 PM (16 years ago)
Author:
Bruno Cornec
Message:
  • Remove all references to /root/images
  • Fix the lack of support for options in mondorestore by copying what is done for mondoarchive and sharing the functions analyzing the cli (getopt usage)
  • Review the now common handle_incoming_parameters to have it support correctly 2 modes (archiving and restoring)
  • Update mondorestore man page to take in account the options supported now
  • Replace mondorestore options --nuke, --interactive, with -Z nuke, -Z interactive ...
Location:
branches/2.2.6/mondo/src/mondorestore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mondo/src/mondorestore/mondo-rstr-newt.c

    r1741 r1967  
    23302330 * @param isodir_device Where to put the device (e.g. /dev/hda4) the user enters.
    23312331 * @param isodir_format Where to put the format (e.g. ext2) the user enters.
    2332  * @param isodir_path Where to put the path (e.g. /root/images/mondo) the user enters.
     2332 * @param isodir_path Where to put the path (e.g. /var/cache/mondo) the user enters.
    23332333 * @param nuke_me_please Whether we're planning on nuking or not.
    23342334 * @return TRUE if OK was pressed, FALSE otherwise.
  • branches/2.2.6/mondo/src/mondorestore/mondo-rstr-tools.c

    r1948 r1967  
    177177* Free the malloc()s for the filename variables.
    178178*/
    179 void free_MR_global_filenames()
     179void free_MR_global_filenames(void)
    180180{
    181181paranoid_free(g_biggielist_txt);
    182182paranoid_free(g_filelist_full);
    183183paranoid_free(g_filelist_imagedevs);
    184 //  paranoid_free (g_imagedevs_pot );
    185184paranoid_free(g_imagedevs_restthese);
    186185paranoid_free(g_mondo_cfg_file);
     
    19731972
    19741973
    1975 
    1976 
    1977 /**
    1978  * Turn signal trapping on or off.
    1979  * @param on If TRUE, then do full cleanup when we receive a signal; if FALSE, then
    1980  * print a message and exit immediately.
    1981  */
    1982 void set_signals(int on)
    1983 {
    1984     int signals[] =
    1985         { SIGKILL, SIGPIPE, SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT,
    1986 SIGSTOP, 0 };
    1987     int i;
    1988     for (i = 0; signals[i]; i++) {
    1989         if (on) {
    1990             signal(signals[i], terminate_daemon);
    1991         } else {
    1992             signal(signals[i], termination_in_progress);
    1993         }
    1994     }
    1995 }
    1996 
    1997 /**************************************************************************
    1998  *END_SET_SIGNALS                                                         *
    1999  **************************************************************************/
    2000 
    2001 
    20021974/**
    20031975 * malloc() and set sensible defaults for the mondorestore filename variables.
     
    20922064
    20932065/**
    2094  * Exit due to a signal (normal cleanup).
    2095  * @param sig The signal we're exiting due to.
    2096  */
    2097 void terminate_daemon(int sig)
    2098 {
    2099     log_to_screen
    2100         ("Mondorestore is terminating in response to a signal from the OS");
    2101     paranoid_MR_finish(254);
    2102 }
    2103 
    2104 /**************************************************************************
    2105  *END_TERMINATE_DAEMON                                                    *
    2106  **************************************************************************/
    2107 
    2108 
    2109 /**
    21102066 * Give the user twenty seconds to press Ctrl-Alt-Del before we nuke their drives.
    21112067 */
     
    21372093 *END_TWENTY_SECONDS_TIL_YIKES                                            *
    21382094 **************************************************************************/
    2139 
    2140 
    2141 
    2142 
    2143 
    2144 /**
    2145  * Exit due to a signal (no cleanup).
    2146  * @param sig The signal we're exiting due to.
    2147  */
    2148 void termination_in_progress(int sig)
    2149 {
    2150     log_msg(1, "Termination in progress");
    2151     usleep(1000);
    2152     pthread_exit(0);
    2153 }
    2154 
    2155 /**************************************************************************
    2156  *END_TERMINATION_IN_PROGRESS                                             *
    2157  **************************************************************************/
    2158 
    21592095
    21602096
  • branches/2.2.6/mondo/src/mondorestore/mondorestore.c

    r1966 r1967  
    31603160        finish(res);
    31613161    }
    3162        
     3162
    31633163    if ((argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) && (!bkpinfo->disaster_recovery)) {
    31643164        g_restoring_live_from_cd = TRUE;
     
    32053205
    32063206        // BCO:To be reviewed
    3207         if (argc > 1
    3208             && (strcmp(argv[1], "--compare") == 0
    3209                 || strcmp(argv[1], "--nuke") == 0)) {
     3207        if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) {
    32103208            if (bkpinfo->backup_media_type == nfs
    32113209                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
     
    32273225
    32283226
    3229         if (argc == 2 && strcmp(argv[1], "--nuke") == 0) {
     3227        if (bkpinfo->restore_mode == nuke) {
    32303228            iamhere("nuking");
    32313229            retval += nuke_mode(mountlist, raidlist);
    3232         } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) {
     3230        } else if (bkpinfo->restore_mode == interactive) {
    32333231            iamhere("catchall");
    32343232            retval += catchall_mode(mountlist, raidlist);
    3235         } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) {
     3233        } else if (bkpinfo->restore_mode == compare) {
    32363234            iamhere("compare");
    32373235            retval += compare_mode(mountlist, raidlist);
    3238         } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) {
     3236        } else if (bkpinfo->restore_mode == isoonly) {
    32393237            iamhere("iso");
    32403238            retval = iso_mode(mountlist, raidlist, FALSE);
    3241         } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) {
     3239        } else if (bkpinfo->restore_mode == mbr) {
    32423240            iamhere("mbr");
    32433241            retval = mount_all_devices(mountlist, TRUE);
     
    32493247                log_to_screen("Failed to write Master Boot Record");
    32503248            }
    3251         } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) {
     3249        } else if (bkpinfo->restore_mode == isonuke) {
    32523250            iamhere("isonuke");
    32533251            retval = iso_mode(mountlist, raidlist, TRUE);
    3254         } else if (argc != 1) {
    3255             log_to_screen("Invalid paremeters");
    3256             paranoid_MR_finish(1);
    32573252        } else {
    32583253            iamhere("catchall (no mode specified in command-line call");
  • branches/2.2.6/mondo/src/mondorestore/mondorestore.h

    r1644 r1967  
    99 */
    1010char *MONDO_LOGFILE = "/var/log/mondorestore.log";
     11char *MONDO_OPTIONS = "E:GI:J:K:QRT:UVZ:b:d:ef:gimn:op:tux:z";
    1112
    1213/* Busybox ps has no option and PID in first pos */
Note: See TracChangeset for help on using the changeset viewer.