From 3bdac428d5dfb5c609b8012e4a6a1df7a7eb91dd Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sun, 4 Oct 2015 13:20:50 -0500 Subject: [PATCH] wimlib-imagex: add options to enable unsafe compaction --- doc/man1/wimlib-imagex-capture.1 | 3 +++ doc/man1/wimlib-imagex-delete.1 | 3 +++ doc/man1/wimlib-imagex-export.1 | 3 +++ doc/man1/wimlib-imagex-optimize.1 | 10 ++++++++++ doc/man1/wimlib-imagex-update.1 | 3 +++ programs/imagex.c | 21 +++++++++++++++++++++ 6 files changed, 43 insertions(+) diff --git a/doc/man1/wimlib-imagex-capture.1 b/doc/man1/wimlib-imagex-capture.1 index 1ba4c4ff..6fc180b1 100644 --- a/doc/man1/wimlib-imagex-capture.1 +++ b/doc/man1/wimlib-imagex-capture.1 @@ -559,6 +559,9 @@ can, however, still be overridden through the \fB--compress\fR and default, set the configuration file to \fISOURCE\fR\\Windows\\System32\\WimBootCompress.ini if present and accessible; however, this may still be overridden through the \fB--config\fR parameter. +.TP +\fB--unsafe-compact\fR +See the documentation for this option in \fBwimlib-imagex-optimize\fR (1). .SH NOTES \fBwimlib-imagex append\fR does not support appending an image to a split WIM. .PP diff --git a/doc/man1/wimlib-imagex-delete.1 b/doc/man1/wimlib-imagex-delete.1 index f633f941..899c109b 100644 --- a/doc/man1/wimlib-imagex-delete.1 +++ b/doc/man1/wimlib-imagex-delete.1 @@ -44,6 +44,9 @@ saved by deleting an image in this way. .IP "" You may use \fBwimlib-imagex optimize\fR to delete unreferenced streams from a WIM that has had images soft-deleted from it. +.TP +\fB--unsafe-compact\fR +See the documentation for this option in \fBwimlib-imagex-optimize\fR (1). .SH EXAMPLES Delete the first image from 'boot.wim': .RS diff --git a/doc/man1/wimlib-imagex-export.1 b/doc/man1/wimlib-imagex-export.1 index b1fb10cb..c09dabee 100644 --- a/doc/man1/wimlib-imagex-export.1 +++ b/doc/man1/wimlib-imagex-export.1 @@ -132,6 +132,9 @@ pipable, or if \fIDEST_WIMFILE\fR was "-" (standard output). Mark the destination image as WIMBoot-compatible. Also, if exporting to a new archive, set the compression type to that recommended for WIMBoot (currently, XPRESS with 4096 byte chunks). +.TP +\fB--unsafe-compact\fR +See the documentation for this option in \fBwimlib-imagex-optimize\fR (1). .SH SPLIT WIMS You may use \fBwimlib-imagex export\fR to export images from a split WIM. The \fISRC_WIMFILE\fR argument must specify the first part of the split WIM, diff --git a/doc/man1/wimlib-imagex-optimize.1 b/doc/man1/wimlib-imagex-optimize.1 index 98dd666a..713b92b3 100644 --- a/doc/man1/wimlib-imagex-optimize.1 +++ b/doc/man1/wimlib-imagex-optimize.1 @@ -77,6 +77,16 @@ pipable. \fB--not-pipable\fR Rebuild the WIM in the non-pipable format. (This is the default if \fIWIMFILE\fR is not pipable.) +.TP +\fB--unsafe-compact\fR +Compact the WIM file in-place, without using a temporary file. Existing +resources are shifted down to fill holes and new resources are appended as +needed. The WIM file is truncated to its final size, which may shrink the +on-disk file. THIS OPERATION CANNOT BE SAFELY INTERRUPTED! If the operation is +interrupted, then the WIM file will be corrupted, and it may be impossible (or +at least very difficult) to recover any data from it. Users of this option are +expected to know what they are doing and assume responsibility for any data +corruption that may result. .SH NOTES \fBwimlib-imagex optimize\fR does not support split WIMs. .PP diff --git a/doc/man1/wimlib-imagex-update.1 b/doc/man1/wimlib-imagex-update.1 index 6bb4e300..73f52027 100644 --- a/doc/man1/wimlib-imagex-update.1 +++ b/doc/man1/wimlib-imagex-update.1 @@ -163,6 +163,9 @@ This sets \fIFILE\fR as the WIMBoot configuration file for the image. The extracted as WIMBoot pointer files (perhaps due to being needed early in the boot process). See the documentation for the \fB--wimboot\fR option of \fBwimlib-imagex apply\fR (1) for more information. +.TP +\fB--unsafe-compact\fR +See the documentation for this option in \fBwimlib-imagex-optimize\fR (1). .SH NOTES \fBwimlib-imagex update\fR is partly redundant with \fBwimlib-imagex mountrw\fR, since if a WIM image can be mounted read-write, then there diff --git a/programs/imagex.c b/programs/imagex.c index a086558c..23f362b6 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -194,6 +194,7 @@ enum { IMAGEX_THREADS_OPTION, IMAGEX_TO_STDOUT_OPTION, IMAGEX_UNIX_DATA_OPTION, + IMAGEX_UNSAFE_COMPACT_OPTION, IMAGEX_UPDATE_OF_OPTION, IMAGEX_VERBOSE_OPTION, IMAGEX_WIMBOOT_CONFIG_OPTION, @@ -254,12 +255,14 @@ static const struct option capture_or_append_options[] = { {T("update-of"), required_argument, NULL, IMAGEX_UPDATE_OF_OPTION}, {T("delta-from"), required_argument, NULL, IMAGEX_DELTA_FROM_OPTION}, {T("wimboot"), no_argument, NULL, IMAGEX_WIMBOOT_OPTION}, + {T("unsafe-compact"), no_argument, NULL, IMAGEX_UNSAFE_COMPACT_OPTION}, {NULL, 0, NULL, 0}, }; static const struct option delete_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, {T("soft"), no_argument, NULL, IMAGEX_SOFT_OPTION}, + {T("unsafe-compact"), no_argument, NULL, IMAGEX_UNSAFE_COMPACT_OPTION}, {NULL, 0, NULL, 0}, }; @@ -293,6 +296,7 @@ static const struct option export_options[] = { {T("pipable"), no_argument, NULL, IMAGEX_PIPABLE_OPTION}, {T("not-pipable"), no_argument, NULL, IMAGEX_NOT_PIPABLE_OPTION}, {T("wimboot"), no_argument, NULL, IMAGEX_WIMBOOT_OPTION}, + {T("unsafe-compact"), no_argument, NULL, IMAGEX_UNSAFE_COMPACT_OPTION}, {NULL, 0, NULL, 0}, }; @@ -366,6 +370,7 @@ static const struct option optimize_options[] = { {T("threads"), required_argument, NULL, IMAGEX_THREADS_OPTION}, {T("pipable"), no_argument, NULL, IMAGEX_PIPABLE_OPTION}, {T("not-pipable"), no_argument, NULL, IMAGEX_NOT_PIPABLE_OPTION}, + {T("unsafe-compact"), no_argument, NULL, IMAGEX_UNSAFE_COMPACT_OPTION}, {NULL, 0, NULL, 0}, }; @@ -410,6 +415,7 @@ static const struct option update_options[] = { {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}, + {T("unsafe-compact"), no_argument, NULL, IMAGEX_UNSAFE_COMPACT_OPTION}, {NULL, 0, NULL, 0}, }; @@ -1951,6 +1957,9 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) case IMAGEX_WIMBOOT_OPTION: add_flags |= WIMLIB_ADD_FLAG_WIMBOOT; break; + case IMAGEX_UNSAFE_COMPACT_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_UNSAFE_COMPACT; + break; default: goto out_usage; } @@ -2353,6 +2362,9 @@ imagex_delete(int argc, tchar **argv, int cmd) case IMAGEX_SOFT_OPTION: write_flags |= WIMLIB_WRITE_FLAG_SOFT_DELETE; break; + case IMAGEX_UNSAFE_COMPACT_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_UNSAFE_COMPACT; + break; default: goto out_usage; } @@ -2837,6 +2849,9 @@ imagex_export(int argc, tchar **argv, int cmd) case IMAGEX_WIMBOOT_OPTION: export_flags |= WIMLIB_EXPORT_FLAG_WIMBOOT; break; + case IMAGEX_UNSAFE_COMPACT_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_UNSAFE_COMPACT; + break; default: goto out_usage; } @@ -3735,6 +3750,9 @@ imagex_optimize(int argc, tchar **argv, int cmd) case IMAGEX_NOT_PIPABLE_OPTION: write_flags |= WIMLIB_WRITE_FLAG_NOT_PIPABLE; break; + case IMAGEX_UNSAFE_COMPACT_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_UNSAFE_COMPACT; + break; default: goto out_usage; } @@ -4032,6 +4050,9 @@ imagex_update(int argc, tchar **argv, int cmd) case IMAGEX_NO_REPLACE_OPTION: default_add_flags |= WIMLIB_ADD_FLAG_NO_REPLACE; break; + case IMAGEX_UNSAFE_COMPACT_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_UNSAFE_COMPACT; + break; default: goto out_usage; } -- 2.43.0