]> wimlib.net Git - wimlib/blob - doc/man1/wimupdate.1
f1c82ba4e1104e5513ebe8918217028e1d8b6940
[wimlib] / doc / man1 / wimupdate.1
1 .TH WIMUPDATE "1" "February 2024" "wimlib 1.14.4" "User Commands"
2 .SH NAME
3 wimupdate \- Update a WIM image
4 .SH SYNOPSIS
5 \fBwimupdate\fR \fIWIMFILE\fR [\fIIMAGE\fR] [\fIOPTION\fR...] [< \fICMDFILE\fR]
6 .SH DESCRIPTION
7 \fBwimupdate\fR, or equivalently \fBwimlib-imagex update\fR, modifies the
8 specified \fIIMAGE\fR in the Windows Imaging (WIM) archive \fIWIMFILE\fR by
9 adding, deleting, or renaming files or directories in it.
10 .PP
11 \fIIMAGE\fR specifies the image in \fIWIMFILE\fR to update.  It may be the 1-based
12 index of an image or the name of an image.  It may be omitted if \fIWIMFILE\fR
13 contains only one image.  You can use \fBwiminfo\fR(1) to list the images
14 contained in \fIWIMFILE\fR.
15 .PP
16 The modifications to perform on the WIM image are specified as a sequence of
17 commands, one per line, read in a text file (UTF-8 or UTF-16LE encoded; plain
18 ASCII is also fine) from standard input.  It is recommended that standard input
19 be redirected from a file (\fICMDFILE\fR), as shown above, rather than typing in
20 commands interactively.  Alternatively, to specify a command directly on the
21 command line, see the \fB--command\fR option.
22 .SH AVAILABLE COMMANDS
23 This section documents the commands that may appear in the \fICMDFILE\fR
24 described above.
25 .SS \fBadd\fR [\fIOPTION\fR...] \fISOURCE\fR \fIDESTINATION\fR
26 Add a file or directory tree to the WIM image.  \fISOURCE\fR must specify the
27 path to a file or directory on your filesystem.  \fIDESTINATION\fR must specify
28 the path inside the WIM image at which to add the file or directory tree.
29 .PP
30 If \fIDESTINATION\fR names an existing directory in the WIM image, then
31 \fISOURCE\fR must also name a directory.  This causes the contents of the
32 \fISOURCE\fR directory to be added to the \fIDESTINATION\fR directory.
33 .PP
34 If \fIDESTINATION\fR names an existing nondirectory file in the WIM image, then
35 \fISOURCE\fR must also name a nondirectory file.  By default, this causes the
36 \fIDESTINATION\fR file to be replaced with the \fISOURCE\fR file.  Or, with
37 \fB--no-replace\fR specified, this generates an error.
38 .PP
39 If \fIDESTINATION\fR does not exist in the WIM image, then any prerequisite
40 directories are created as needed to add the \fISOURCE\fR at that location.
41 .PP
42 The \fBadd\fR command supports a subset of the options accepted by
43 \fBwimcapture\fR; namely, \fB--dereference\fR, \fB--unix-data\fR,
44 \fB--no-acls\fR, and \fB--strict-acls\fR.  See \fBwimcapture\fR(1) for
45 explanations of these options.
46 .PP
47 In addition, the \fBadd\fR command supports the \fB--no-replace\fR option, which
48 causes the \fBadd\fR command to refuse to overwrite existing nondirectory files
49 in the WIM image.
50 .SS \fBdelete\fR [\fIOPTION\fR...] \fIPATH\fR
51 Delete a file or directory tree from the WIM image.  \fIPATH\fR must specify the
52 path inside the WIM image of the file or directory tree to delete.
53 .PP
54 The available options for the \fBdelete\fR command are:
55 .TP 6
56 \fB--force\fR
57 Do not issue an error if the path to delete does not exist.
58 .TP
59 \fB--recursive\fR
60 Delete the file or directory tree recursively; if not specified, an error is
61 issued if the path to delete is a directory.
62 .SS \fBrename\fR \fIOLD_PATH\fR \fINEW_PATH\fR
63 Rename a file or directory tree inside the WIM image.  \fIOLD_PATH\fR must
64 specify the old path of the file or directory tree inside the WIM image, and
65 \fINEW_PATH\fR must specify the new path for the file or directory tree.  This
66 command follows the semantics of the POSIX \fBrename\fR (3) function; in
67 particular, a pre-existing file at \fINEW_PATH\fR will be deleted if present,
68 except in certain cases such as attempting to rename a directory to a
69 non-directory, which is not allowed.
70 .PP
71 There are no options available for the \fBrename\fR command.
72 .SH OPTIONS
73 The following options are accepted on the command line by \fBwimupdate\fR
74 itself:
75 .TP 6
76 \fB--dereference\fR
77 Use \fB--dereference\fR for all \fBadd\fR commands.
78 .TP
79 \fB--unix-data\fR
80 Use \fB--unix-data\fR for all \fBadd\fR commands.
81 .TP
82 \fB--no-acls\fR
83 Use \fB--no-acls\fR for all \fBadd\fR commands.
84 .TP
85 \fB--strict-acls\fR
86 Use \fB--strict-acls\fR for all \fBadd\fR commands.
87 .TP
88 \fB--no-replace\fR
89 Use \fB--no-replace\fR for all \fBadd\fR commands.
90 .TP
91 \fB--config\fR=\fIFILE\fR
92 Set the capture configuration file for all \fBadd\fR commands.  See the
93 description of this option to \fBwimcapture\fR(1).
94 .TP
95 \fB--force\fR
96 Use \fB--force\fR for all \fBdelete\fR commands.
97 .TP
98 \fB--recursive\fR
99 Use \fB--recursive\fR for all \fBdelete\fR commands.
100 .TP
101 \fB--check\fR
102 Before updating the WIM, verify its integrity if it contains extra integrity
103 information.  Also include extra integrity information in the updated WIM even
104 if it was not present before.
105 .TP
106 \fB--include-integrity\fR
107 Include extra integrity information in the updated WIM, i.e. like \fB--check\fR
108 but don't also verify the WIM beforehand.
109 .TP
110 \fB--threads\fR=\fINUM_THREADS\fR
111 Number of threads to use for compressing newly added files.  Default: autodetect
112 (number of processors).
113 .TP
114 \fB--rebuild\fR
115 Rebuild the entire WIM rather than appending the updated data to the end of it.
116 Rebuilding the WIM is slower, but will save a little bit of space that would
117 otherwise be left as a hole in the WIM file.
118 .IP
119 See \fBwimoptimize\fR(1) for a more customizable way of rebuilding (and
120 optionally recompressing) a WIM file.  If running \fBwimoptimize\fR after
121 \fBwimupdate\fR, there is no need to specify \fB--rebuild\fR to \fBwimupdate\fR.
122 .TP
123 \fB--command\fR=\fISTRING\fR
124 Instead of reading update commands from standard input, read a single update
125 command directly from the string \fISTRING\fR specified on the command line.
126 This option cannot be provided more than one time and cannot be used to specify
127 more than one update command.  Note that the \fISTRING\fR, as well as any
128 paths containing spaces within the \fISTRING\fR must be appropriately quoted.
129 If running from cmd.exe on Windows, you should use double quotes for the outer
130 quotes and single quotes for the inner quotes.  Example:
131 .IP
132 .RS
133 .RS
134 wimupdate boot.wim 1 --command="add 'C:\\My Dir' '\\My Dir'"
135 .RE
136 .RE
137 .IP
138 This option is provided for convenience only.  Do not execute \fBwimupdate\fR
139 multiple consecutive times, each time passing the \fB--command\fR option!  This
140 is inefficient.  Instead, generate an update command file and provide it (on
141 standard input) to a single invocation of \fBwimupdate\fR, as explained in this
142 document.
143 .TP
144 \fB--wimboot-config\fR=\fIFILE\fR
145 If this option is specified, no commands shall be read from standard input, and
146 instead the following command shall be executed:
147 .IP
148 .nf
149 .RS
150 .RS
151 \fBadd\fR \fIFILE\fR /Windows/System32/WimBootCompress.ini
152 .RE
153 .RE
154 .fi
155 .IP
156 This sets \fIFILE\fR as the WIMBoot configuration file for the image.  The
157 [PrepopulateList] section of this file specifies path globs that shall not be
158 extracted as WIMBoot pointer files (perhaps due to being needed early in the
159 boot process).  See the documentation for the \fB--wimboot\fR option of
160 \fBwimapply\fR(1) for more information.
161 .TP
162 \fB--unsafe-compact\fR
163 Compact the WIM archive in-place and append any new data, eliminating "holes".
164 This is efficient, but in general this option should \fInot\fR be used because a
165 failed or interrupted compaction will corrupt the WIM archive.  For more
166 information, see the documentation for this option in \fBwimoptimize\fR(1).
167 .TP
168 \fB--ref\fR="\fIGLOB\fR"
169 File glob of WIM(s) on which the delta WIM is based.  Updating split WIMs is not
170 allowed, but updating delta WIMs is allowed.  When updating a delta WIM, the
171 WIM(s) on which the delta WIM is based should be specified using this option.
172 (It isn't a hard requirement, but it's needed for data deduplication to work
173 fully and for the TOTALBYTES statistic to be correctly updated.)
174 .SH NOTES
175 \fBwimupdate\fR can be viewed as redundant with \fBwimmountrw\fR, since a WIM
176 image can also be updated by mounting it read-write.  However, \fBwimupdate\fR
177 works on all platforms including Windows, whereas \fBwimmountrw\fR only works on
178 Linux.
179 .PP
180 Symbolic links inside a WIM image are not dereferenced when being interpreted.
181 So, for example, if you have a WIM image that contains a symbolic link
182 "/Documents and Settings" -> "/Users" where "/Users" is a directory, then a
183 subdirectory named "Public" in this directory must be specified as
184 "/Users/Public" rather than "/Documents and Settings/Public".
185 .PP
186 All paths to files or directories within the WIM image must be specified
187 relative to the root of the image.  However, the leading slash is optional, and
188 both forward slashes and backslashes are accepted.  In addition, on Windows, the
189 paths are by default treated case-insensitively, while on UNIX-like systems, the
190 paths are by default treated case-sensitively.  The default case sensitivity may
191 be changed by setting the \fBWIMLIB_IMAGEX_IGNORE_CASE\fR environmental
192 variable to 0 or 1.
193 .PP
194 The command file (\fICMDFILE\fR) is parsed by \fBwimupdate\fR itself and not by
195 the system shell.  Therefore, its syntax is limited.  However, comment lines
196 beginning with '#' are allowed, and it is also possible to quote arguments with
197 whitespace inside them.
198 .PP
199 On UNIX-like systems, you cannot use \fBwimupdate\fR to add files to an image
200 directly from an NTFS volume using libntfs-3g, even though \fBwimcapture\fR
201 supports capturing a full image this way.
202 .PP
203 Except when using \fB--unsafe-compact\fR, it is safe to abort a \fBwimupdate\fR
204 command partway through; however, after doing this, it is recommended to run
205 \fBwimoptimize\fR to remove any data that was appended to the physical WIM file
206 but not yet incorporated into the structure of the WIM, unless \fB--rebuild\fR
207 was specified, in which case you should delete the temporary file left over.
208 .SH EXAMPLES
209 All the examples below show the update command file to be created as well as the
210 \fBwimupdate\fR command to run to perform the updates.
211 .PP
212 Delete two files from a WIM image:
213 .PP
214 .RS
215 \fIupdate_commands.txt\fR:
216 .RS
217 .PP
218 .nf
219 delete /setup.exe
220 delete /sources/setup.exe
221 .fi
222 .RE
223 .RE
224 .PP
225 .RS
226 $ wimupdate boot.wim 2 < update_commands.txt
227 .RE
228 .PP
229 Add some files and directories to a WIM image.  Note that the first path of each
230 \fBadd\fR command specifies the files to add, while the second path of each
231 \fBadd\fR command specify the locations at which to add them inside the WIM
232 image:
233 .PP
234 .RS
235 \fIupdate_commands.txt\fR:
236 .RS
237 .PP
238 .nf
239 add somedir     /dir
240 add somefile    /dir/file
241 .fi
242 .RE
243 .RE
244 .PP
245 .RS
246 $ wimupdate boot.wim 2 < update_commands.txt
247 .RE
248 .PP
249 Rename a file inside a WIM image.
250 .PP
251 .RS
252 \fIupdate_commands.txt\fR:
253 .RS
254 .PP
255 .nf
256 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
257 .fi
258 .RE
259 .RE
260 .PP
261 .RS
262 $ wimupdate boot.wim 2 < update_commands.txt
263 .RE
264 .PP
265 Using additional features, such as comments, options, and overlays, and
266 including extra integrity information in the updated WIM:
267 .PP
268 .RS
269 \fIupdate_commands.txt\fR:
270 .RS
271 .PP
272 .nf
273 #
274 # This file specifies some changes to make to a WIM image.
275 #
276
277 # Add a new directory containing files I want in the image.
278 # The quotes are necessary because the directory name
279 # contains a space.
280 add "My Directory" "/My Directory"
281
282 # Add the contents of "Another Directory" to the
283 # "/My Directory" we just created in the WIM image.  Since
284 # the destination path already exists, this performs an
285 # overlay.
286 add "Another Directory" "/My Directory"
287
288 # Rename some file for some reason.
289 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
290
291 # Delete an unwanted directory.
292 delete --recursive /Users/Me/Documents/Junk
293 .fi
294 .RE
295 .RE
296 .PP
297 .RS
298 $ wimupdate boot.wim 2 --check < update_commands.txt
299 .RE
300 .PP
301 .SH SEE ALSO
302 .BR wimlib-imagex (1)
303 .BR wimcapture (1)
304 .BR wiminfo (1)
305 .BR wimmountrw (1)
306 .BR wimoptimize (1)