File: sysprep-extra-options.pod

package info (click to toggle)
guestfs-tools 1.52.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 69,236 kB
  • sloc: ansic: 15,698; ml: 15,621; sh: 7,396; xml: 5,478; makefile: 3,601; perl: 1,535; lex: 135; yacc: 128; python: 80
file content (386 lines) | stat: -rw-r--r-- 16,370 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386

=item B<--append-line> FILE:LINE (see C<customize> below)

Append a single line of text to the C<FILE>.  If the file does not already end with a newline, then one is added before the appended line.  Also a newline is added to the end of the C<LINE> string automatically.

For example (assuming ordinary shell quoting) this command:

 --append-line '/etc/hosts:10.0.0.1 foo'

will add either C<10.0.0.1 foo⏎> or C<⏎10.0.0.1 foo⏎> to the file, the latter only if the existing file does not already end with a newline.

C<⏎> represents a newline character, which is guessed by looking at the existing content of the file, so this command does the right thing for files using Unix or Windows line endings.  It also works for empty or non-existent files.

To insert several lines, use the same option several times:

 --append-line '/etc/hosts:10.0.0.1 foo'
 --append-line '/etc/hosts:10.0.0.2 bar'

To insert a blank line before the appended line, do:

 --append-line '/etc/hosts:'
 --append-line '/etc/hosts:10.0.0.1 foo'

=item B<--chmod> PERMISSIONS:FILE (see C<customize> below)

Change the permissions of C<FILE> to C<PERMISSIONS>.

I<Note>: C<PERMISSIONS> by default would be decimal, unless you prefix it with C<0> to get octal, ie. use C<0700> not C<700>.

=item B<--chown> UID:GID:PATH (see C<customize> below)

Change the owner user and group ID of a file or directory in the guest. Note:

=over 4

=item *

Only numeric UIDs and GIDs will work, and these may not be the same inside the guest as on the host.

=item *

This will not work with Windows guests.

=back

例:

 virt-customize --chown '0:0:/var/log/audit.log'

See also: I<--upload>.

=item B<--commands-from-file> FILENAME (see C<customize> below)

Read the customize commands from a file, one (and its arguments)  each line.

Each line contains a single customization command and its arguments, for example:

 delete /some/file
 install some-package
 password some-user:password:its-new-password

Empty lines are ignored, and lines starting with C<#> are comments and are ignored as well.  Furthermore, arguments can be spread across multiple lines, by adding a C<\> (continuation character) at the of a line, for example

 edit /some/file:\
   s/^OPT=.*/OPT=ok/

The commands are handled in the same order as they are in the file, as if they were specified as I<--delete /some/file> on the command line.

=item B<--copy> SOURCE:DEST (see C<customize> below)

Copy files or directories recursively inside the guest.

Wildcards cannot be used.

=item B<--copy-in> LOCALPATH:REMOTEDIR (see C<customize> below)

Copy local files or directories recursively into the disk image, placing them in the directory C<REMOTEDIR> (which must exist).

Wildcards cannot be used.

=item B<--delete> PATH (see C<customize> below)

Delete a file from the guest.  Or delete a directory (and all its contents, recursively).

You can use shell glob characters in the specified path.  Be careful to escape glob characters from the host shell, if that is required.  For example:

 virt-customize --delete '/var/log/*.log'.

See also: I<--upload>, I<--scrub>.

=item B<--edit> FILE:EXPR (see C<customize> below)

Edit C<FILE> using the Perl expression C<EXPR>.

表現がシェルにより変更されるのを防ぐために、適切に引用符でくくるよう注意してください。

このオプションは Perl 5 がインストールされているときのみ利用可能であることに注意してください。

See L<virt-edit(1)/NON-INTERACTIVE EDITING>.

=item B<--firstboot> SCRIPT (see C<customize> below)

Install C<SCRIPT> inside the guest, so that when the guest first boots up, the script runs (as root, late in the boot process).

