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

Location:
branches/stable/mondo/src
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mondo/src/common/libmondo-archive.c

    r1939 r1977  
    6060/*@unused@*/
    6161//static char cvsid[] = "$Id$";
     62//
     63extern char *get_non_rewind_dev(char *);
    6264
    6365/* *************************** external global vars ******************/
     
    7072extern long long g_tape_posK;
    7173extern char *g_tmpfs_mountpt;
    72 extern bool g_cd_recovery;
    7374extern char *g_serial_string;
    74 
    7575extern char *g_getfacl;
    7676extern char *g_getfattr;
     
    7979/* Reference to global bkpinfo */
    8080extern struct s_bkpinfo *bkpinfo;
    81 
    8281
    8382
     
    111110static int g_sem_id;
    112111static int g_sem_key;
    113 
    114 
    115 
    116112
    117113/**
     
    540536    char *use_lilo_sz = NULL;
    541537    char *bootdev = NULL;
     538    char *ntapedev = NULL;
    542539
    543540    /*@ char ************************************************************** */
     
    586583    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    587584        mr_asprintf(&tape_size_sz, "%ld", bkpinfo->media_size);
     585        ntapedev = get_non_rewind_dev(bkpinfo->media_device);
     586        if ((bkpinfo->use_obdr) && (ntapedev != NULL)) {
     587            mr_free(bkpinfo->media_device);
     588            bkpinfo->media_device = ntapedev;
     589        } else {
     590            if (ntapedev == NULL) {
     591                log_it("Not able to create OBDR - Restore will have to be done manually");
     592            }
     593        }
    588594        mr_asprintf(&tape_device, bkpinfo->media_device);
    589595    } else {
     
    858864        mr_fprintf(fd1, "acl=no\n");
    859865    }
     866    if (bkpinfo->use_obdr) {
     867        asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     868        if (write_one_liner_data_file(tmp1, "TRUE")) {
     869            log_msg(1, "%ld: Unable to write one-liner OBDR",
     870                __LINE__);
     871        }
     872        paranoid_free(tmp1);
     873    }
    860874
    861875    if (g_cd_recovery) {
     
    12551269            openout_cdstream(bkpinfo->media_device, bkpinfo->writer_speed);
    12561270        } else {
    1257             openout_tape(bkpinfo->media_device, bkpinfo->internal_tape_block_size); /* sets g_tape_stream */
     1271            openout_tape(); /* sets g_tape_stream */
    12581272        }
    12591273        if (!g_tape_stream) {
     
    21442158        /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    21452159        if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2146             register_in_tape_catalog(fileset, curr_set_no, -1,
    2147                                      curr_afioball_fname);
    2148             maintain_collection_of_recent_archives(bkpinfo->tmpdir,
    2149                                                    curr_afioball_fname);
     2160            register_in_tape_catalog(fileset, curr_set_no, -1, curr_afioball_fname);
     2161            maintain_collection_of_recent_archives(bkpinfo->tmpdir, curr_afioball_fname);
    21502162            iamhere("Writing EXAT files");
    21512163            res +=
  • branches/stable/mondo/src/common/libmondo-cli.c

    r1939 r1977  
    199199/* Reference to global bkpinfo */
    200200extern struct s_bkpinfo *bkpinfo;
     201
     202extern void free_MR_global_filenames(void);
    201203
    202204/**
     
    349351    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    350352
    351 /* compulsory */
     353    /* compulsory */
    352354    i = flag_set['c'] + flag_set['i'] + flag_set['n'] +
    353355        flag_set['t'] + flag_set['u'] + flag_set['r'] +
    354356        flag_set['w'] + flag_set['C'] + flag_set['U'];
    355     if (i == 0) {
     357    if ((i == 0) && (! bkpinfo->restore_data)) {
    356358        retval++;
    357359        log_to_screen("You must specify the media type\n");
     
    361363        log_to_screen("Please specify only one media type\n");
    362364    }
     365
    363366    if (flag_set['K']) {
    364367        g_loglevel = atoi(flag_val['K']);
    365             log_msg(1,"Loglevel forced to %s",g_loglevel);
     368            log_msg(1,"Loglevel forced to %d",g_loglevel);
    366369        if (g_loglevel < 3) {
    367370            g_loglevel = 3;
    368371        }
    369372    }
    370     if (flag_set['L'] && flag_set['0']) {
     373
     374    if ((flag_set['L'] && flag_set['0']) && (! bkpinfo->restore_data)) {
    371375        retval++;
    372376        log_to_screen("You cannot have 'no compression' _and_ LZOP.\n");
    373377    }
    374     bkpinfo->backup_data = flag_set['O'];
     378    if (! bkpinfo->restore_data) {
     379        bkpinfo->backup_data = flag_set['O'];
     380    }
    375381    bkpinfo->verify_data = flag_set['V'];
     382
    376383    if (flag_set['I'] && !bkpinfo->backup_data) {
    377384        log_to_screen("-I switch is ignored if just verifying");
     
    401408        }
    402409    }
    403     if (flag_set['W']) {
     410
     411    if ((flag_set['W']) && (! bkpinfo->restore_data)) {
    404412        bkpinfo->nonbootable_backup = TRUE;
    405413        log_to_screen("Warning - you have opted for non-bootable backup");
     
    409417        }
    410418    }
    411     if (flag_set['t'] && flag_set['H']) {
     419
     420    if ((flag_set['t'] && flag_set['H']) && (! bkpinfo->restore_data)) {
    412421        fatal_error
    413422            ("Sorry, you may not nuke w/o warning from tape. Drop -H, please.");
    414423    }
     424
    415425    if (flag_set['I']) {
    416426        if (!strcmp(bkpinfo->include_paths, "/")) {
     
    430440            if (q != NULL) {
    431441                *q = '\0';
    432                 if (stat(p, &buf) != 0) {
     442                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    433443                    log_msg(1, "ERROR ! %s doesn't exist", p);
    434444                    fatal_error("ERROR ! You specified a directory to include which doesn't exist");
     
    436446                p = q+1 ;
    437447            } else {
    438                 if (stat(p, &buf) != 0) {
     448                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    439449                    log_msg(1, "ERROR ! %s doesn't exist", p);
    440450                    fatal_error("ERROR ! You specified a directory to include which doesn't exist");
     
    456466
    457467    if (g_kernel_version >= 2.6 && !flag_set['d']
    458         && (flag_set['c'] || flag_set['w'])) {
     468        && (flag_set['c'] || flag_set['w']) && (! bkpinfo->restore_data)) {
    459469        fatal_error
    460470            ("If you are using the 2.6.x kernel, please specify the CD-R(W) device.");
     
    471481        strcpy(bkpinfo->include_paths, flag_val['J']);
    472482    }
    473     if (flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) {
     483
     484    if ((flag_set['c'] || flag_set['w'] || flag_set['C'] || flag_set['r']) && (! bkpinfo->restore_data)) {
    474485        if (!flag_set['r'] && g_kernel_version <= 2.5
    475486            && strstr(flag_val['d'], "/dev/")) {
     
    522533        }
    523534    }
    524     if (flag_set['t'] && !flag_set['d']) {
     535
     536    if ((flag_set['t'] && !flag_set['d']) && (! bkpinfo->restore_data)) {
    525537        log_it("Hmm! No tape drive specified. Let's see what we can do.");
    526538        if (find_tape_device_and_size(flag_val['d'], tmp)) {
     
    540552        if (! flag_set['d']) {
    541553            fatal_error
    542                 ("You need to specify a device file with -d for bootable USB device creation");
    543         }
    544         if (!flag_set['s']) {
     554                ("You need to specify a device file with -d for bootable USB device usage");
     555        }
     556        if ((!flag_set['s']) && (! bkpinfo->restore_data)) {
    545557            fatal_error("You did not specify a size (-s) for your USB device. Aborting");
    546558        }
     
    559571            }
    560572        }
    561         if (!find_home_of_exe("growisofs")) {
    562             fatal_error
    563                 ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    564         }
    565         if (!find_home_of_exe("dvd+rw-format")) {
    566             fatal_error
    567                 ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
    568         }
    569573        if (strchr(flag_val['d'], ',')) {
    570574            fatal_error
    571575                ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    572576        }
    573         if (!flag_set['s']) {
    574             sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
    575             strcat(flag_val['s'], "m");
    576             log_to_screen
    577                 ("You did not specify a size (-s) for DVD. I'm guessing %s.",
    578                  flag_val['s']);
    579             flag_set['s'] = 1;
     577        if (! bkpinfo->restore_data) {
     578            if (!find_home_of_exe("growisofs")) {
     579                fatal_error
     580                    ("Please install growisofs (probably part of dvd+rw-tools). If you want DVD support, you need it.");
     581            }
     582            if (!find_home_of_exe("dvd+rw-format")) {
     583                fatal_error
     584                    ("Please install dvd+rw-format (probably part of dvd+rw-tools). If you want DVD support, you need it.");
     585            }
     586            if (!flag_set['s']) {
     587                sprintf(flag_val['s'], "%d", DEFAULT_DVD_DISK_SIZE);    // 4.7 salesman's GB = 4.482 real GB = 4582 MB
     588                strcat(flag_val['s'], "m");
     589                log_to_screen
     590                    ("You did not specify a size (-s) for DVD. I'm guessing %s.",
     591                    flag_val['s']);
     592                flag_set['s'] = 1;
     593            }
    580594        }
    581595/*
     
    591605                ("Please don't give a SCSI node. Give a _device_, preferably a /dev entry, for the parameter of the -d flag.");
    592606        }
    593         if (flag_set['O']) {
     607        if ((flag_set['O']) && (! bkpinfo->restore_data)) {
    594608            if (flag_set['s']) {
    595609                if (flag_set['t']) {
     
    609623            }
    610624        }
    611     } else {                    /* CD|USB size */
     625    } else if (! bkpinfo->restore_data) {           /* CD|USB size */
    612626        if (flag_set['s']) {
    613627            if (process_the_s_switch(flag_val['s'])) {
     
    619633        }                       /* CD-RW */
    620634    }
     635
    621636    if (flag_set['n']) {
    622637        strncpy(bkpinfo->nfs_mount, flag_val['n'], MAX_STR_LEN);
     
    636651        log_msg(3, "isodir= %s", bkpinfo->isodir);
    637652    }
     653
    638654    if (flag_set['c']) {
    639655        bkpinfo->backup_media_type = cdr;
     
    702718                q++;
    703719                /* End of bug fix */
    704                 if (stat(p, &buf) != 0) {
     720                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    705721                    log_msg(1, "WARNING ! %s doesn't exist", p);
    706722                }
    707723                p = q+1 ;
    708724            } else {
    709                 if (stat(p, &buf) != 0) {
     725                if ((stat(p, &buf) != 0) && (! bkpinfo->restore_data)) {
    710726                    log_msg(1, "WARNING ! %s doesn't exist", p);
    711727                }
     
    719735                4*MAX_STR_LEN - strlen(bkpinfo->exclude_paths));
    720736    }
     737
    721738    if (flag_set['e']) {
    722739        bkpinfo->please_dont_eject = TRUE;
    723740    }
    724     if (flag_set['N'])          // exclude NFS mounts & devices
     741
     742    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude NFS mounts & devices
    725743    {
    726744//      strncpy(psz, list_of_NFS_devices_and_mounts(), MAX_STR_LEN);
     
    733751                bkpinfo->exclude_paths);
    734752    }
     753
    735754    if (strlen(bkpinfo->exclude_paths) >= 4*MAX_STR_LEN) {
    736755        fatal_error
    737756            ("Your '-E' parameter is too long. Increase MAX_STR_LEN");
    738757    }
     758
    739759    if (flag_set['b']) {
    740760        strcpy(psz, flag_val['b']);
     
    754774        bkpinfo->internal_tape_block_size = itbs;
    755775    }
    756     if (flag_set['D']) {
     776
     777    if ((flag_set['D']) && (! bkpinfo->restore_data)) {
    757778        bkpinfo->differential = 1;
    758779//      bkpinfo->differential = atoi (flag_val['D']);
     
    762783        }
    763784    }
     785
    764786    if (flag_set['x']) {
    765787        strncpy(bkpinfo->image_devs, flag_val['x'], MAX_STR_LEN / 4);
    766         if (run_program_and_log_output("which ntfsclone", 2)) {
     788        if ((run_program_and_log_output("which ntfsclone", 2)) && (! bkpinfo->restore_data)) {
    767789            fatal_error("Please install ntfsprogs package/tarball.");
    768790        }
    769791    }
     792
    770793    if (flag_set['m']) {
    771794        bkpinfo->manual_cd_tray = TRUE;
    772795    }
    773     if (flag_set['k']) {
     796
     797    if ((flag_set['k']) && (! bkpinfo->restore_data)) {
    774798        strncpy(bkpinfo->kernel_path, flag_val['k'], MAX_STR_LEN);
    775799        if (!strcmp(bkpinfo->kernel_path, "failsafe")) {
     
    785809        }
    786810    }
     811
    787812    if (flag_set['p']) {
    788813        strncpy(bkpinfo->prefix, flag_val['p'], MAX_STR_LEN / 4);
    789     }
    790 
     814        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
     815    }
    791816
    792817    if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
     
    801826            strncpy(bkpinfo->nfs_remote_dir, flag_val['d'], MAX_STR_LEN);
    802827        } else {                /* backup device (if tape/CD-R/CD-RW) */
    803 
    804828            strncpy(bkpinfo->media_device, flag_val['d'], MAX_STR_LEN / 4);
    805829        }
    806830    }
    807831
    808     if (flag_set['n']) {
     832    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    809833        asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    810834        sprintf(tmp, "echo hi > %s", tmp1);
     
    839863    }
    840864
    841     if (!flag_set['d'] && !flag_set['n'] && !flag_set['C']) {
     865    if ((!flag_set['d'] && !flag_set['n'] && !flag_set['C']) && (! bkpinfo->restore_data)) {
    842866        retval++;
    843867        log_to_screen("Please specify the backup device/directory.\n");
     
    845869            ("You didn't use -d to specify the backup device/directory.");
    846870    }
    847 /* optional, obscure */
     871
    848872    for (i = '0'; i <= '9'; i++) {
    849873        if (flag_set[i]) {
     
    851875        }                       /* not '\0' but '0' */
    852876    }
     877
    853878    if (flag_set['S']) {
    854879        sprintf(bkpinfo->scratchdir, "%s/mondo.scratch.%ld", flag_val['S'],
    855880                random() % 32768);
    856881    }
     882
    857883    if (flag_set['T']) {
    858884        setup_tmpdir(flag_val['T']);
     
    872898        }
    873899    }
    874     if (flag_set['A']) {
     900
     901    if ((flag_set['A']) && (! bkpinfo->restore_data)) {
    875902        strncpy(bkpinfo->call_after_iso, flag_val['A'], MAX_STR_LEN);
    876903    }
    877     if (flag_set['B']) {
     904
     905    if ((flag_set['B']) && (! bkpinfo->restore_data)) {
    878906        strncpy(bkpinfo->call_before_iso, flag_val['B'], MAX_STR_LEN);
    879907    }
    880     if (flag_set['H']) {
     908
     909    if ((flag_set['H']) && (! bkpinfo->restore_data)) {
    881910        g_cd_recovery = TRUE;
    882911    }
    883     if (flag_set['l']) {
     912
     913    if ((flag_set['l']) && (! bkpinfo->restore_data)) {
    884914#ifdef __FreeBSD__
    885915#  define BOOT_LOADER_CHARS "GLBMR"
     
    901931#undef BOOT_LOADER_CHARS
    902932    }
     933
    903934    if (flag_set['f']) {
    904935        strncpy(bkpinfo->boot_device,
     
    907938                MAX_STR_LEN / 4);
    908939    }
    909     if (flag_set['P']) {
     940
     941    if ((flag_set['P']) && (! bkpinfo->restore_data)) {
    910942        strncpy(bkpinfo->postnuke_tarball, flag_val['P'], MAX_STR_LEN);
    911943    }
     944
    912945    if (flag_set['Q']) {
    913946        i = which_boot_loader(tmp);
     
    916949        finish(0);
    917950    }
    918     if (flag_set['L']) {
     951
     952    if ((flag_set['L']) && (! bkpinfo->restore_data)) {
    919953        bkpinfo->use_lzo = TRUE;
    920954        if (run_program_and_log_output("which lzop", 2)) {
     
    925959    }
    926960
    927     if (flag_set['G']) {
     961    if ((flag_set['G']) && (! bkpinfo->restore_data)) {
    928962        bkpinfo->use_gzip = TRUE;
    929963        if (run_program_and_log_output("which gzip", 2)) {
     
    934968    }
    935969
    936     if (!flag_set['o']
    937         &&
    938         !run_program_and_log_output
    939         ("grep -Ei suse /etc/issue.net | grep -E '9.0' | grep 64", 2)) {
     970    bkpinfo->use_obdr = FALSE;
     971    if (flag_set['o']) {
     972        if ((!flag_set['t']) && (! bkpinfo->restore_data)) {
     973            log_to_screen("OBDR support is only available for tapes. Use the -t option");
     974            fatal_error("Aborting");
     975        }
     976        bkpinfo->use_obdr = TRUE;
     977    }
     978
     979#ifndef __FreeBSD__
     980    if ((!is_this_a_valid_disk_format("vfat")) && (! bkpinfo->restore_data)) {
    940981        bkpinfo->make_cd_use_lilo = TRUE;
    941982        log_to_screen
    942             ("Forcing you to use LILO. SuSE 9.0 (64-bit) has a broken mkfs.vfat binary.");
    943     }
    944     if (flag_set['o']) {
     983            ("Your kernel appears not to support vfat filesystems. I am therefore");
     984        log_to_screen
     985            ("using LILO instead of SYSLINUX as the media boot loader.");
     986    }
     987    if ((run_program_and_log_output("which mkfs.vfat", 2)) && (! bkpinfo->restore_data)) {
    945988        bkpinfo->make_cd_use_lilo = TRUE;
    946     }
    947 #ifndef __FreeBSD__
    948     else {
    949         if (!is_this_a_valid_disk_format("vfat")) {
    950             bkpinfo->make_cd_use_lilo = TRUE;
    951             log_to_screen
    952                 ("Your kernel appears not to support vfat filesystems. I am therefore");
    953             log_to_screen
    954                 ("using LILO instead of SYSLINUX as the media boot loader.");
    955         }
    956         if (run_program_and_log_output("which mkfs.vfat", 2)) {
    957             bkpinfo->make_cd_use_lilo = TRUE;
    958989#ifdef __IA32__
    959             log_to_screen
    960                 ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
    961             log_to_screen
    962                 ("your boot loader. I shall therefore use LILO instead.");
     990        log_to_screen
     991            ("Your filesystem is missing 'mkfs.vfat', so I cannot use SYSLINUX as");
     992        log_to_screen
     993            ("your boot loader. I shall therefore use LILO instead.");
    963994#endif
    964995#ifdef __IA64__
    965             log_to_screen
    966                 ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
    967             log_to_screen("environment correctly. Please install it.");
    968             fatal_error("Aborting");
     996        log_to_screen
     997            ("Your filesystem is missing 'mkfs.vfat', so I cannot prepare the EFI");
     998        log_to_screen("environment correctly. Please install it.");
     999        fatal_error("Aborting");
    9691000#endif
    970         }
     1001    }
    9711002#ifdef __IA64__
    972         /* We force ELILO usage on IA64 */
    973         bkpinfo->make_cd_use_lilo = TRUE;
     1003    /* We force ELILO usage on IA64 */
     1004    bkpinfo->make_cd_use_lilo = TRUE;
    9741005#endif
    975     }
    9761006#endif
    9771007
     
    9801010    }
    9811011
    982     if ( ! bkpinfo->restore_data ) {
     1012    if (! bkpinfo->restore_data) {
    9831013        i = flag_set['O'] + flag_set['V'];
    9841014        if (i == 0) {
    9851015            retval++;
    9861016            log_to_screen("Specify backup (-O), verify (-V) or both (-OV).\n");
     1017        }
     1018    }
     1019
     1020    if ((! bkpinfo->restore_data) && (flag_set['Z'])) {
     1021            fatal_error
     1022                ("The -Z switch is only valid in restore mode");
     1023    }
     1024
     1025    if (flag_set['Z']) {
     1026        if (! strcmp(flag_val['Z'], "nuke")) {
     1027            bkpinfo->restore_mode = nuke;
     1028        } else if (! strcmp(flag_val['Z'], "interactive")) {
     1029            bkpinfo->restore_mode = interactive;
     1030        } else if (! strcmp(flag_val['Z'], "compare")) {
     1031            bkpinfo->restore_mode = compare;
     1032        } else if (! strcmp(flag_val['Z'], "mbr")) {
     1033            bkpinfo->restore_mode = mbr;
     1034        } else if (! strcmp(flag_val['Z'], "iso")) {
     1035            bkpinfo->restore_mode = isoonly;
     1036        } else if (! strcmp(flag_val['Z'], "isonuke")) {
     1037            bkpinfo->restore_mode = isonuke;
     1038        } else {
     1039            bkpinfo->restore_mode = interactive;
    9871040        }
    9881041    }
     
    10821135void help_screen()
    10831136{
    1084     log_msg(1, "Type 'man mondo-archive' for more information\n");
     1137    log_msg(1, "Type 'man mondoarchive' for more information\n");
    10851138    exit(1);
    10861139}
     
    11411194    }
    11421195    kill_buffer();
     1196
     1197    free_MR_global_filenames();
     1198
    11431199    fatal_error
    1144         ("Mondoarchive is terminating in response to a signal from the OS");
     1200        ("MondoRescue is terminating in response to a signal from the OS");
    11451201    finish(254);                // just in case
    11461202}
  • branches/stable/mondo/src/common/libmondo-devices.c

    r1939 r1977  
    17491749
    17501750    case tape:
    1751         if (bkpinfo->media_device) {
     1751        if ((!bkpinfo->restore_mode) && (find_tape_device_and_size(bkpinfo->media_device, sz_size))) {
     1752            mr_msg(3, "Ok, using vanilla scsi tape.");
     1753            mr_free(bkpinfo->media_device);
     1754            mr_asprintf(&tmp,VANILLA_SCSI_TAPE);
     1755            bkpinfo->media_device = tmp;
     1756
    17521757            if ((fin = fopen(bkpinfo->media_device, "r"))) {
    17531758                paranoid_fclose(fin);
     
    17951800        bkpinfo->media_size = 0L;
    17961801        mr_msg(4, "media_size = %ld", bkpinfo->media_size);
     1802        bkpinfo->use_obdr = ask_me_yes_or_no
     1803            ("Do you want to activate OBDR support for your tapes ?");
    17971804        if (archiving_to_media) {
    17981805            if ((bkpinfo->compression_level =
     
    21962203    strcpy(exclude_these_directories,
    21972204           call_program_and_get_last_line_of_output
    2198            ("mount -t coda,ncpfs,nfs,smbfs,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2205           ("mount -t coda,ncpfs,nfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
    21992206    strcpy(exclude_these_devices,
    22002207           call_program_and_get_last_line_of_output
    2201            ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|afs|ocfs|ocfs2|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2208           ("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    22022209    sprintf(result_sz, "%s", exclude_these_directories);
    22032210    mr_free(exclude_these_devices);
     
    22272234    mr_asprintf(&tmp,
    22282235           call_program_and_get_last_line_of_output
    2229            ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2236           ("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    22302237#else
    22312238    mr_asprintf(&tmp,
    22322239           call_program_and_get_last_line_of_output
    2233            ("LANGUAGE=C df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x ocfs -x ocfs2 -x mvfs | sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2240           ("LANGUAGE=C df -m -P -x nfs -x vfat -x ntfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs | sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    22342241#endif
    22352242
  • branches/stable/mondo/src/common/libmondo-filelist.c

    r1924 r1977  
    16031603        mr_asprintf(&exclude_paths, " %s %s %s %s %s %s . .. \
    16041604" MNT_CDROM " " MNT_FLOPPY " /media /tmp /var/log/lastlog \
    1605 /proc /sys /root/images/mondo ", MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
    1606         paranoid_free(tmp2);
     1605/proc /sys /var/cache/mondo ", MINDI_CACHE, MONDO_CACHE, excp, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1606        mr_free(tmp2);
    16071607
    16081608        mr_msg(2,
  • branches/stable/mondo/src/common/libmondo-stream-EXT.h

    r1663 r1977  
    1313extern int openin_tape();
    1414extern int openout_cdstream(char *cddev, int speed);
    15 extern int openout_tape(char *tapedev, long internal_tape_block_size);
     15extern int openout_tape();
    1616extern int read_file_from_stream_to_file(
    1717                                         char *outfile, long long size);
  • branches/stable/mondo/src/common/libmondo-stream.c

    r1939 r1977  
    22
    33...tools for talking to tapes, Monitas streams, etc.
     4
    45*/
    56
     
    364365    int res = 0;
    365366    char *fname = (char *)&res;                 /* Should NOT be NULL */
     367    char *tmp = NULL;
    366368
    367369    // xattr
     
    371373            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    372374        }
    373         if (!strstr(fname, "xattr")) {
    374             fatal_error("Wrong order for xattr, sunshine.");
     375        if (strstr(fname, "xattr") == NULL) {
     376            asprintf(&tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
     377            fatal_error(tmp);
    375378        }
    376379        read_file_from_stream_to_file(xattr_fname, *ptmp_size);
    377         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     380        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    378381        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
    379382            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
    380383        }
    381384        mr_msg(1, "Got xattr");
    382         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     385        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    383386        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
    384387            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
    385388        }
    386         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
    387         if (pctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
     389        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
     390        if (*pctrl_chr == BLK_START_AN_AFIO_OR_SLICE) {
    388391            log_msg(1, "No acl attributes found, skipping to afio files");
    389392            return(0);
    390393        } else {
    391             if (pctrl_chr != BLK_START_EXTENDED_ATTRIBUTES) {
     394            if (*pctrl_chr != BLK_START_EXTENDED_ATTRIBUTES) {
    392395                wrong_marker(BLK_START_EXTENDED_ATTRIBUTES, *pctrl_chr);
    393396            }
     
    397400    if (g_getfacl) {
    398401        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    399         if (!strstr(fname, "acl")) {
    400             fatal_error("Wrong order for acl, sunshine.");
    401         }
    402402        if (*pctrl_chr != BLK_START_EXAT_FILE) {
    403403            wrong_marker(BLK_START_EXAT_FILE, *pctrl_chr);
    404404        }
     405        if (strstr(fname, "acl") == NULL) {
     406            asprintf(&tmp,"Wrong order expected acl, got %s, sunshine.", fname);
     407            fatal_error(tmp);
     408        }
    405409        read_file_from_stream_to_file(acl_fname, *ptmp_size);
    406         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     410        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    407411        if (*pctrl_chr != BLK_STOP_EXAT_FILE) {
    408412            wrong_marker(BLK_STOP_EXAT_FILE, *pctrl_chr);
    409413        }
    410         res = read_header_block_from_stream(ptmp_size, tmp_fname, pctrl_chr);
     414        res = read_header_block_from_stream(ptmp_size, fname, pctrl_chr);
    411415        if (*pctrl_chr != BLK_STOP_EXTENDED_ATTRIBUTES) {
    412416            wrong_marker(BLK_STOP_EXTENDED_ATTRIBUTES, *pctrl_chr);
     
    595599
    596600
    597 int set_tape_block_size_with_mt(char *tapedev,
    598                                 long internal_tape_block_size)
     601int set_tape_block_size_with_mt(long internal_tape_block_size)
    599602{
    600603    char *tmp;
    601604    int res;
    602605
    603     if (strncmp(tapedev, "/dev/", 5)) {
     606    if (strncmp(bkpinfo->media_device, "/dev/", 5)) {
    604607        mr_msg(1,
    605608                "Not using 'mt setblk'. This isn't an actual /dev entry.");
    606609        return (0);
    607610    }
    608     mr_asprintf(&tmp, "mt -f %s setblk %ld", tapedev,
    609              internal_tape_block_size);
     611    mr_asprintf(&tmp, "mt -f %s setblk %ld",bkpinfo->media_device,internal_tape_block_size);
    610612    res = run_program_and_log_output(tmp, 3);
    611613    mr_free(tmp);
    612614    return (res);
     615}
     616
     617/**
     618 * Return the non-rewinding device when passed the normal one
     619 * @param tapedev The tape device to open for writing.
     620 * @note the caller needs to free the string returned
     621 */
     622char *get_non_rewind_dev(char *tapedev)
     623{
     624
     625    char *ntapedev = NULL;
     626    char *p = NULL;
     627    char *q = NULL;
     628    char *r = NULL;
     629
     630    ntapedev = (char *)malloc(strlen(tapedev)+sizeof(char));
     631    p = strrchr(tapedev,'/');
     632    if (p == NULL) {
     633        log_it("Didn't find a '/' in %s",tapedev);
     634        return(NULL);
     635    }
     636
     637    /* Copy tapedev content up to the last / */
     638    q = tapedev;
     639    r = ntapedev;
     640    while (q != p) {
     641        *r = *q;
     642        r++;
     643        q++;
     644    }
     645    /* Copy the '/' */
     646    *r = *q;
     647    r++;
     648    q++;
     649    /* Adds a 'n' - non-rewinding */
     650    *r = 'n';
     651    r++;
     652    /* Copy the rest of tapedev */
     653    while (*q != '\0') {
     654        *r = *q;
     655        r++;
     656        q++;
     657    }
     658    *r = '\0';
     659    if (mt_says_tape_exists(ntapedev)) {
     660        log_it("Non-rewinding tape device is %s",ntapedev);
     661    } else {
     662        log_it("Unable to find non-rewinding tape device.");
     663        ntapedev = NULL;
     664    }
     665    return(ntapedev);
     666}
     667
     668
     669
     670/**
     671 * Handle OBDR if we were asked to do so
     672 * @param tapedev The tape device to open for reading.
     673 */
     674int skip_obdr(void)
     675{
     676    char *command = NULL;
     677    int res = 0;
     678
     679    log_it("Skipping OBDR headers");
     680    asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     681    res = run_program_and_log_output(command, 1);
     682    paranoid_free(command);
     683
     684    asprintf(&command, "mt -f %s fsf 2",bkpinfo->media_device);
     685    res = run_program_and_log_output(command, 1);
     686    paranoid_free(command);
     687
     688    set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     689    return(res);
     690}
     691
     692/**
     693 * Handle OBDR if we were asked to do so
     694 * @param tapedev The tape device to open for writing.
     695 * @return 0 for success, nonzero for failure.
     696 * @note This should be called ONLY from backup processes. It will OVERWRITE ANY
     697 * EXISTING DATA on the tape!
     698 */
     699int create_obdr(void)
     700{
     701
     702    char *command = NULL;
     703    int res = 0;
     704
     705    log_it("Creating OBDR headers");
     706    /* OBDR: First block 10 kB of zero bs = 512 */
     707    asprintf(&command, "mt -f %s compression off",bkpinfo->media_device);
     708    res = run_program_and_log_output(command, 1);
     709    paranoid_free(command);
     710
     711    asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     712    res += run_program_and_log_output(command, 1);
     713    paranoid_free(command);
     714
     715    set_tape_block_size_with_mt(512);
     716
     717    asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
     718    res += run_program_and_log_output(command, 1);
     719    paranoid_free(command);
     720
     721    /* OBDR: then ISO boot image bs = 2048 */
     722    set_tape_block_size_with_mt(2048);
     723
     724    asprintf(&command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
     725    res += run_program_and_log_output(command, 1);
     726    paranoid_free(command);
     727
     728    set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     729    return(res);
    613730}
    614731
     
    633750    int i;
    634751    int j;
    635     int res;
     752    int res = 0;
    636753    long length, templong;
    637754    size_t k;
     
    654771        return (0);
    655772    }
     773
     774    // mondoarchive should have configured everything to give the right non-rew device
     775    if ((bkpinfo->use_obdr) && (bkpinfo->media_device != NULL)) {
     776        res = skip_obdr();
     777        if (res != 0) {
     778            log_it("Not able to skip OBDR - Restore will have to be done manually");
     779        }
     780    } else {
     781        if (bkpinfo->media_device == NULL) {
     782            log_it("Not able to skip OBDR - Restore will have to be done manually");
     783        }
     784        set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     785    }
     786
    656787    insist_on_this_tape_number(1);
    657788    mr_asprintf(&outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
    658789    make_hole_for_file(outfname);
    659 
    660     set_tape_block_size_with_mt(bkpinfo->media_device,
    661                                 bkpinfo->internal_tape_block_size);
    662790
    663791    log_it("Opening IN tape");
     
    762890/**
    763891 * Start writing to a tape device for the backup.
     892 * Handle OBDR if we were asked to do so
    764893 * @param tapedev The tape device to open for writing.
    765894 * @return 0 for success, nonzero for failure.
     
    767896 * EXISTING DATA on the tape!
    768897 */
    769 int openout_tape(char *tapedev, long internal_tape_block_size)
    770 {
     898int openout_tape() {
     899
    771900    g_current_media_number = 1;
    772901    if (g_tape_stream) {
     
    777906    g_tape_posK = 0;
    778907
    779     set_tape_block_size_with_mt(tapedev, internal_tape_block_size);
     908    if (bkpinfo->use_obdr) {
     909        create_obdr();
     910    } else {
     911        set_tape_block_size_with_mt(bkpinfo->internal_tape_block_size);
     912    }
    780913    log_it("Opening OUT tape");
    781914    if (!
    782915        (g_tape_stream =
    783          open_device_via_buffer(tapedev, 'w', internal_tape_block_size))) {
     916         open_device_via_buffer(bkpinfo->media_device, 'w', internal_tape_block_size))) {
    784917        log_to_screen(_("Cannot openin stream device"));
    785918        return (1);
  • branches/stable/mondo/src/common/libmondo-stream.h

    r1663 r1977  
    1414int openin_tape();
    1515int openout_cdstream(char *cddev, int speed);
    16 int openout_tape(char *tapedev, long internal_tape_block_size);
     16int openout_tape();
    1717int read_file_from_stream_to_file(char *outfile,
    1818                                  long long size);
  • branches/stable/mondo/src/common/libmondo-tools.c

    r1924 r1977  
    677677
    678678void setup_tmpdir(char *path) {
    679    
     679
    680680    char *tmp = NULL;
    681681    char *p = NULL;
     
    687687        paranoid_free(tmp);
    688688    }
    689        
     689
    690690    if (path != NULL) {
    691691        asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path);
     
    758758    }
    759759    bkpinfo->boot_device[0] = '\0';
    760     bkpinfo->restore_path[0] = '\0';
     760    bkpinfo->image_devs[0] = '\0';
     761    bkpinfo->compression_level = 3;
    761762    bkpinfo->do_not_compress_these[0] = '\0';
    762763    bkpinfo->verify_data = FALSE;
    763764    bkpinfo->backup_data = FALSE;
    764765    bkpinfo->restore_data = FALSE;
     766    bkpinfo->use_star = FALSE;
     767    bkpinfo->internal_tape_block_size = DEFAULT_INTERNAL_TAPE_BLOCK_SIZE;
    765768    bkpinfo->disaster_recovery =
    766769        (am_I_in_disaster_recovery_mode()? TRUE : FALSE);
     
    772775    mr_asprintf(&tmp,mr_conf->prefix);
    773776    bkpinfo->prefix = tmp;
    774 
    775     bkpinfo->make_filelist = TRUE;  // unless -J supplied to mondoarchive
     777    sensibly_set_tmpdir_and_scratchdir();
     778
    776779    bkpinfo->optimal_set_size = 0;
    777     bkpinfo->backup_media_type = none;
    778780    bkpinfo->backup_media_string[0] = '\0';
    779781    strcpy(bkpinfo->include_paths, "/");
     782    bkpinfo->restore_path[0] = '\0';
    780783    bkpinfo->call_before_iso[0] = '\0';
    781784    bkpinfo->call_make_iso[0] = '\0';
    782785    bkpinfo->call_after_iso[0] = '\0';
    783     bkpinfo->image_devs[0] = '\0';
    784     bkpinfo->postnuke_tarball[0] = '\0';
    785786    bkpinfo->nfs_mount[0] = '\0';
    786787    bkpinfo->nfs_remote_dir[0] = '\0';
     788    bkpinfo->postnuke_tarball[0] = '\0';
    787789    bkpinfo->wipe_media_first = FALSE;
    788     bkpinfo->differential = FALSE;
     790    bkpinfo->differential = 0;
     791    bkpinfo->please_dont_eject = FALSE;
    789792    bkpinfo->writer_speed = mr_conf->iso_burning_speed;
     793    bkpinfo->manual_cd_tray = FALSE;
     794    bkpinfo->nonbootable_backup = FALSE;
     795    bkpinfo->make_cd_use_lilo = FALSE;
     796    bkpinfo->use_obdr = FALSE;
     797    bkpinfo->restore_mode = interactive;
    790798}
    791799
  • branches/stable/mondo/src/common/mondostructures.h

    r1904 r1977  
    127127   */
    128128    int index;
    129    
     129
    130130  /**
    131131   * Type of disk.
    132132   */
    133133    char type;  // ' ' = data (default), S = spare, F = faulty
    134    
     134
    135135};
    136136
     
    184184} t_archtype;
    185185
     186/**
     187 * A type of file in the catalog of recent archives.
     188 */
     189typedef enum {
     190    nuke = 0,                   /// Nuke mode
     191    interactive,                /// Interactive mode
     192    compare,                    /// Compare mode
     193    mbr,                        /// MBR mode
     194    isoonly,                    /// ISO mode
     195    isonuke,                    /// ISO+Nuke mode
     196} t_restore_mode;
     197
    186198
    187199#ifdef __FreeBSD__
     
    236248       */
    237249    int chunk_size;
    238    
     250
    239251      /**
    240252       * The parity algorithm of this RAID device. (RAID5 only)
     
    582594   */
    583595    bool make_cd_use_lilo;
     596
     597  /**
     598   * If TRUE, make the the tape bootable. If FALSE, normal tape, the default
     599   */
     600    bool use_obdr;
     601
     602  /**
     603   * Nature of the restore
     604   */
     605    t_restore_mode restore_mode;
    584606};
    585607
  • branches/stable/mondo/src/mondoarchive/mondoarchive.c

    r1939 r1977  
    817817struct s_bkpinfo *bkpinfo;
    818818
     819/* To be coded */
     820void free_MR_global_filenames(void) {
     821}
     822
    819823/****************** subroutines used only by main.c ******************/
    820824
  • branches/stable/mondo/src/mondoarchive/mondoarchive.h

    r1924 r1977  
    1717 */
    1818char *MONDO_LOGFILE = "/var/log/mondoarchive.log";
    19 char *MONDO_OPTIONS = "0123456789A:B:C:DE:FGHI:J:K:LNOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
     19char *MONDO_OPTIONS = "0123456789A:B:C:DE:GHI:J:K:LNOP:QRS:T:UVWb:c:d:ef:gik:l:mn:op:rs:tuw:x:z";
    2020
    2121/* No restriction on ps options */
  • branches/stable/mondo/src/mondorestore/mondo-rstr-tools.c

    r1939 r1977  
    5656
    5757extern void kill_anything_like_this(char *str);
     58extern int skip_obdr(void);
    5859
    5960/**
     
    7273    mr_free(g_mondo_cfg_file);
    7374    mr_free(g_mountlist_fname);
     75    mr_free(g_mondo_home);
    7476    mr_free(g_tmpfs_mountpt);
    7577    mr_free(g_isodir_device);
     
    887889        bkpinfo->use_star = TRUE;
    888890        mr_msg(1, "Goody! ... bkpinfo->use_star is now true.");
     891    }
     892
     893    read_cfg_var(cfg_file, "obdr", value);
     894    if (strstr(value, "yes")) {
     895        bkpinfo->use_obdr = TRUE;
     896        log_msg(1, "OBDR mode activated");
    889897    }
    890898
     
    17861794
    17871795/**
    1788  * Turn signal trapping on or off.
    1789  * @param on If TRUE, then do full cleanup when we receive a signal; if FALSE, then
    1790  * print a message and exit immediately.
    1791  */
    1792 void set_signals(int on)
    1793 {
    1794     int signals[] =
    1795         { SIGKILL, SIGPIPE, SIGTERM, SIGHUP, SIGTRAP, SIGABRT, SIGINT,
    1796         SIGSTOP, 0
    1797     };
    1798     int i;
    1799     for (i = 0; signals[i]; i++) {
    1800         if (on) {
    1801             signal(signals[i], terminate_daemon);
    1802         } else {
    1803             signal(signals[i], termination_in_progress);
    1804         }
    1805     }
    1806 }
    1807 
    1808 /**************************************************************************
    1809  *END_SET_SIGNALS                                                         *
    1810  **************************************************************************/
    1811 
    1812 
    1813 /**
    18141796 * malloc() and set sensible defaults for the mondorestore filename variables.
    18151797 * @param bkpinfo The backup information structure. Fields used:
     
    18951877/**************************************************************************
    18961878 *END_STREAMLINE_CHANGES_FILE                                             *
    1897  **************************************************************************/
    1898 
    1899 
    1900 /**
    1901  * Exit due to a signal (normal cleanup).
    1902  * @param sig The signal we're exiting due to.
    1903  */
    1904 void terminate_daemon(int sig)
    1905 {
    1906     log_to_screen
    1907         (_("Mondorestore is terminating in response to a signal from the OS"));
    1908     free_MR_global_filenames();
    1909     finish(254);
    1910 }
    1911 /**************************************************************************
    1912  *END_TERMINATE_DAEMON                                                    *
    19131879 **************************************************************************/
    19141880
     
    19411907/**************************************************************************
    19421908 *END_TWENTY_SECONDS_TIL_YIKES                                            *
    1943  **************************************************************************/
    1944 
    1945 
    1946 /**
    1947  * Exit due to a signal (no cleanup).
    1948  * @param sig The signal we're exiting due to.
    1949  */
    1950 void termination_in_progress(int sig)
    1951 {
    1952     mr_msg(1, "Termination in progress");
    1953     usleep(1000);
    1954     pthread_exit(0);
    1955 }
    1956 /**************************************************************************
    1957  *END_TERMINATION_IN_PROGRESS                                             *
    19581909 **************************************************************************/
    19591910
     
    20111962                                   "/mnt/.boot.d", 5);
    20121963    }
     1964
     1965    /* Unmounting the local /proc and /sys first */
     1966    run_program_and_log_output("umount " MNT_RESTORING "/proc",3);
     1967    run_program_and_log_output("umount " MNT_RESTORING "/sys",3);
     1968
    20131969    for (lino = mountlist->entries - 1; lino >= 0; lino--) {
    20141970        if (!strcmp(mountlist->el[lino].mountpoint, "lvm")) {
     
    20812037    // BERLIOS: below 32KB seems to block at least on RHAS 2.1 and MDK 10.0
    20822038
     2039    if (bkpinfo->use_obdr) {
     2040        skip_obdr();
     2041    }
    20832042    // tar -zxvf-
    20842043    mr_asprintf(&command,
  • 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");
  • branches/stable/mondo/src/mondorestore/mondorestore.h

    r1663 r1977  
    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.