Ignore:
Timestamp:
Jun 2, 2008, 10:49:01 AM (12 years ago)
Author:
Bruno Cornec
Message:

svn merge -r 1938:1976 $SVN_M/branches/2.2.6

File:
1 edited

Legend:

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

    r1939 r1977  
    33243324
    33253325extern int partition_everything(struct mountlist_itself *mountlist);
    3326 
     3326extern int handle_incoming_parameters(int argc, char *argv[]);
    33273327
    33283328/**
     
    35453545    c = which_restore_mode();
    35463546    iamhere("post wrm");
    3547     if (c == 'I' || c == 'N' || c == 'C') {
     3547    if (c == 'I' || c == 'C') {
    35483548        interactively_obtain_media_parameters_from_user(FALSE);
     3549    } else if (c == 'N') {
     3550        // Auto mode nothing special to do
    35493551    } else {
    35503552        popup_and_OK("No restoring or comparing will take place today.");
     
    37103712        }
    37113713    }
    3712    
     3714
    37133715#ifdef __FreeBSD__
    37143716    if (strstr
     
    63986400    }
    63996401
    6400     if (argc == 3 && strcmp(argv[1], "-p") == 0) {
    6401         strcpy(bkpinfo->prefix,argv[2]);
    6402         log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    6403     }
    6404 
    6405     if (argc == 3 && strcmp(argv[1], "-K") == 0) {
    6406         g_loglevel = atoi(argv[2]);
    6407         log_msg(1,"Loglevel forced to %s",g_loglevel);
    6408     }
    6409 
    64106402    if (argc == 2 && strcmp(argv[1], "--live-grub") == 0) {
    64116403        retval = run_grub(FALSE, "/dev/hda");
     
    64196411        pause_and_ask_for_cdr(5, NULL);
    64206412        paranoid_MR_finish(0);
    6421     } else if (!bkpinfo->disaster_recovery) {   // live!
    6422         if (argc != 1) {
    6423             popup_and_OK
    6424                 ("Live mode doesn't support command-line parameters yet.");
    6425             paranoid_MR_finish(1);
    6426 //    return(1);
    6427         }
     6413    }
     6414    if ((argc == 2 && strcmp(argv[1], "--partition-only") == 0) && (bkpinfo->disaster_recovery)) {
     6415        log_msg(0, "Partitioning only.");
     6416        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     6417        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     6418        load_mountlist(mountlist, g_mountlist_fname);
     6419        res = partition_everything(mountlist);
     6420        finish(res);
     6421    }
     6422
     6423    if ((argc == 2 && strcmp(argv[1], "--format-only") == 0) && (bkpinfo->disaster_recovery)) {
     6424        log_msg(0, "Formatting only.");
     6425        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     6426        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     6427        load_mountlist(mountlist, g_mountlist_fname);
     6428        res = format_everything(mountlist, FALSE, raidlist);
     6429        finish(res);
     6430    }
     6431
     6432    if ((argc == 2 && strcmp(argv[1], "--stop-lvm-and-raid") == 0) && (bkpinfo->disaster_recovery)) {
     6433        log_msg(0, "Stopping LVM and RAID");
     6434        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     6435        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     6436        load_mountlist(mountlist, g_mountlist_fname);
     6437        res = do_my_funky_lvm_stuff(TRUE, FALSE);
     6438        res += stop_all_raid_devices(mountlist);
     6439        finish(res);
     6440    }
     6441
     6442    if ((argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) && (!bkpinfo->disaster_recovery)) {
     6443        g_restoring_live_from_cd = TRUE;
     6444    }
     6445
     6446    // Handle params here first
     6447    handle_incoming_parameters(argc,argv);
     6448
     6449    if (!bkpinfo->disaster_recovery) {  // live!
    64286450        log_msg(1, "I am in normal, live mode.");
    64296451        log_msg(2, "FYI, MOUNTLIST_FNAME = %s", g_mountlist_fname);
    64306452        mount_boot_if_necessary();  /* for Gentoo users */
    64316453        log_msg(2, "Still here.");
    6432         if (argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) {
    6433             g_restoring_live_from_cd = TRUE;
    6434         }
    64356454        if (bkpinfo->backup_media_type == nfs) {
    64366455            g_restoring_live_from_nfs = TRUE;
     
    64396458            retval =
    64406459                restore_live_from_monitas_server(argv[2],
    6441                                                  argv[3], argv[4]);
     6460                                                argv[3], argv[4]);
    64426461        } else {
    64436462            log_msg(2, "Calling restore_to_live_filesystem()");
     
    64556474        log_msg(1, "I must be in disaster recovery mode.");
    64566475        log_msg(2, "FYI, MOUNTLIST_FNAME = %s ", g_mountlist_fname);
    6457         if (argc == 3 && strcmp(argv[1], "--monitas-memorex") == 0) {
    6458             log_to_screen("Uh, that hasn't been implemented yet.");
    6459             paranoid_MR_finish(1);
    6460         }
    64616476
    64626477        iamhere("About to call load_mountlist and load_raidtab");
     
    64686483            ("Returned from calling load_mountlist and load_raidtab successfully");
    64696484
    6470         if (argc > 1
    6471             && (strcmp(argv[1], "--compare") == 0
    6472                 || strcmp(argv[1], "--nuke") == 0)) {
     6485        // BCO:To be reviewed
     6486        if ((bkpinfo->restore_mode == compare) || (bkpinfo->restore_mode == nuke)) {
    64736487            if (bkpinfo->backup_media_type == nfs
    64746488                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
     
    64826496        }
    64836497
    6484 
    64856498        if (retval) {
    64866499            log_to_screen
     
    64886501        }
    64896502
    6490 
    64916503        log_msg(1, "Send in the clowns.");
    64926504
    6493         if (argc == 2 && strcmp(argv[1], "--partition-only") == 0) {
    6494             log_msg(0, "Partitioning only.");
    6495             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    6496             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    6497             load_mountlist(mountlist, g_mountlist_fname);
    6498             res = partition_everything(mountlist);
    6499             finish(res);
    6500         }
    6501 
    6502         if (argc == 2 && strcmp(argv[1], "--format-only") == 0) {
    6503             log_msg(0, "Formatting only.");
    6504             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    6505             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    6506             load_mountlist(mountlist, g_mountlist_fname);
    6507             res = format_everything(mountlist, FALSE, raidlist);
    6508             finish(res);
    6509         }
    6510 
    6511         if (argc == 2 && strcmp(argv[1], "--stop-lvm-and-raid") == 0) {
    6512             log_msg(0, "Stopping LVM and RAID");
    6513             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    6514             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    6515             load_mountlist(mountlist, g_mountlist_fname);
    6516             res = do_my_funky_lvm_stuff(TRUE, FALSE);
    6517             res += stop_all_raid_devices(mountlist);
    6518             finish(res);
    6519         }
    6520 
    6521         if (argc == 2 && strcmp(argv[1], "--nuke") == 0) {
     6505
     6506        if (bkpinfo->restore_mode == nuke) {
    65226507            iamhere("nuking");
    65236508            retval += nuke_mode(mountlist, raidlist);
    6524         } else if (argc == 2 && strcmp(argv[1], "--interactive") == 0) {
     6509        } else if (bkpinfo->restore_mode == interactive) {
    65256510            iamhere("catchall");
    65266511            retval += catchall_mode(mountlist, raidlist);
    6527         } else if (argc == 2 && strcmp(argv[1], "--compare") == 0) {
     6512        } else if (bkpinfo->restore_mode == compare) {
    65286513            iamhere("compare");
    65296514            retval += compare_mode(mountlist, raidlist);
    6530         } else if (argc == 2 && strcmp(argv[1], "--iso") == 0) {
     6515        } else if (bkpinfo->restore_mode == isoonly) {
    65316516            iamhere("iso");
    65326517            retval = iso_mode(mountlist, raidlist, FALSE);
    6533         } else if (argc == 2 && strcmp(argv[1], "--mbr") == 0) {
     6518        } else if (bkpinfo->restore_mode == mbr) {
    65346519            iamhere("mbr");
    65356520            retval = mount_all_devices(mountlist, TRUE);
     
    65416526                log_to_screen("Failed to write Master Boot Record");
    65426527            }
    6543         } else if (argc == 2 && strcmp(argv[1], "--isonuke") == 0) {
     6528        } else if (bkpinfo->restore_mode == isonuke) {
    65446529            iamhere("isonuke");
    65456530            retval = iso_mode(mountlist, raidlist, TRUE);
    6546         } else if (argc != 1) {
    6547             log_to_screen("Invalid paremeters");
    6548             paranoid_MR_finish(1);
    65496531        } else {
    65506532            iamhere("catchall (no mode specified in command-line call");
Note: See TracChangeset for help on using the changeset viewer.