The script is automatically chmod +x after installation in the guest.

The alternative version I<--firstboot-command> is the same, but it conveniently wraps the command up in a single line script for you.

You can have multiple I<--firstboot> options.  They run in the same order that they appear on the command line.

Please take a look at L<virt-builder(1)/FIRST BOOT SCRIPTS> for more information and caveats about the first boot scripts.

See also I<--run>.

=item B<--firstboot-command> 'CMD+ARGS' (see C<customize> below)

Run command (and arguments) inside the guest when the guest first boots up (as root, late in the boot process).

You can have multiple I<--firstboot> options.  They run in the same order that they appear on the command line.

Please take a look at L<virt-builder(1)/FIRST BOOT SCRIPTS> for more information and caveats about the first boot scripts.

See also I<--run>.

=item B<--firstboot-install> PKG,PKG..  (see C<customize> below)

Install the named packages (a comma-separated list).  These are installed when the guest first boots using the guest’s package manager (eg. apt, yum, etc.) and the guest’s network connection.

For an overview on the different ways to install packages, see L<virt-builder(1)/INSTALLING PACKAGES>.

=item B<--hostname> HOSTNAME (see C<customize> below)

Set the hostname of the guest to C<HOSTNAME>.  You can use a dotted hostname.domainname (FQDN) if you want.

=item B<--inject-qemu-ga> METHOD (see C<customize> below)

Inject the QEMU Guest Agent into a Windows guest.  The guest agent communicates with qemu through a socket in order to provide enhanced features (see L<qemu-ga(8)>).  This operation also injects a firstboot script so that the Guest Agent is installed when the guest boots.

The parameter is the same as used by the I<--inject-virtio-win> operation.

Note that to do a full conversion of a Windows guest from a foreign hypervisor like VMware (which involves many other operations)  you should use the L<virt-v2v(1)> tool instead of this.

=item B<--inject-virtio-win> METHOD (see C<customize> below)

Inject virtio-win drivers into a Windows guest.  These drivers add virtio accelerated drivers suitable when running on top of a hypervisor that supports virtio (such as qemu/KVM).  The operation also adjusts the Windows Registry so that the drivers are installed when the guest boots.

The parameter can be one of:

=over 4

=item ISO

The path to the ISO image containing the virtio-win drivers (eg. F</usr/share/virtio-win/virtio-win.iso>).

=item DIR

The directory containing the unpacked virtio-win drivers (eg. F</usr/share/virtio-win>).

=item B<"osinfo">

