]> wimlib.net Git - wimlib/blobdiff - src/update_image.c
wimlib-imagex, wimlib: Optimize appending new image as update of existing
[wimlib] / src / update_image.c
index 10093a0cec7241db63c37862edc2b57108deaf1d..f2bdba382a7738858cef5ffe0bf54a4eaac26d3c 100644 (file)
@@ -252,11 +252,9 @@ execute_add_command(WIMStruct *wim,
        if (wim_target_path[0] == T('\0'))
                params.add_flags |= WIMLIB_ADD_FLAG_ROOT;
        ret = (*capture_tree)(&branch, fs_source_path, &params);
-       if (ret) {
-               ERROR("Failed to build dentry tree for \"%"TS"\"",
-                     fs_source_path);
+       if (ret)
                goto out_destroy_sd_set;
-       }
+
        if (branch) {
                /* Use the target name, not the source name, for
                 * the root of each branch from a capture
@@ -514,6 +512,23 @@ execute_update_commands(WIMStruct *wim,
        return ret;
 }
 
+
+tchar *winpats[] = {
+       T("/$ntfs.log"),
+       T("/hiberfil.sys"),
+       T("/pagefile.sys"),
+       T("/System Volume Information"),
+       T("/RECYCLER"),
+       T("/Windows/CSC"),
+};
+
+static const struct wimlib_capture_config winconfig = {
+       .exclusion_pats = {
+               .num_pats = ARRAY_LEN(winpats),
+               .pats = winpats,
+       },
+};
+
 static int
 check_add_command(struct wimlib_update_command *cmd,
                  const struct wim_header *hdr)
@@ -648,6 +663,7 @@ copy_update_commands(const struct wimlib_update_command *cmds,
 {
        int ret;
        struct wimlib_update_command *cmds_copy;
+       const struct wimlib_capture_config *config;
 
        cmds_copy = CALLOC(num_cmds, sizeof(cmds[0]));
        if (!cmds_copy)
@@ -664,8 +680,11 @@ copy_update_commands(const struct wimlib_update_command *cmds,
                        if (!cmds_copy[i].add.fs_source_path ||
                            !cmds_copy[i].add.wim_target_path)
                                goto oom;
-                       if (cmds[i].add.config) {
-                               ret = copy_and_canonicalize_capture_config(cmds[i].add.config,
+                       config = cmds[i].add.config;
+                       if (cmds[i].add.add_flags & WIMLIB_ADD_FLAG_WINCONFIG)
+                               config = &winconfig;
+                       if (config) {
+                               ret = copy_and_canonicalize_capture_config(config,
                                                                           &cmds_copy[i].add.config);
                                if (ret)
                                        goto err;