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