]> wimlib.net Git - wimlib/commitdiff
wimlib-imagex: add --include-integrity option
authorEric Biggers <ebiggers3@gmail.com>
Sun, 21 Jan 2018 21:47:10 +0000 (13:47 -0800)
committerEric Biggers <ebiggers3@gmail.com>
Sun, 21 Jan 2018 21:47:10 +0000 (13:47 -0800)
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.

doc/man1/wimcapture.1
doc/man1/wimdelete.1
doc/man1/wimexport.1
doc/man1/wiminfo.1
doc/man1/wimjoin.1
doc/man1/wimoptimize.1
doc/man1/wimsplit.1
doc/man1/wimupdate.1
programs/imagex.c

index 0830ffe296263c09602d7e2977954af417a6e56e..990c04c2754e19cee37b5389abfe5cb720201993 100644 (file)
@@ -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.
index 63151063d502a38f5bc5ff97794afe0bd19be84f..20e0801bbe62cabf1868eaf05fbb5f253c08a714 100644 (file)
@@ -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
index dc9bef7e5c8f0544dd02ce3fed7749c99cd69fe9..6cea5faa43bcbfdd7abb7ecbb3a0b1968bbd1d57 100644 (file)
@@ -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
index 789c0dbc7d97aa6e980845329e48ca914eda8a33..0567517a072cc79c2da501e9166316c384c8bfbb 100644 (file)
@@ -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
index eb7b400454bf8242112aba2f0a3247cb4be59a52..6073aab30d4882db9d0231cb7b033b1c291e34c7 100644 (file)
@@ -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
index 832279deb598da9bee6fb8854ef7dad80f409dbc..657f7df65b0d8ef46967dffdc479f039d511adf5 100644 (file)
@@ -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
index 06ac0d38db73f0993c9c0be01d795ed565a6a6be..de1eb207a19b16d050fc83f4d84cdb04841963b2 100644 (file)
@@ -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:
index e4e7b01a10af72de6adcff83b9934da718c3cc3c..a3beadf9a67329791d6d8f99f8b9f1fa54e6642b 100644 (file)
@@ -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).
index 69d7a6c74e7e5760a04c30d44d2d4f5934d1a3b9..a10ac488fdfbc4bb66949fdeae18a3193f253890 100644 (file)
@@ -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: