Ignore:
Timestamp:
May 29, 2008, 10:38:12 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Begin modifications to allow mondorestore to use handle_incoming_parameters so that it could take command line params as well.
File:
1 edited

Legend:

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

    r1947 r1966  
    31213121    }
    31223122
    3123     if (argc == 3 && strcmp(argv[1], "-p") == 0) {
    3124         strcpy(bkpinfo->prefix,argv[2]);
    3125         log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    3126     }
    3127 
    3128     if (argc == 3 && strcmp(argv[1], "-K") == 0) {
    3129         g_loglevel = atoi(argv[2]);
    3130         log_msg(1,"Loglevel forced to %d",g_loglevel);
    3131     }
    3132 
    31333123    if (argc == 2 && strcmp(argv[1], "--live-grub") == 0) {
    31343124        retval = run_grub(FALSE, "/dev/hda");
     
    31423132        pause_and_ask_for_cdr(5, NULL);
    31433133        paranoid_MR_finish(0);
    3144     } else if (!bkpinfo->disaster_recovery) {   // live!
    3145         if (argc != 1) {
    3146             popup_and_OK
    3147                 ("Live mode doesn't support command-line parameters yet.");
    3148             paranoid_MR_finish(1);
    3149 //    return(1);
    3150         }
     3134    }
     3135    if ((argc == 2 && strcmp(argv[1], "--partition-only") == 0) && (bkpinfo->disaster_recovery)) {
     3136        log_msg(0, "Partitioning only.");
     3137        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     3138        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     3139        load_mountlist(mountlist, g_mountlist_fname);
     3140        res = partition_everything(mountlist);
     3141        finish(res);
     3142    }
     3143
     3144    if ((argc == 2 && strcmp(argv[1], "--format-only") == 0) && (bkpinfo->disaster_recovery)) {
     3145        log_msg(0, "Formatting only.");
     3146        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     3147        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     3148        load_mountlist(mountlist, g_mountlist_fname);
     3149        res = format_everything(mountlist, FALSE, raidlist);
     3150        finish(res);
     3151    }
     3152
     3153    if ((argc == 2 && strcmp(argv[1], "--stop-lvm-and-raid") == 0) && (bkpinfo->disaster_recovery)) {
     3154        log_msg(0, "Stopping LVM and RAID");
     3155        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
     3156        strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
     3157        load_mountlist(mountlist, g_mountlist_fname);
     3158        res = do_my_funky_lvm_stuff(TRUE, FALSE);
     3159        res += stop_all_raid_devices(mountlist);
     3160        finish(res);
     3161    }
     3162       
     3163    if ((argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) && (!bkpinfo->disaster_recovery)) {
     3164        g_restoring_live_from_cd = TRUE;
     3165    }
     3166
     3167    // Handle params here first
     3168    handle_incoming_parameters(argc,argv);
     3169
     3170    if (!bkpinfo->disaster_recovery) {  // live!
    31513171        log_msg(1, "I am in normal, live mode.");
    31523172        log_msg(2, "FYI, MOUNTLIST_FNAME = %s", g_mountlist_fname);
    31533173        mount_boot_if_necessary();  /* for Gentoo users */
    31543174        log_msg(2, "Still here.");
    3155         if (argc > 1 && strcmp(argv[argc - 1], "--live-from-cd") == 0) {
    3156             g_restoring_live_from_cd = TRUE;
    3157         }
    31583175        if (bkpinfo->backup_media_type == nfs) {
    31593176            g_restoring_live_from_nfs = TRUE;
     
    31623179            retval =
    31633180                restore_live_from_monitas_server(argv[2],
    3164                                                  argv[3], argv[4]);
     3181                                                argv[3], argv[4]);
    31653182        } else {
    31663183            log_msg(2, "Calling restore_to_live_filesystem()");
     
    31783195        log_msg(1, "I must be in disaster recovery mode.");
    31793196        log_msg(2, "FYI, MOUNTLIST_FNAME = %s ", g_mountlist_fname);
    3180         if (argc == 3 && strcmp(argv[1], "--monitas-memorex") == 0) {
    3181             log_to_screen("Uh, that hasn't been implemented yet.");
    3182             paranoid_MR_finish(1);
    3183         }
    31843197
    31853198        iamhere("About to call load_mountlist and load_raidtab");
     
    31913204            ("Returned from calling load_mountlist and load_raidtab successfully");
    31923205
     3206        // BCO:To be reviewed
    31933207        if (argc > 1
    31943208            && (strcmp(argv[1], "--compare") == 0
     
    32053219        }
    32063220
    3207 
    32083221        if (retval) {
    32093222            log_to_screen
     
    32113224        }
    32123225
    3213 
    32143226        log_msg(1, "Send in the clowns.");
    32153227
    3216         if (argc == 2 && strcmp(argv[1], "--partition-only") == 0) {
    3217             log_msg(0, "Partitioning only.");
    3218             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3219             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    3220             load_mountlist(mountlist, g_mountlist_fname);
    3221             res = partition_everything(mountlist);
    3222             finish(res);
    3223         }
    3224 
    3225         if (argc == 2 && strcmp(argv[1], "--format-only") == 0) {
    3226             log_msg(0, "Formatting only.");
    3227             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3228             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    3229             load_mountlist(mountlist, g_mountlist_fname);
    3230             res = format_everything(mountlist, FALSE, raidlist);
    3231             finish(res);
    3232         }
    3233 
    3234         if (argc == 2 && strcmp(argv[1], "--stop-lvm-and-raid") == 0) {
    3235             log_msg(0, "Stopping LVM and RAID");
    3236             load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    3237             strcpy(g_mountlist_fname, "/tmp/mountlist.txt");
    3238             load_mountlist(mountlist, g_mountlist_fname);
    3239             res = do_my_funky_lvm_stuff(TRUE, FALSE);
    3240             res += stop_all_raid_devices(mountlist);
    3241             finish(res);
    3242         }
    32433228
    32443229        if (argc == 2 && strcmp(argv[1], "--nuke") == 0) {
Note: See TracChangeset for help on using the changeset viewer.