The literal string C<"osinfo"> means to use the libosinfo database to locate the drivers.  (See L<osinfo-query(1)>.

=back

Note that to do a full conversion of a Windows guest from a foreign hypervisor like VMware (which involves many other operations)  you should use the L<virt-v2v(1)> tool instead of this.

=item B<--install> PKG,PKG..  (see C<customize> below)

Install the named packages (a comma-separated list).  These are installed during the image build using the guest’s package manager (eg. apt, yum, etc.) and the host’s network connection.

For an overview on the different ways to install packages, see L<virt-builder(1)/INSTALLING PACKAGES>.

See also I<--update>, I<--uninstall>.

=item B<--keep-user-accounts> USERS (see C<user-account> below)

The user accounts to be kept in the guest.  The value of this option is a list of user names separated by comma, where specifying an user means it is going to be kept.  For example:

 --keep-user-accounts mary

would keep the user account C<mary>.

This option can be specified multiple times.

=item B<--link> TARGET:LINK[:LINK..] (see C<customize> below)

Create symbolic link(s) in the guest, starting at C<LINK> and pointing at C<TARGET>.

=item B<--mkdir> DIR (see C<customize> below)

Create a directory in the guest.

This uses S<C<mkdir -p>> so any intermediate directories are created, and it also works if the directory already exists.

=item B<--move> SOURCE:DEST (see C<customize> below)

Move files or directories inside the guest.

Wildcards cannot be used.

=item B<--no-logfile> (see C<customize> below)

Scrub C<builder.log> (log file from build commands) from the image after building is complete.  If you don't want to reveal precisely how the image was built, use this option.

See also: L</LOG FILE>.

=item B<--no-selinux-relabel> (see C<customize> below)

Do not attempt to correct the SELinux labels of files in the guest.

In such guests that support SELinux, customization automatically relabels files so that they have the correct SELinux label.  (The relabeling is performed immediately, but if the operation fails, customization will instead touch F</.autorelabel> on the image to schedule a relabel operation for the next time the image boots.)  This option disables the automatic relabeling.

The option is a no-op for guests that do not support SELinux.

=item B<--password> USER:SELECTOR (see C<customize> below)

Set the password for C<USER>.  (Note this option does I<not> create the user account).

See L<virt-builder(1)/USERS AND PASSWORDS> for the format of the C<SELECTOR> field, and also how to set up user accounts.

=item B<--password-crypto> md5|sha256|sha512 (see C<customize> below)

When the virt tools change or set a password in the guest, this option sets the password encryption of that password to C<md5>, C<sha256> or C<sha512>.

C<sha256> and C<sha512> require glibc E<ge> 2.7 (check crypt(3) inside the guest).

C<md5> will work with relatively old Linux guests (eg. RHEL 3), but is not secure against modern attacks.

The default is C<sha512> unless libguestfs detects an old guest that didn't have support for SHA-512, in which case it will use C<md5>.  You can override libguestfs by specifying this option.

Note this does not change the default password encryption used by the guest when you create new user accounts inside the guest.  If you want to do that, then you should use the I<--edit> option to modify C</etc/sysconfig/authconfig> (Fedora, RHEL) or C</etc/pam.d/common-password> (Debian, Ubuntu).

=item B<--remove-user-accounts> USERS (see C<user-account> below)

The user accounts to be removed from the guest.  The value of this option is a list of user names separated by comma, where specifying an user means it is going to be removed.  For example:

 --remove-user-accounts bob,eve

would only remove the user accounts C<bob> and C<eve>.

This option can be specified multiple times.

=item B<--root-password> SELECTOR (see C<customize> below)

Set the root password.

See L<virt-builder(1)/USERS AND PASSWORDS> for the format of the C<SELECTOR> field, and also how to set up user accounts.

Note: In virt-builder, if you I<don't> set I<--root-password> then the guest is given a I<random> root password.

=item B<--run> SCRIPT (see C<customize> below)

Run the shell script (or any program) called C<SCRIPT> on the disk image. The script runs virtualized inside a small appliance, chrooted into the guest filesystem.

The script is automatically chmod +x.

If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections.  You can also attach data disks (eg. ISO files) as another way to provide data (eg. software packages) to the script without needing a network connection (I<--attach>).  You can also upload data files (I<--upload>).

You can have multiple I<--run> options.  They run in the same order that they appear on the command line.

See also: I<--firstboot>, I<--attach>, I<--upload>.

=item B<--run-command> 'CMD+ARGS' (see C<customize> below)

Run the command and arguments on the disk image.  The command runs virtualized inside a small appliance, chrooted into the guest filesystem.

If libguestfs supports it then a limited network connection is available but it only allows outgoing network connections.  You can also attach data disks (eg. ISO files) as another way to provide data (eg. software packages) to the script without needing a network connection (I<--attach>).  You can also upload data files (I<--upload>).

You can have multiple I<--run-command> options.  They run in the same order that they appear on the command line.

See also: I<--firstboot>, I<--attach>, I<--upload>.

=item B<--script> SCRIPT (see C<script> below)

Run the named C<SCRIPT> (a shell script or program) against the guest.  The script can be any program on the host.  The script’s current directory will be the guest’s root directory.

B<Note:> If the script is not on the $PATH, then you must give the full absolute path to the script.

=item B<--scriptdir> SCRIPTDIR (see C<script> below)

The mount point (an empty directory on the host) used when the C<script> operation is enabled and one or more scripts are specified using I<--script> parameter(s).

B<Note:> C<SCRIPTDIR> B<must> be an absolute path.

If I<--scriptdir> is not specified then a temporary mountpoint will be created.

=item B<--scrub> FILE (see C<customize> below)

Scrub a file from the guest.  This is like I<--delete> except that:

=over 4

=item *

It scrubs the data so a guest could not recover it.

=item *

It cannot delete directories, only regular files.

=back

=item B<--selinux-relabel> (see C<customize> below)

This is a compatibility option that does nothing.

=item B<--sm-attach> SELECTOR (see C<customize> below)

Attach to a pool using C<subscription-manager>.

See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of the C<SELECTOR> field.

=item B<--sm-credentials> SELECTOR (see C<customize> below)

Set the credentials for C<subscription-manager>.

See L<virt-builder(1)/SUBSCRIPTION-MANAGER> for the format of the C<SELECTOR> field.

=item B<--sm-register> (see C<customize> below)

Register the guest using C<subscription-manager>.

This requires credentials being set using I<--sm-credentials>.

=item B<--sm-remove> (see C<customize> below)

Remove all the subscriptions from the guest using C<subscription-manager>.

=item B<--sm-unregister> (see C<customize> below)

Unregister the guest using C<subscription-manager>.

=item B<--ssh-inject> USER[:SELECTOR] (see C<customize> below)

Inject an ssh key so the given C<USER> will be able to log in over ssh without supplying a password.  The C<USER> must exist already in the guest.

See L<virt-builder(1)/SSH KEYS> for the format of the C<SELECTOR> field.

You can have multiple I<--ssh-inject> options, for different users and also for more keys for each user.

=item B<--tar-in> TARFILE:REMOTEDIR (see C<customize> below)

Copy local files or directories from a local tar file called C<TARFILE> into the disk image, placing them in the directory C<REMOTEDIR> (which must exist).  Note that the tar file must be uncompressed (F<.tar.gz> files will not work here)

=item B<--timezone> TIMEZONE (see C<customize> below)

Set the default timezone of the guest to C<TIMEZONE>.  Use a location string like C<Europe/London>

=item B<--touch> FILE (see C<customize> below)

This command performs a L<touch(1)>-like operation on C<FILE>.

=item B<--truncate> FILE (see C<customize> below)

This command truncates C<FILE> to a zero-length file. The file must exist already.

=item B<--truncate-recursive> PATH (see C<customize> below)

This command recursively truncates all files under C<PATH> to zero-length.

=item B<--uninstall> PKG,PKG..  (see C<customize> below)

Uninstall the named packages (a comma-separated list).  These are removed during the image build using the guest’s package manager (eg. apt, yum, etc.).  Dependent packages may also need to be uninstalled to satisfy the request.

See also I<--install>, I<--update>.

=item B<--update> (see C<customize> below)

Do the equivalent of C<yum update>, C<apt-get upgrade>, or whatever command is required to update the packages already installed in the template to their latest versions.

See also I<--install>, I<--uninstall>.

=item B<--upload> FILE:DEST (see C<customize> below)

Upload local file C<FILE> to destination C<DEST> in the disk image.  File owner and permissions from the original are preserved, so you should set them to what you want them to be in the disk image.

C<DEST> could be the final filename.  This can be used to rename the file on upload.

If C<DEST> is a directory name (which must already exist in the guest)  then the file is uploaded into that directory, and it keeps the same name as on the local filesystem.

See also: I<--mkdir>, I<--delete>, I<--scrub>.

=item B<--write> FILE:CONTENT (see C<customize> below)

Write C<CONTENT> to C<FILE>.