From: Eric Biggers Date: Sun, 21 Jan 2018 21:47:10 +0000 (-0800) Subject: wimlib-imagex: add --include-integrity option X-Git-Tag: v1.13.0~16 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=87dfb824df2eb0054468a6050b6fce8c832890f8 wimlib-imagex: add --include-integrity option The --check option currently does two things: verify the integrity table of the input WIM(s), and include an integrity table in the output WIM(s). Some users would like to do the latter only, especially if there are large input WIM(s). Add an option --include-integrity which does this. --- diff --git a/doc/man1/wimcapture.1 b/doc/man1/wimcapture.1 index 0830ffe2..990c04c2 100644 --- a/doc/man1/wimcapture.1 +++ b/doc/man1/wimcapture.1 @@ -173,7 +173,12 @@ WIM. .TP \fB--check\fR Include extra integrity information in the resulting WIM. With \fBwimappend\fR, -also check the integrity of the WIM before appending to it. +also check the integrity of the WIM before appending to it. Also verify the +integrity of any WIMs specified by \fB--update-of\fR and/or \fB--delta-from\fR. +.TP +\fB--include-integrity\fR +Include extra integrity information in the resulting WIM, i.e. like +\fB--check\fR but don't do any verification beforehand. .TP \fB--compress\fR=\fITYPE\fR[:\fILEVEL\fR] With \fBwimcapture\fR, use the specified compression format in the new WIM file. diff --git a/doc/man1/wimdelete.1 b/doc/man1/wimdelete.1 index 63151063..20e0801b 100644 --- a/doc/man1/wimdelete.1 +++ b/doc/man1/wimdelete.1 @@ -27,7 +27,11 @@ images, although such a file may not be very useful. Before deleting the image, verify the WIM's integrity if extra integrity information is present. In addition, include extra integrity information in the modified WIM, even if it was not present before. -.TP 6 +.TP +\fB--include-integrity\fR +Include extra integrity information in the modified WIM, i.e. like \fB--check\fR +but don't do any verification beforehand. +.TP \fB--soft\fR Perform a "soft delete". Specifying this flag overrides the default behavior of rebuilding the entire WIM after deleting an image. Instead, only minimal diff --git a/doc/man1/wimexport.1 b/doc/man1/wimexport.1 index dc9bef7e..6cea5faa 100644 --- a/doc/man1/wimexport.1 +++ b/doc/man1/wimexport.1 @@ -41,14 +41,19 @@ images are being exported, make the image that was the bootable image of the source WIM also the bootable image of the destination WIM. .TP \fB--check\fR -Before exporting the image(s), verify the integrity of the source and -destination WIMs if extra integrity information is present. Also include extra -integrity information in the destination WIM, even if it was not present before. +Before exporting the image(s), verify the integrity of the source WIM, +destination WIM, and any referenced WIMs whenever they have extra integrity +information present. Also include extra integrity information in the +destination WIM, even if it was not present before. .TP \fB--nocheck\fR Do not include extra integrity information in the destination WIM, even if it was present before. .TP +\fB--include-integrity\fR +Include extra integrity information in the destination WIM, i.e. like +\fB--check\fR but don't do any verification beforehand. +.TP \fB--compress\fR=\fITYPE\fR[:\fILEVEL\fR] Specify the compression type, and optionally the compression level for that compression type, for \fIDEST_WIMFILE\fR. Note that if \fIDEST_WIMFILE\fR diff --git a/doc/man1/wiminfo.1 b/doc/man1/wiminfo.1 index 789c0dbc..0567517a 100644 --- a/doc/man1/wiminfo.1 +++ b/doc/man1/wiminfo.1 @@ -31,12 +31,16 @@ Windows PE from the WIM. .TP \fB--check\fR Verify the integrity of WIM if it contains extra integrity information. In -addition, if modifying the WIM, include extra integrity information in the -modified WIM, even if it was not present before. +addition, if modifying the WIM, add extra integrity information if it was not +present before. .TP \fB--nocheck\fR If modifying the WIM, remove its extra integrity information, if it had any. .TP +\fB--include-integrity\fR +If modifying the WIM, add extra integrity information if it was not present +before, i.e. like \fB--check\fR but don't also do the verification beforehand. +.TP \fB--image-property\fR \fINAME\fR=\fIVALUE\fR Assign an arbitrary property to the specified \fIIMAGE\fR in the XML document of the WIM. \fINAME\fR is an element path such as "WINDOWS/VERSION/MAJOR", and diff --git a/doc/man1/wimjoin.1 b/doc/man1/wimjoin.1 index eb7b4004..6073aab3 100644 --- a/doc/man1/wimjoin.1 +++ b/doc/man1/wimjoin.1 @@ -15,6 +15,10 @@ When reading each \fISPLIT_WIM_PART\fR, verify its integrity if it contains extra integrity information. In addition, include extra integrity information in \fIOUT_WIMFILE\fR, even if the split WIM parts did not contain this information. +.TP +\fB--include-integrity\fR +Include extra integrity information in \fIOUT_WIMFILE\fR, i.e. like +\fB--check\fR but don't also verify the split WIM parts beforehand. .SH EXAMPLES Join a split WIM, with the parts named `windows*.swm' where the * is anything (usually the number of the part, except for the first part which may have no diff --git a/doc/man1/wimoptimize.1 b/doc/man1/wimoptimize.1 index 832279de..657f7df6 100644 --- a/doc/man1/wimoptimize.1 +++ b/doc/man1/wimoptimize.1 @@ -25,6 +25,10 @@ even if it was not present before. Do not include extra integrity information in the optimized WIM, even if it was present before. .TP +\fB--include-integrity\fR +Include extra integrity information in the optimized WIM, i.e. like +\fB--check\fR but don't also verify the WIM beforehand. +.TP \fB--recompress\fR Recompress all data in the WIM while optimizing it. This will significantly increase the time needed to optimize the WIM, but it may result in a better diff --git a/doc/man1/wimsplit.1 b/doc/man1/wimsplit.1 index 06ac0d38..de1eb207 100644 --- a/doc/man1/wimsplit.1 +++ b/doc/man1/wimsplit.1 @@ -16,6 +16,10 @@ having names numbered in order of the parts. Before splitting the WIM, verify its integrity if it contains extra integrity information. Also include extra integrity information in each split WIM part, even if \fIWIMFILE\fR did not contain it. +.TP +\fB--include-integrity\fR +Include extra integrity information in each split WIM part, i.e. like +\fB--check\fR but don't also verify \fIWIMFILE\fR beforehand. .SH EXAMPLES Splits the WIM 'windows.wim' into 'windows.swm', 'windows2.swm', 'windows3.swm', etc. where each part is at most 100 MiB: diff --git a/doc/man1/wimupdate.1 b/doc/man1/wimupdate.1 index e4e7b01a..a3beadf9 100644 --- a/doc/man1/wimupdate.1 +++ b/doc/man1/wimupdate.1 @@ -102,6 +102,10 @@ Before updating the WIM, verify its integrity if it contains extra integrity information. Also include extra integrity information in the updated WIM even if it was not present before. .TP +\fB--include-integrity\fR +Include extra integrity information in the updated WIM, i.e. like \fB--check\fR +but don't also verify the WIM beforehand. +.TP \fB--threads\fR=\fINUM_THREADS\fR Number of threads to use for compressing newly added files. Default: autodetect (number of processors). diff --git a/programs/imagex.c b/programs/imagex.c index 69d7a6c7..a10ac488 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -177,6 +177,7 @@ enum { IMAGEX_FORCE_OPTION, IMAGEX_HEADER_OPTION, IMAGEX_IMAGE_PROPERTY_OPTION, + IMAGEX_INCLUDE_INTEGRITY_OPTION, IMAGEX_INCLUDE_INVALID_NAMES_OPTION, IMAGEX_LAZY_OPTION, IMAGEX_METADATA_OPTION, @@ -241,6 +242,7 @@ static const struct option capture_or_append_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, {T("no-check"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, {T("nocheck"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {T("compress"), required_argument, NULL, IMAGEX_COMPRESS_OPTION}, {T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION}, {T("solid"), no_argument, NULL, IMAGEX_SOLID_OPTION}, @@ -273,6 +275,7 @@ static const struct option capture_or_append_options[] = { static const struct option delete_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {T("soft"), no_argument, NULL, IMAGEX_SOFT_OPTION}, {T("unsafe-compact"), no_argument, NULL, IMAGEX_UNSAFE_COMPACT_OPTION}, {NULL, 0, NULL, 0}, @@ -291,6 +294,7 @@ static const struct option export_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, {T("nocheck"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, {T("no-check"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {T("compress"), required_argument, NULL, IMAGEX_COMPRESS_OPTION}, {T("recompress"), no_argument, NULL, IMAGEX_RECOMPRESS_OPTION}, {T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION}, @@ -334,6 +338,7 @@ static const struct option info_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, {T("nocheck"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, {T("no-check"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {T("extract-xml"), required_argument, NULL, IMAGEX_EXTRACT_XML_OPTION}, {T("header"), no_argument, NULL, IMAGEX_HEADER_OPTION}, {T("lookup-table"), no_argument, NULL, IMAGEX_BLOBS_OPTION}, @@ -345,6 +350,7 @@ static const struct option info_options[] = { static const struct option join_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {NULL, 0, NULL, 0}, }; @@ -365,6 +371,7 @@ static const struct option optimize_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, {T("nocheck"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, {T("no-check"), no_argument, NULL, IMAGEX_NOCHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {T("compress"), required_argument, NULL, IMAGEX_COMPRESS_OPTION}, {T("recompress"), no_argument, NULL, IMAGEX_RECOMPRESS_OPTION}, {T("chunk-size"), required_argument, NULL, IMAGEX_CHUNK_SIZE_OPTION}, @@ -381,6 +388,7 @@ static const struct option optimize_options[] = { static const struct option split_options[] = { {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_OPTION}, {NULL, 0, NULL, 0}, }; @@ -403,6 +411,7 @@ static const struct option update_options[] = { * update_command_add_option(). */ {T("threads"), required_argument, NULL, IMAGEX_THREADS_OPTION}, {T("check"), no_argument, NULL, IMAGEX_CHECK_OPTION}, + {T("include-integrity"), no_argument, NULL, IMAGEX_INCLUDE_INTEGRITY_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}, @@ -1895,6 +1904,8 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) break; case IMAGEX_CHECK_OPTION: open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; case IMAGEX_NOCHECK_OPTION: @@ -2428,6 +2439,8 @@ imagex_delete(int argc, tchar **argv, int cmd) switch (c) { case IMAGEX_CHECK_OPTION: open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; case IMAGEX_SOFT_OPTION: @@ -2889,6 +2902,8 @@ imagex_export(int argc, tchar **argv, int cmd) break; case IMAGEX_CHECK_OPTION: open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; case IMAGEX_NOCHECK_OPTION: @@ -3344,8 +3359,6 @@ imagex_info(int argc, tchar **argv, int cmd) { int c; bool boot = false; - bool check = false; - bool nocheck = false; bool header = false; bool blobs = false; bool xml = false; @@ -3358,6 +3371,7 @@ imagex_info(int argc, tchar **argv, int cmd) int image; int ret; int open_flags = 0; + int write_flags = 0; struct wimlib_wim_info info; for_opt(c, info_options) { @@ -3366,10 +3380,13 @@ imagex_info(int argc, tchar **argv, int cmd) boot = true; break; case IMAGEX_CHECK_OPTION: - check = true; + open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: + write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; case IMAGEX_NOCHECK_OPTION: - nocheck = true; + write_flags |= WIMLIB_WRITE_FLAG_NO_CHECK_INTEGRITY; break; case IMAGEX_HEADER_OPTION: header = true; @@ -3423,14 +3440,6 @@ imagex_info(int argc, tchar **argv, int cmd) goto out; } - if (check && nocheck) { - imagex_error(T("Can't specify both --check and --nocheck")); - goto out_err; - } - - if (check) - open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; - ret = wimlib_open_wim_with_progress(wimfile, open_flags, &wim, imagex_progress_func, NULL); if (ret) @@ -3568,15 +3577,11 @@ imagex_info(int argc, tchar **argv, int cmd) /* Only call wimlib_overwrite() if something actually needs to * be changed. */ if (boot || any_property_changes || - (check && !info.has_integrity_table) || - (nocheck && info.has_integrity_table)) + ((write_flags & WIMLIB_WRITE_FLAG_CHECK_INTEGRITY) && + !info.has_integrity_table) || + ((write_flags & WIMLIB_WRITE_FLAG_NO_CHECK_INTEGRITY) && + info.has_integrity_table)) { - int write_flags = 0; - - if (check) - write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; - if (nocheck) - write_flags |= WIMLIB_WRITE_FLAG_NO_CHECK_INTEGRITY; ret = wimlib_overwrite(wim, write_flags, 1); } else { imagex_printf(T("The file \"%"TS"\" was not modified " @@ -3593,7 +3598,6 @@ out: out_usage: usage(CMD_INFO, stderr); -out_err: ret = -1; goto out; } @@ -3612,6 +3616,8 @@ imagex_join(int argc, tchar **argv, int cmd) switch (c) { case IMAGEX_CHECK_OPTION: swm_open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: wim_write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; default: @@ -3792,6 +3798,8 @@ imagex_optimize(int argc, tchar **argv, int cmd) switch (c) { case IMAGEX_CHECK_OPTION: open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; case IMAGEX_NOCHECK_OPTION: @@ -3939,6 +3947,8 @@ imagex_split(int argc, tchar **argv, int cmd) switch (c) { case IMAGEX_CHECK_OPTION: open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; default: @@ -4084,6 +4094,8 @@ imagex_update(int argc, tchar **argv, int cmd) break; case IMAGEX_CHECK_OPTION: open_flags |= WIMLIB_OPEN_FLAG_CHECK_INTEGRITY; + /* fall-through */ + case IMAGEX_INCLUDE_INTEGRITY_OPTION: write_flags |= WIMLIB_WRITE_FLAG_CHECK_INTEGRITY; break; case IMAGEX_REBUILD_OPTION: