IMAGEX_NOT_PIPABLE_OPTION,
IMAGEX_NO_ACLS_OPTION,
IMAGEX_NO_ATTRIBUTES_OPTION,
+ IMAGEX_NO_REPLACE_OPTION,
IMAGEX_NO_WILDCARDS_OPTION,
IMAGEX_NULLGLOB_OPTION,
IMAGEX_ONE_FILE_ONLY_OPTION,
IMAGEX_UPDATE_OF_OPTION,
IMAGEX_VERBOSE_OPTION,
IMAGEX_WIMBOOT_OPTION,
+ IMAGEX_WIMBOOT_CONFIG_OPTION,
IMAGEX_XML_OPTION,
};
{T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION},
{T("rebuild"), no_argument, NULL, IMAGEX_REBUILD_OPTION},
{T("command"), required_argument, NULL, IMAGEX_COMMAND_OPTION},
+ {T("wimboot-config"), required_argument, NULL, IMAGEX_WIMBOOT_CONFIG_OPTION},
/* Default delete options */
{T("force"), no_argument, NULL, IMAGEX_FORCE_OPTION},
{T("noacls"), no_argument, NULL, IMAGEX_NO_ACLS_OPTION},
{T("no-acls"), no_argument, NULL, IMAGEX_NO_ACLS_OPTION},
{T("strict-acls"), no_argument, NULL, IMAGEX_STRICT_ACLS_OPTION},
+ {T("no-replace"), no_argument, NULL, IMAGEX_NO_REPLACE_OPTION},
{NULL, 0, NULL, 0},
};
break;
}
break;
+ case WIMLIB_PROGRESS_MSG_REPLACE_FILE_IN_WIM:
+ imagex_printf(T("Updating \"%"TS"\" in WIM image\n"),
+ info->replace.path_in_wim);
+ break;
default:
break;
}
cmd->add.add_flags |= WIMLIB_ADD_FLAG_STRICT_ACLS;
else if (!tstrcmp(option, T("--dereference")))
cmd->add.add_flags |= WIMLIB_ADD_FLAG_DEREFERENCE;
+ else if (!tstrcmp(option, T("--no-replace")))
+ cmd->add.add_flags |= WIMLIB_ADD_FLAG_NO_REPLACE;
else
recognized = false;
break;
return cmds;
}
-/* Apply one image, or all images, from a WIM file into a directory, OR apply
+/* Apply one image, or all images, from a WIM file to a directory, OR apply
* one image from a WIM file to a NTFS volume. */
static int
imagex_apply(int argc, tchar **argv, int cmd)
size_t num_cmds;
tchar *command_str = NULL;
tchar *config_file = NULL;
+ tchar *wimboot_config = NULL;
for_opt(c, update_options) {
switch (c) {
goto out_err;
}
break;
+ case IMAGEX_WIMBOOT_CONFIG_OPTION:
+ wimboot_config = optarg;
+ break;
/* Default delete options */
case IMAGEX_FORCE_OPTION:
default_delete_flags |= WIMLIB_DELETE_FLAG_FORCE;
case IMAGEX_STRICT_ACLS_OPTION:
default_add_flags |= WIMLIB_ADD_FLAG_STRICT_ACLS;
break;
+ case IMAGEX_NO_REPLACE_OPTION:
+ default_add_flags |= WIMLIB_ADD_FLAG_NO_REPLACE;
+ break;
default:
goto out_usage;
}
cmd_file_contents = NULL;
cmds = parse_update_command_file(&command_str, tstrlen(command_str),
&num_cmds);
- } else {
+ if (!cmds) {
+ ret = -1;
+ goto out_free_cmd_file_contents;
+ }
+ } else if (!wimboot_config) {
if (isatty(STDIN_FILENO)) {
tputs(T("Reading update commands from standard input..."));
recommend_man_page(CMD_UPDATE, stdout);
/* Parse the update commands */
cmds = parse_update_command_file(&cmd_file_contents, cmd_file_nchars,
&num_cmds);
- }
- if (!cmds) {
- ret = -1;
- goto out_free_cmd_file_contents;
+ if (!cmds) {
+ ret = -1;
+ goto out_free_cmd_file_contents;
+ }
+ } else {
+ cmd_file_contents = NULL;
+ cmds = NULL;
+ num_cmds = 0;
}
/* Set default flags and capture config on the update commands */
if (ret)
goto out_free_cmds;
+ if (wimboot_config) {
+ /* --wimboot-config=FILE is short for an
+ * "add FILE /Windows/System32/WimBootCompress.ini" command.
+ */
+ struct wimlib_update_command cmd = {
+ .op = WIMLIB_UPDATE_OP_ADD,
+ .add = {
+ .fs_source_path = wimboot_config,
+ .wim_target_path =
+ T("/Windows/System32/WimBootCompress.ini"),
+ .config_file = NULL,
+ .add_flags = 0,
+ },
+ };
+ ret = wimlib_update_image(wim, image, &cmd, 1,
+ update_flags, imagex_progress_func);
+ if (ret)
+ goto out_free_cmds;
+ }
+
/* Overwrite the updated WIM */
ret = wimlib_overwrite(wim, write_flags, num_threads,
imagex_progress_func);
exit(2);
}
- /* Enable warning and error messages in wimlib be more user-friendly.
+ /* Enable warning and error messages in wimlib to be more user-friendly.
* */
wimlib_set_print_errors(true);