imagex_capture_or_append(int argc, tchar **argv, int cmd)
{
int c;
- int open_flags = WIMLIB_OPEN_FLAG_WRITE_ACCESS;
- int add_image_flags = WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE |
- WIMLIB_ADD_IMAGE_FLAG_WINCONFIG |
- WIMLIB_ADD_IMAGE_FLAG_VERBOSE;
+ int open_flags = 0;
+ int add_flags = WIMLIB_ADD_FLAG_EXCLUDE_VERBOSE |
+ WIMLIB_ADD_FLAG_WINCONFIG |
+ WIMLIB_ADD_FLAG_VERBOSE;
int write_flags = 0;
int compression_type = WIMLIB_COMPRESSION_TYPE_INVALID;
uint32_t chunk_size = UINT32_MAX;
for_opt(c, capture_or_append_options) {
switch (c) {
case IMAGEX_BOOT_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_BOOT;
+ add_flags |= WIMLIB_ADD_FLAG_BOOT;
break;
case IMAGEX_CHECK_OPTION:
open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY;
break;
case IMAGEX_CONFIG_OPTION:
config_file = optarg;
- add_image_flags &= ~WIMLIB_ADD_IMAGE_FLAG_WINCONFIG;
+ add_flags &= ~WIMLIB_ADD_FLAG_WINCONFIG;
break;
case IMAGEX_COMPRESS_OPTION:
compression_type = get_compression_type(optarg);
flags_element = optarg;
break;
case IMAGEX_DEREFERENCE_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_DEREFERENCE;
+ add_flags |= WIMLIB_ADD_FLAG_DEREFERENCE;
break;
case IMAGEX_VERBOSE_OPTION:
/* No longer does anything. */
write_flags |= WIMLIB_WRITE_FLAG_REBUILD;
break;
case IMAGEX_UNIX_DATA_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_UNIX_DATA;
+ add_flags |= WIMLIB_ADD_FLAG_UNIX_DATA;
break;
case IMAGEX_SOURCE_LIST_OPTION:
source_list = true;
break;
case IMAGEX_NO_ACLS_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_NO_ACLS;
+ add_flags |= WIMLIB_ADD_FLAG_NO_ACLS;
break;
case IMAGEX_STRICT_ACLS_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_STRICT_ACLS;
+ add_flags |= WIMLIB_ADD_FLAG_STRICT_ACLS;
break;
case IMAGEX_RPFIX_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_RPFIX;
+ add_flags |= WIMLIB_ADD_FLAG_RPFIX;
break;
case IMAGEX_NORPFIX_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_NORPFIX;
+ add_flags |= WIMLIB_ADD_FLAG_NORPFIX;
break;
case IMAGEX_PIPABLE_OPTION:
write_flags |= WIMLIB_WRITE_FLAG_PIPABLE;
write_flags |= WIMLIB_WRITE_FLAG_SKIP_EXTERNAL_WIMS;
break;
case IMAGEX_WIMBOOT_OPTION:
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_WIMBOOT;
+ add_flags |= WIMLIB_ADD_FLAG_WIMBOOT;
break;
default:
goto out_usage;
if (compression_type == WIMLIB_COMPRESSION_TYPE_INVALID) {
/* No compression type specified. Use the default. */
- if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_WIMBOOT) {
+ if (add_flags & WIMLIB_ADD_FLAG_WIMBOOT) {
/* With --wimboot, default to XPRESS compression. */
compression_type = WIMLIB_COMPRESSION_TYPE_XPRESS;
} else if (write_flags & WIMLIB_WRITE_FLAG_PACK_STREAMS) {
/* Open the existing WIM, or create a new one. */
if (cmd == CMD_APPEND) {
- ret = wimlib_open_wim_with_progress(wimfile, open_flags, &wim,
- imagex_progress_func, NULL);
+ ret = wimlib_open_wim_with_progress(wimfile,
+ open_flags | WIMLIB_OPEN_FLAG_WRITE_ACCESS,
+ &wim,
+ imagex_progress_func,
+ NULL);
if (ret)
goto out_free_capture_sources;
} else {
ret = wimlib_set_output_chunk_size(wim, chunk_size);
if (ret)
goto out_free_wim;
- } else if ((add_image_flags & WIMLIB_ADD_IMAGE_FLAG_WIMBOOT) &&
+ } else if ((add_flags & WIMLIB_ADD_FLAG_WIMBOOT) &&
compression_type == WIMLIB_COMPRESSION_TYPE_XPRESS) {
ret = wimlib_set_output_chunk_size(wim, 4096);
if (ret)
if (S_ISBLK(stbuf.st_mode) || S_ISREG(stbuf.st_mode)) {
imagex_printf(T("Capturing WIM image from NTFS "
"filesystem on \"%"TS"\"\n"), source);
- add_image_flags |= WIMLIB_ADD_IMAGE_FLAG_NTFS;
+ add_flags |= WIMLIB_ADD_FLAG_NTFS;
}
} else {
if (errno != ENOENT) {
for (size_t i = 0; i < base_wimfiles.num_strings; i++) {
ret = wimlib_open_wim_with_progress(
- base_wimfiles.strings[i],
- open_flags & ~WIMLIB_OPEN_FLAG_WRITE_ACCESS,
+ base_wimfiles.strings[i], open_flags,
&base_wims[i], imagex_progress_func, NULL);
if (ret)
goto out_free_base_wims;
template_wim = wim;
} else {
ret = wimlib_open_wim_with_progress(template_wimfile,
- open_flags & ~WIMLIB_OPEN_FLAG_WRITE_ACCESS,
+ open_flags,
&template_wim,
imagex_progress_func,
NULL);
num_sources,
name,
config_file,
- add_image_flags);
+ add_flags);
if (ret)
goto out_free_template_wim;
{
static tchar buf[50];
if (cmd == CMD_NONE) {
- tsprintf(buf, T("%"TS), T(IMAGEX_PROGNAME));
+ return T("wimlib-imagex");
} else if (invocation_cmd != CMD_NONE) {
tsprintf(buf, T("wim%"TS), imagex_commands[cmd].name);
} else {
{
static const tchar *s =
T(
-IMAGEX_PROGNAME " (distributed with " PACKAGE " " PACKAGE_VERSION ")\n"
+"wimlib-imagex (distributed with " PACKAGE " " PACKAGE_VERSION ")\n"
"Copyright (C) 2012, 2013, 2014 Eric Biggers\n"
"License GPLv3+; GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.\n"
"This is free software: you are free to change and redistribute it.\n"
/* Allow being invoked as wimCOMMAND (e.g. wimapply). */
cmd = CMD_NONE;
if (!tstrncmp(invocation_name, T("wim"), 3) &&
- tstrcmp(invocation_name, T(IMAGEX_PROGNAME))) {
+ tstrcmp(invocation_name, T("wimlib-imagex"))) {
for (int i = 0; i < CMD_MAX; i++) {
if (!tstrcmp(invocation_name + 3,
imagex_commands[i].name))