Ignore:
Timestamp:
Jun 19, 2013, 8:34:46 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • First pass on svn merge -r 2935:3146 ../3.0
File:
1 edited

Legend:

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

    r2937 r3147  
    6363 */
    6464bool g_ISO_restore_mode = FALSE;    /* are we in Iso Mode? */
     65
     66/* Whether we should fail immediately at first error */
     67bool g_fail_immediately = FALSE;
    6568
    6669/**
     
    618621        ("Label/Identify your ext2/ext3/ext4 partitions if necessary?")) {
    619622        mvaddstr_and_log_it(g_currentY, 0,
    620                             "Using tune2fs to identify your ext2,3,4 partitions");
     623                            "Using tune2fs/tune4fs to identify your ext2,3,4 partitions");
    621624        if (does_file_exist("/tmp/fstab.new")) {
    622625            mr_asprintf(fstab_fname, "/tmp/fstab.new");
     
    710713
    711714
    712 /*            MONDO - saving your a$$ since Feb 18th, 2000            */
     715/*            MONDO - saving your systems since Feb 18th, 2000            */
    713716
    714717
     
    730733    int retval = 0;
    731734    int res = 0;
    732     bool boot_loader_installed = FALSE;
    733735    char *tmp = NULL;
    734736    char *tmp1 = NULL;
     
    829831        log_msg(1,
    830832                "Great! Boot loader was installed. No need for msg at end.");
    831         boot_loader_installed = TRUE;
    832833    }
    833834    clean_blkid();
     
    836837    mvaddstr_and_log_it(g_currentY,
    837838                        0,
    838                         "Using tune2fs to identify your ext2,3 partitions");
     839                        "Using tune2fs/tune4fs to identify your ext2,3,4 partitions");
    839840
    840841    mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE);
     
    16011602
    16021603        if (use_star) {
    1603             mr_asprintf(command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
     1604            mr_asprintf(command, "star -x -force-remove -sparse -U " STAR_ACL_SZ " file=%s", tarball_fname);
    16041605            if (strstr(tarball_fname, ".bz2")) {
    16051606                mr_strcat(command, " -bz");
     
    16391640        }
    16401641
    1641         if (g_getfattr) {
    1642             log_msg(1, "Setting fattr list %s", xattr_fname);
    1643             if (length_of_file(xattr_fname) > 0) {
    1644                 res = set_fattr_list(filelist_subset_fname, xattr_fname);
    1645                 if (res) {
    1646                     log_to_screen("Errors occurred while setting extended attributes");
    1647                 } else {
    1648                     log_msg(1, "I set xattr OK");
     1642        if (! use_star) {
     1643            if (g_getfattr) {
     1644                log_msg(1, "Setting fattr list %s", xattr_fname);
     1645                if (length_of_file(xattr_fname) > 0) {
     1646                    res = set_fattr_list(filelist_subset_fname, xattr_fname);
     1647                    if (res) {
     1648                        log_to_screen("Errors occurred while setting extended attributes");
     1649                    } else {
     1650                        log_msg(1, "I set xattr OK");
     1651                    }
     1652                    retval += res;
    16491653                }
    1650                 retval += res;
    1651             }
    1652         }
    1653         if (g_getfacl) {
    1654             log_msg(1, "Setting acl list %s", acl_fname);
    1655             if (length_of_file(acl_fname) > 0) {
    1656                 res = set_acl_list(filelist_subset_fname, acl_fname);
    1657                 if (res) {
    1658                     log_to_screen
    1659                         ("Errors occurred while setting access control lists");
    1660                 } else {
    1661                     log_msg(1, "I set ACL OK");
     1654            }
     1655            if (g_getfacl) {
     1656                log_msg(1, "Setting acl list %s", acl_fname);
     1657                if (length_of_file(acl_fname) > 0) {
     1658                    res = set_acl_list(filelist_subset_fname, acl_fname);
     1659                    if (res) {
     1660                        log_to_screen("Errors occurred while setting access control lists");
     1661                    } else {
     1662                        log_msg(1, "I set ACL OK");
     1663                    }
     1664                    retval += res;
    16621665                }
    1663                 retval += res;
    1664             }
    1665         }
    1666         if (retval) {
     1666            }
     1667        } else {
     1668            retval = res;
     1669        }
     1670        // Be verbose for star
     1671        if (retval || use_star) {
    16671672            mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
    1668             system(command);
     1673            paranoid_system(command);
    16691674            paranoid_free(command);
    16701675
    1671             log_msg(2, "Errors occurred while processing fileset #%d",
    1672                     current_tarball_number);
     1676            if (retval) {
     1677                log_msg(2, "Errors occurred while processing fileset #%d", current_tarball_number);
     1678            }
    16731679        } else {
    16741680            log_msg(2, "Fileset #%d processed OK", current_tarball_number);
     
    17821788        if (strstr(tarball_fname, ".star.")) {
    17831789            use_star = TRUE;
    1784             mr_asprintf(command, "star -t file=%s %s", afio_fname, executable);
     1790            mr_asprintf(command, "star -sparse -t file=%s %s", afio_fname, executable);
    17851791        } else {
    17861792            use_star = FALSE;
     
    18161822    if (strstr(tarball_fname, ".star.")) {
    18171823        // star
    1818         mr_asprintf(command, "star -x file=%s %s", afio_fname, executable);
     1824        mr_asprintf(command, "star -sparse -x file=%s %s", afio_fname, executable);
    18191825        if (filelist) {
    18201826            mr_strcat(command, " list=%s", filelist_subset_fname);
     
    22162222    res = read_header_block_from_stream(&biggie_size, biggie_fname, &ctrl_chr);
    22172223    if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    2218         res =
    2219             read_EXAT_files_from_tape(&biggie_size, biggie_fname, &ctrl_chr, xattr_fname, acl_fname);
     2224        res = read_EXAT_files_from_tape(&biggie_size, biggie_fname, &ctrl_chr, xattr_fname, acl_fname);
    22202225    }
    22212226
     
    23542359    mr_free(tmp);
    23552360
    2356     chdir(bkpinfo->restore_path);   /* I don't know why this is needed _here_ but it seems to be. -HR, 02/04/2002 */
     2361    if (chdir(bkpinfo->restore_path)) { /* I don't know why this is needed _here_ but it seems to be. -HR, 02/04/2002 */
     2362        //FIXME
     2363    }
    23572364
    23582365    run_program_and_log_output("pwd", 5);
     
    24702477    log_msg(2, "restore_everything() --- starting");
    24712478    g_current_media_number = 1;
    2472     getcwd(cwd, MAX_STR_LEN - 1);
     2479    if (getcwd(cwd, MAX_STR_LEN - 1)) {
     2480        // FIXME
     2481    }
    24732482    mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path);
    24742483    run_program_and_log_output(tmp, FALSE);
     
    24762485
    24772486    log_msg(1, "Changing dir to %s", bkpinfo->restore_path);
    2478     chdir(bkpinfo->restore_path);
    2479     getcwd(newpath, MAX_STR_LEN - 1);
     2487    if (chdir(bkpinfo->restore_path)) {
     2488        //FIXME
     2489    }
     2490    if (getcwd(newpath, MAX_STR_LEN - 1)) {
     2491        // FIXME
     2492    }
    24802493    log_msg(1, "path is now %s", newpath);
    24812494    log_msg(1, "restoring everything");
     
    25112524        resB = restore_all_biggiefiles_from_CD(filelist);
    25122525    }
    2513     chdir(cwd);
     2526    if (chdir(cwd)) {
     2527        //FIXME
     2528    }
    25142529    if (resA + resB) {
    25152530        log_to_screen("Errors occurred while data was being restored.");
     
    26542669    if (argc == 2 && strcmp(argv[1], "--edit-mountlist") == 0) {
    26552670#ifdef __FreeBSD__
    2656         system("mv -f /tmp/raidconf.txt /etc/raidtab");
     2671        paranoid_system("mv -f /tmp/raidconf.txt /etc/raidtab");
    26572672        if (!does_file_exist("/etc/raidtab"))
    2658             system("vinum printconfig > /etc/raidtab");
     2673            paranoid_system("vinum printconfig > /etc/raidtab");
    26592674#endif
    26602675        load_raidtab_into_raidlist(raidlist, RAIDTAB_FNAME);
    26612676        res = let_user_edit_the_mountlist(mountlist, raidlist);
    26622677#ifdef __FreeBSD__
    2663         system("mv -f /etc/raidtab /tmp/raidconf.txt");
     2678        paranoid_system("mv -f /etc/raidtab /tmp/raidconf.txt");
    26642679#endif
    26652680        paranoid_MR_finish(res);
     
    27342749
    27352750    if (argc == 3 && strcmp(argv[1], "--mdconv") == 0) {
    2736         finish(create_raidtab_from_mdstat(argv[2]));
     2751        finish(create_raidtab_from_mdstat(MDSTAT_FILE,argv[2]));
    27372752    }
    27382753
     
    28202835                        mr_asprintf(tmp, "sshfs -o ro %s /tmp/isodir", bkpinfo->netfs_mount);
    28212836                    }
    2822                 } else {
    2823                     if (bkpinfo->netfs_user) {
    2824                         mr_asprintf(tmp, "mount %s@%s -o nolock,ro /tmp/isodir", bkpinfo->netfs_user,bkpinfo->netfs_mount);
     2837                } else  {
     2838                    if (strstr(bkpinfo->netfs_proto, "smbfs")) {
     2839                        if (bkpinfo->netfs_user) {
     2840                            mr_asprintf(tmp, "mount -t cifs %s /tmp/isodir -o user=%s,nolock,ro ", bkpinfo->netfs_mount,bkpinfo->netfs_user);
     2841                        } else {
     2842                            mr_asprintf(tmp, "mount -t cifs %s /tmp/isodir -o nolock,ro ", bkpinfo->netfs_mount);
     2843                        }
    28252844                    } else {
    2826                         mr_asprintf(tmp, "mount %s -o nolock,ro /tmp/isodir", bkpinfo->netfs_mount);
     2845                        if (bkpinfo->netfs_user) {
     2846                            mr_asprintf(tmp, "mount %s@%s -o nolock,ro /tmp/isodir", bkpinfo->netfs_user,bkpinfo->netfs_mount);
     2847                        } else {
     2848                            mr_asprintf(tmp, "mount %s -o nolock,ro /tmp/isodir", bkpinfo->netfs_mount);
     2849                        }
    28272850                    }
    28282851                }
     
    29562979    if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) {
    29572980        mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
    2958         system(tmp);
     2981        paranoid_system(tmp);
    29592982        mr_free(tmp);
    29602983    }
Note: See TracChangeset for help on using the changeset viewer.