Changeset 948 in MondoRescue for branches/stable/mondo/src/mondorestore


Ignore:
Timestamp:
Nov 19, 2006, 1:27:46 AM (17 years ago)
Author:
Bruno Cornec
Message:
  • mondoarchive does not backup acl+xattr by default anymore
  • Add -z option to mondoarchive to support acl+xattr backup
  • small mindi fix
  • this may break mondo compatibility so tests are required before distributing that version.
  • this is still incomplete as that aprameter should be passed for mondorestore to know what to do.
File:
1 edited

Legend:

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

    r947 r948  
    20272027
    20282028    if (filelist == NULL || matches > 0) {
    2029         sprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ,
     2029        if (g_getfattr) {
     2030            sprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ,
    20302031                MNT_CDROM "/archives", current_tarball_number);
    2031         sprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives",
     2032        }
     2033        if (g_getfacl) {
     2034            sprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives",
    20322035                current_tarball_number);
     2036        }
    20332037        if (strstr(tarball_fname, ".bz2")) {
    20342038            strcpy(executable, "bzip2");
     
    20952099        }
    20962100
    2097         log_msg(1, "Setting fattr list %s", xattr_fname);
    2098         if (length_of_file(xattr_fname) > 0) {
    2099             res = set_fattr_list(filelist_subset_fname, xattr_fname);
    2100             if (res) {
    2101                 log_to_screen
    2102                     ("Errors occurred while setting extended attributes");
    2103             } else {
    2104                 log_msg(1, "I set xattr OK");
    2105             }
    2106             retval += res;
    2107         }
    2108         if (length_of_file(acl_fname) > 0) {
     2101        if (g_getfattr) {
     2102            log_msg(1, "Setting fattr list %s", xattr_fname);
     2103            if (length_of_file(xattr_fname) > 0) {
     2104                res = set_fattr_list(filelist_subset_fname, xattr_fname);
     2105                if (res) {
     2106                    log_to_screen
     2107                        ("Errors occurred while setting extended attributes");
     2108                } else {
     2109                    log_msg(1, "I set xattr OK");
     2110                }
     2111                retval += res;
     2112            }
     2113        }
     2114        if (g_getfacl) {
    21092115            log_msg(1, "Setting acl list %s", acl_fname);
    2110             res = set_acl_list(filelist_subset_fname, acl_fname);
    2111             if (res) {
    2112                 log_to_screen
    2113                     ("Errors occurred while setting access control lists");
    2114             } else {
    2115                 log_msg(1, "I set ACL OK");
    2116             }
    2117             retval += res;
     2116            if (length_of_file(acl_fname) > 0) {
     2117                res = set_acl_list(filelist_subset_fname, acl_fname);
     2118                if (res) {
     2119                    log_to_screen
     2120                        ("Errors occurred while setting access control lists");
     2121                } else {
     2122                    log_msg(1, "I set ACL OK");
     2123                }
     2124                retval += res;
     2125            }
    21182126        }
    21192127        if (retval) {
     
    23032311        paranoid_system(command);
    23042312
    2305         iamhere("Restoring xattr, acl stuff");
    2306         res = set_fattr_list(filelist_subset_fname, xattr_fname);
    2307         if (res) {
    2308             log_msg(1, "Errors occurred while setting xattr");
    2309         } else {
    2310             log_msg(1, "I set xattr OK");
    2311         }
    2312         retval += res;
    2313 
    2314         res = set_acl_list(filelist_subset_fname, acl_fname);
    2315         if (res) {
    2316             log_msg(1, "Errors occurred while setting ACL");
    2317         } else {
    2318             log_msg(1, "I set ACL OK");
    2319         }
    2320         retval += res;
     2313        if (g_getfattr) {
     2314            iamhere("Restoring xattr stuff");
     2315            res = set_fattr_list(filelist_subset_fname, xattr_fname);
     2316            if (res) {
     2317                log_msg(1, "Errors occurred while setting xattr");
     2318            } else {
     2319                log_msg(1, "I set xattr OK");
     2320            }
     2321            retval += res;
     2322        }
     2323
     2324        if (g_getfacl) {
     2325            iamhere("Restoring acl stuff");
     2326            res = set_acl_list(filelist_subset_fname, acl_fname);
     2327            if (res) {
     2328                log_msg(1, "Errors occurred while setting ACL");
     2329            } else {
     2330                log_msg(1, "I set ACL OK");
     2331            }
     2332            retval += res;
     2333        }
    23212334
    23222335    } else {
     
    24592472    if (fbw) {
    24602473        fclose(fbw);
    2461         sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
    2462         sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
    2463         if (length_of_file(acl_fname) > 0) {
    2464             set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname);
    2465         }
    2466         if (length_of_file(xattr_fname) > 0) {
    2467             set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname);
     2474        if (g_getfattr) {
     2475            sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
     2476            if (length_of_file(xattr_fname) > 0) {
     2477                set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname);
     2478            }
     2479        }
     2480        if (g_getfacl) {
     2481            sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
     2482            if (length_of_file(acl_fname) > 0) {
     2483                set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname);
     2484            }
    24682485        }
    24692486    }
     
    26812698    total_slices = atol(tmp);
    26822699    sprintf(tmp, "Reassembling large files      ");
    2683     sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    2684     sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2700    if (g_getfattr) {
     2701        sprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2702    }
     2703    if (g_getfacl) {
     2704        sprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2705    }
    26852706    mvaddstr_and_log_it(g_currentY, 0, tmp);
    26862707    sprintf(biggies_whose_EXATs_we_should_set,
     
    27592780        if (length_of_file(biggies_whose_EXATs_we_should_set) > 2) {
    27602781            iamhere("Setting biggie-EXATs");
    2761             if (length_of_file(acl_fname) > 0) {
    2762                 log_msg(1, "set_acl_list(%s,%s)",
    2763                         biggies_whose_EXATs_we_should_set, acl_fname);
    2764                 set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname);
    2765             }
    2766             if (length_of_file(xattr_fname) > 0) {
    2767                 log_msg(1, "set_fattr_List(%s,%s)",
     2782            if (g_getfattr) {
     2783                if (length_of_file(xattr_fname) > 0) {
     2784                    log_msg(1, "set_fattr_List(%s,%s)",
    27682785                        biggies_whose_EXATs_we_should_set, xattr_fname);
    2769                 set_fattr_list(biggies_whose_EXATs_we_should_set,
     2786                    set_fattr_list(biggies_whose_EXATs_we_should_set,
    27702787                               xattr_fname);
     2788                }
     2789            }
     2790            if (g_getfacl) {
     2791                if (length_of_file(acl_fname) > 0) {
     2792                    log_msg(1, "set_acl_list(%s,%s)",
     2793                            biggies_whose_EXATs_we_should_set, acl_fname);
     2794                    set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname);
     2795                }
    27712796            }
    27722797        } else {
     
    28702895    while (ctrl_chr != BLK_STOP_AFIOBALLS) {
    28712896        update_progress_form(progress_str);
    2872         sprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir,
     2897        if (g_getfattr) {
     2898            sprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir,
    28732899                current_afioball_number);
    2874         sprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir,
     2900            unlink(xattr_fname);
     2901        }
     2902        if (g_getfacl) {
     2903            sprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir,
    28752904                current_afioball_number);
    2876         unlink(xattr_fname);
    2877         unlink(acl_fname);
     2905            unlink(acl_fname);
     2906        }
    28782907        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
    28792908            iamhere("Reading EXAT files from tape");
     
    29142943        res =
    29152944            read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr);
    2916         unlink(xattr_fname);
    2917         unlink(acl_fname);
     2945        if (g_getfattr) {
     2946            unlink(xattr_fname);
     2947        }
     2948        if (g_getfacl) {
     2949            unlink(acl_fname);
     2950        }
    29182951    }                           // next
    29192952    log_msg(1, "All done with afioballs");
Note: See TracChangeset for help on using the changeset viewer.