]> wimlib.net Git - wimlib/blob - doc/man1/wimlib-imagex-update.1
cc6dab9e6e1823820da16fa4e2096b0cb78fa1c3
[wimlib] / doc / man1 / wimlib-imagex-update.1
1 .TH WIMLIB-IMAGEX "1" "January 2016" "wimlib 1.9.0" "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 See the documentation for this option in \fBwimlib-imagex-optimize\fR (1).
169 .SH NOTES
170 \fBwimlib-imagex update\fR is partly redundant with \fBwimlib-imagex
171 mountrw\fR, since if a WIM image can be mounted read-write, then there
172 theoretically is no need for \fBwimlib-imagex update\fR.  The main advantage
173 of \fBwimlib-imagex update\fR is that it works on both UNIX-like systems and
174 Windows, whereas \fBwimlib-imagex mountrw\fR is only available on UNIX-like
175 systems, and even then it only works on those with a compatible FUSE
176 implementation.
177 .PP
178 Symbolic links inside a WIM image are not dereferenced when being interpreted.
179 So, for example, if you have a WIM image that contains a symbolic link
180 "/Documents and Settings" -> "/Users" where "/Users" is a directory, then a
181 subdirectory named "Public" in this directory must be specified as
182 "/Users/Public" rather than "/Documents and Settings/Public".
183 .PP
184 All paths to files or directories within the WIM image must be specified
185 relative to the root of the image.  However, the leading slash is optional, and
186 both forward slashes and backslashes are accepted.  In addition, on Windows, the
187 paths are by default treated case-insensitively, while on UNIX-like systems, the
188 paths are by default treated case-sensitively.  The default case sensitivity may
189 be changed by setting the \fBWIMLIB_IMAGEX_IGNORE_CASE\fR environmental
190 variable to 0 or 1.
191 .PP
192 The command file (\fICMDFILE\fR) is parsed by \fBwimlib-imagex update\fR
193 itself and not by the system shell.  Therefore, its syntax is limited.  However,
194 comment lines beginning with '#' are allowed, and it is also possible to quote
195 arguments with whitespace inside them.
196 .PP
197 On UNIX-like systems, you cannot use \fBwimlib-imagex update\fR to add files
198 to an image directly from an NTFS volume using libntfs-3g, even though
199 \fBwimlib-imagex capture\fR supports capturing a full image this way.
200 .PP
201 Except when using \fB--unsafe-compact\fR, it is safe to abort a \fBwimlib-imagex
202 update\fR command partway through; however, after doing this, it is recommended
203 to run \fBwimlib-imagex optimize\fR to remove any data that was appended to the
204 physical WIM file but not yet incorporated into the structure of the WIM, unless
205 \fB--rebuild\fR was specified, in which case you should delete the temporary
206 file left over.
207 .SH EXAMPLES
208 All the examples below show the update command file to be created as well as the
209 \fBwimlib-imagex update\fR command to run to perform the updates.
210 .PP
211 Delete two files from a WIM image:
212 .PP
213 .RS
214 \fIupdate_commands.txt\fR:
215 .RS
216 .PP
217 .nf
218 delete /setup.exe
219 delete /sources/setup.exe
220 .fi
221 .RE
222 .RE
223 .PP
224 .RS
225 $ wimlib-imagex update boot.wim 2 < update_commands.txt
226 .RE
227 .PP
228 Add some files and directories to a WIM image.  Note that the first path of each
229 \fBadd\fR command specifies the files to add, while the second path of each
230 \fBadd\fR command specify the locations at which to to add them inside the WIM
231 image:
232 .PP
233 .RS
234 \fIupdate_commands.txt\fR:
235 .RS
236 .PP
237 .nf
238 add somedir     /dir
239 add somefile    /dir/file
240 .fi
241 .RE
242 .RE
243 .PP
244 .RS
245 $ wimlib-imagex update boot.wim 2 < update_commands.txt
246 .RE
247 .PP
248 Rename a file inside a WIM image.
249 .PP
250 .RS
251 \fIupdate_commands.txt\fR:
252 .RS
253 .PP
254 .nf
255 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
256 .fi
257 .RE
258 .RE
259 .PP
260 .RS
261 $ wimlib-imagex update boot.wim 2 < update_commands.txt
262 .RE
263 .PP
264 Using additional features, such as comments, options, and overlays, and
265 including an integrity table in the updated WIM:
266 .PP
267 .RS
268 \fIupdate_commands.txt\fR:
269 .RS
270 .PP
271 .nf
272 #
273 # This file specifies some changes to make to a WIM image.
274 #
275
276 # Add a new directory containing files I want in the image.
277 # The quotes are necessary because the directory name
278 # contains a space.
279 add "My Directory" "/My Directory"
280
281 # Add the contents of "Another Directory" to the
282 # "/My Directory" we just created in the WIM image.  Since
283 # the destination path already exists, this performs an
284 # overlay.
285 add "Another Directory" "/My Directory"
286
287 # Rename some file for some reason.
288 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
289
290 # Delete an unwanted directory.
291 delete --recursive /Users/Me/Documents/Junk
292 .fi
293 .RE
294 .RE
295 .PP
296 .RS
297 $ wimlib-imagex update boot.wim 2 --check < update_commands.txt
298 .RE
299 .PP
300 .SH SEE ALSO
301 .BR wimlib-imagex (1)
302 .BR wimlib-imagex-capture (1)
303 .BR wimlib-imagex-info (1)
304 .BR wimlib-imagex-mountrw (1)
305 .BR wimlib-imagex-optimize (1)