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