Changeset 1966


Ignore:
Timestamp:
May 29, 2008, 10:38:12 AM (9 years ago)
Author:
bruno
Message:
  • Begin modifications to allow mondorestore to use handle_incoming_parameters so that it could take command line params as well.
Location:
branches/2.2.6/mondo/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.6/mondo/src/common/libmondo-cli.c

    r1948 r1966  
    787787    if (flag_set['p']) {
    788788        strncpy(bkpinfo->prefix, flag_val['p'], MAX_STR_LEN / 4);
     789        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
    789790    }
    790791
  • branches/2.2.6/mondo/src/common/libmondo-tools.c

    r1946 r1966  
    848848    memset((void *) bkpinfo, 0, sizeof(struct s_bkpinfo));
    849849
    850     sensibly_set_tmpdir_and_scratchdir();
    851 
    852     bkpinfo->manual_cd_tray = FALSE;
    853     bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    854850    bkpinfo->media_device[0] = '\0';
    855851    for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
     
    860856    bkpinfo->zip_exe[0] = '\0';
    861857    bkpinfo->zip_suffix[0] = '\0';
    862     bkpinfo->restore_path[0] = '\0';
     858    bkpinfo->image_devs[0] = '\0';
     859    bkpinfo->compression_level = 3;
    863860    bkpinfo->use_lzo = FALSE;
    864861    bkpinfo->use_gzip = FALSE;
     
    867864    bkpinfo->backup_data = FALSE;
    868865    bkpinfo->restore_data = FALSE;
     866    bkpinfo->use_star = FALSE;
     867    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    869868    bkpinfo->disaster_recovery =
    870869        (am_I_in_disaster_recovery_mode()? TRUE : FALSE);
     
    875874    }
    876875    strcpy(bkpinfo->prefix, STD_PREFIX);
    877 
     876    sensibly_set_tmpdir_and_scratchdir();
     877
     878    bkpinfo->optimal_set_size = 0;
     879    strcpy(bkpinfo->include_paths, "/");
    878880    bkpinfo->make_filelist = TRUE;  // unless -J supplied to mondoarchive
    879     bkpinfo->optimal_set_size = 0;
    880     bkpinfo->backup_media_type = none;
    881     strcpy(bkpinfo->include_paths, "/");
     881    bkpinfo->include_paths[0] = '\0';
    882882    bkpinfo->exclude_paths[0] = '\0';
     883    bkpinfo->restore_path[0] = '\0';
    883884    bkpinfo->call_before_iso[0] = '\0';
    884885    bkpinfo->call_make_iso[0] = '\0';
    885886    bkpinfo->call_burn_iso[0] = '\0';
    886887    bkpinfo->call_after_iso[0] = '\0';
    887     bkpinfo->image_devs[0] = '\0';
    888     bkpinfo->postnuke_tarball[0] = '\0';
    889888    bkpinfo->kernel_path[0] = '\0';
    890889    bkpinfo->nfs_mount[0] = '\0';
    891890    bkpinfo->nfs_remote_dir[0] = '\0';
     891    bkpinfo->postnuke_tarball[0] = '\0';
    892892    bkpinfo->wipe_media_first = FALSE;
    893     bkpinfo->differential = FALSE;
     893    bkpinfo->differential = 0;
     894    bkpinfo->please_dont_eject = FALSE;
    894895    bkpinfo->cdrw_speed = 0;
    895 // patch by Herman Kuster 
    896     bkpinfo->differential = 0;
    897 // patch end
    898     bkpinfo->compression_level = 3;
     896    bkpinfo->manual_cd_tray = FALSE;
     897    bkpinfo->nonbootable_backup = FALSE;
     898    bkpinfo->make_cd_use_lilo = FALSE;
     899    bkpinfo->use_obdr = FALSE;
    899900}
    900901
  • 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.