]> wimlib.net Git - wimlib/blob - doc/man1/wimlib-imagex-update.1
73f520273600f37b3223da3fefd85979c0ccbe88
[wimlib] / doc / man1 / wimlib-imagex-update.1
1 .TH WIMLIB-IMAGEX "1" "August 2015" "wimlib 1.8.2" "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 It is safe to abort an \fBwimlib-imagex update\fR command partway through;
202 however, after doing this, it is recommended to run \fBwimlib-imagex
203 optimize\fR to remove any data that was appended to the physical WIM file but
204 not yet incorporated into the structure of the WIM, unless \fB--rebuild\fR was
205 specified, in which case you should delete the temporary file left over.
206 .SH EXAMPLES
207 All the examples below show the update command file to be created as well as the
208 \fBwimlib-imagex update\fR command to run to perform the updates.
209 .PP
210 Delete two files from a WIM image:
211 .PP
212 .RS
213 \fIupdate_commands.txt\fR:
214 .RS
215 .PP
216 .nf
217 delete /setup.exe
218 delete /sources/setup.exe
219 .fi
220 .RE
221 .RE
222 .PP
223 .RS
224 $ wimlib-imagex update boot.wim 2 < update_commands.txt
225 .RE
226 .PP
227 Add some files and directories to a WIM image.  Note that the first path of each
228 \fBadd\fR command specifies the files to add, while the second path of each
229 \fBadd\fR command specify the locations at which to to add them inside the WIM
230 image:
231 .PP
232 .RS
233 \fIupdate_commands.txt\fR:
234 .RS
235 .PP
236 .nf
237 add somedir     /dir
238 add somefile    /dir/file
239 .fi
240 .RE
241 .RE
242 .PP
243 .RS
244 $ wimlib-imagex update boot.wim 2 < update_commands.txt
245 .RE
246 .PP
247 Rename a file inside a WIM image.
248 .PP
249 .RS
250 \fIupdate_commands.txt\fR:
251 .RS
252 .PP
253 .nf
254 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
255 .fi
256 .RE
257 .RE
258 .PP
259 .RS
260 $ wimlib-imagex update boot.wim 2 < update_commands.txt
261 .RE
262 .PP
263 Using additional features, such as comments, options, and overlays, and
264 including an integrity table in the updated WIM:
265 .PP
266 .RS
267 \fIupdate_commands.txt\fR:
268 .RS
269 .PP
270 .nf
271 #
272 # This file specifies some changes to make to a WIM image.
273 #
274
275 # Add a new directory containing files I want in the image.
276 # The quotes are necessary because the directory name
277 # contains a space.
278 add "My Directory" "/My Directory"
279
280 # Add the contents of "Another Directory" to the
281 # "/My Directory" we just created in the WIM image.  Since
282 # the destination path already exists, this performs an
283 # overlay.
284 add "Another Directory" "/My Directory"
285
286 # Rename some file for some reason.
287 rename /dir_in_wim/oldfile.txt /dir_in_wim/newfile.txt
288
289 # Delete an unwanted directory.
290 delete --recursive /Users/Me/Documents/Junk
291 .fi
292 .RE
293 .RE
294 .PP
295 .RS
296 $ wimlib-imagex update boot.wim 2 --check < update_commands.txt
297 .RE
298 .PP
299 .SH SEE ALSO
300 .BR wimlib-imagex (1)
301 .BR wimlib-imagex-capture (1)
302 .BR wimlib-imagex-info (1)
303 .BR wimlib-imagex-mountrw (1)
304 .BR wimlib-imagex-optimize (1)