Commit Graph

159 Commits

Author SHA1 Message Date
Hilko Bengen
b30e2cf122 Fix out-of-tree build: Do not accidentally build mllib components in srcdir 2014-03-04 00:06:09 +01:00
Hilko Bengen
f75142c577 Fix building on architectures where ocamlopt is not available 2014-02-28 14:01:25 +00:00
Pino Toscano
0f3898b2f5 sysprep: use Mkdtemp to create the temporary directory
Use the safer mkdtemp instead of manually creating a path.
2014-02-24 15:40:29 +01:00
Richard W.M. Jones
bf8d75590c test: Use = instead of == for testing string equality in bash script.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Pino Toscano
4ca4eef0cc sysprep: remove RH subscription manager files
Add a new operation for it, which should do what
`subscription-manager clean` does.

Part of RHBZ#1063374.
2014-02-13 10:57:31 +01:00
Pino Toscano
f78877c77e sysprep: remove RH subscription manager log files
Part of RHBZ#1063374.
2014-02-13 10:50:15 +01:00
Richard W.M. Jones
49014f81f3 sysprep: Deprecate --selinux-relabel in favour of --autorelabel.
virt-builder added a --selinux-relabel option with a slightly
different meaning.

This commit keeps the old --selinux-relabel / --no-selinux-relabel
options in virt-sysprep, but deprecates them and replaces them with
--autorelabel and --no-autorelabel.
2014-01-30 09:03:46 +00:00
Richard W.M. Jones
fc6d3e6a9a sysprep: Add a reference to virt-builder from the manual page.
The whole "COPYING AND CLONING" section really needs to be overhauled
too, but first we need to make virt-builder work properly for
customizing templates.
2014-01-30 09:03:46 +00:00
Richard W.M. Jones
5db1a28461 sysprep: Add --scrub option.
This works like the option in virt-builder with the same name.
2014-01-30 09:03:46 +00:00
Richard W.M. Jones
59fce974e2 pod: Remove stray +x (executable) mode on various POD files.
find -name '*.pod' -perm /0111 -exec chmod -x {} \;
2014-01-28 22:17:12 +00:00
Richard W.M. Jones
233d5410e5 sysprep: Add script4.sh (test script) to EXTRA_DIST.
This fixes commit ce9d4d335b.
2014-01-28 21:56:18 +00:00
Richard W.M. Jones
f02fddc26b tests: Update miscellaneous tests to use disk-create API.
Instead of calling out to qemu-img / truncate.
2014-01-28 21:02:11 +00:00
Pino Toscano
ce9d4d335b builder, sysprep: initialise the random generator
virt-builder and virt-sysprep may make use of
Common_utils.string_random8 (which uses Random.int) for constructing
temporary paths; not initialising the random generator means that every
invocation will reuse the same name used previously (!).
Thus just call Random.self_init, just like virt-sparsify already does.

Expand the test-virt-sysprep-script.sh test to ensure that virt-sysprep
is not affected again by this issue.
2014-01-28 15:04:38 +01:00
Richard W.M. Jones
3e3e7cf029 sysprep: Replace flags list with side_effects object.
Previously callbacks would return a list of flags, such as []
or [`Created_files].

In this commit we introduce two new objects, filesystem_side_effects
and device_side_effects (the latter is not used yet).

The callbacks that create files now need to call

  side_effects#created_file ()

instead of returning flags.

There is no functional change in this patch.
2014-01-21 17:33:35 +00:00
Richard W.M. Jones
11b4fc88fb sysprep: Update comments. 2014-01-21 17:33:35 +00:00
Pino Toscano
418c064bc1 sysprep: add --operations
Add a new --operation parameter which, similarly to --enable, can be
used to enable operations, but also to remove them, and to add/remove
the default operations and all the available ones.
2014-01-13 14:57:00 +01:00
Richard W.M. Jones
dd1bfea513 sysprep, builder: Add --timezone option to set timezone of guest.
You can use it like this:

  virt-sysprep --timezone Europe/London ...
  virt-builder --timezone Europe/London ...
2014-01-10 21:20:36 +00:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Pino Toscano
30936f499e sysprep: remove some Pegasus files, like certs (RHBZ#1041552). 2013-12-13 11:04:30 +01:00
Pino Toscano
1472fbd903 sysprep: mention globbing in help for --delete
Followup of ed4bcb119c.
2013-12-09 19:37:51 +01:00
Pino Toscano
ed4bcb119c sysprep: allow to specify globbing for --delete
Adapt the globbing part from the old --remote-path work previously
proposed for sysprep [1], allowing --delete to perform globbing when
deleting paths.

[1] https://www.redhat.com/archives/libguestfs/2013-October/msg00045.html
2013-12-09 15:26:43 +00:00
Pino Toscano
c89ffbc152 sysprep: remove more anaconda and tuned logs (RHBZ#1039540). 2013-12-09 15:26:43 +00:00
Richard W.M. Jones
53e45c8280 sysprep: Fix broken test when backend is UML.
This fixes commit cc1888a497.
2013-11-23 09:37:17 +00:00
Richard W.M. Jones
cc1888a497 sysprep: Add a test suite for the --password option. 2013-11-22 15:10:44 +00:00
Richard W.M. Jones
3712249f96 builder/sysprep: Allow accounts to be locked (RHBZ#1028660).
This allows you to select both locked accounts and disabled
passwords.  The two are subtly different concepts.

A locked account [cf. passwd -l] puts "!!" at the beginning of the
shadow password field.  Locking is reversible, because the "!!"  can
be removed, restoring the original password.  Therefore "locked"
acts as a flag in front of an existing selector.

A disabled account has "*" in the password field.  Therefore it has no
password.

Note that an account may be both locked and disabled, although this is
probably not useful.  The shadow password field will contain "!!*".
2013-11-22 15:10:44 +00:00
Richard W.M. Jones
02b5f00b2b builder/sysprep: Allow 'random' as a password selector.
This chooses a random password.
2013-11-22 14:16:09 +00:00
Richard W.M. Jones
91450b5f9a mllib: password: Replace password string with password_selector type.
This is just code motion, there is no functional change.
2013-11-21 17:34:59 +00:00
Richard W.M. Jones
9186438937 builder/sysprep: Describe --password/--root-password option as "selector".
It now appears in the respective man pages as:

  --root-password selector

or:

  --password selector

This avoids confusion from people who think these command line options
take the password directly.
2013-11-21 17:13:37 +00:00
Richard W.M. Jones
f013b15fa1 mllib: Add a utility function for safely reading from /dev/urandom.
OCaml's buffered 'in_channel' has a 64k buffer, so using it to read a
few bytes from /dev/urandom removes a lot of the system's entropy (for
example /proc/sys/kernel/random/entropy_avail goes from ~3000 to 128).

This patch was originally by Edwin Török for builder.ml.  I
generalized it because there are two other places where we did
over-sized reads from /dev/urandom.
2013-11-14 10:52:16 +00:00
Wanlong Gao
e4c9212a8e sysprep: add feature of deleting specified paths
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
2013-10-29 19:24:08 +00:00
Richard W.M. Jones
5b89dd4aa1 mllib: Create config.ml from configure and use it for --version options.
Also don't internationalize the output of the --version option, as
that isn't useful.
2013-10-22 13:48:41 +01:00
Richard W.M. Jones
b816f29ada firstboot: Ensure firstboot scripts run in command line order.
Previously they ran in effectively random order.
2013-10-15 20:41:22 +01:00
Richard W.M. Jones
a3e5bc7bfa sysprep: firstboot: Don't set `Created_files flag unless files are created. 2013-10-15 20:41:22 +01:00
Richard W.M. Jones
22fc66f6b2 sysprep: Fix documentation for --mount-options. 2013-10-07 14:27:32 +01:00
Richard W.M. Jones
dfa52c63b1 sysprep: Don't remove /var/cache/apt/archives/partial directory.
Removing this directory breaks Ubuntu guests.

This change adds a utility function which removes only files from a
directory.  This is a safer way to clean cache directories etc.
2013-10-07 14:19:38 +01:00
Richard W.M. Jones
08b7c90228 sysprep: Refactor hostname code into a common library. 2013-10-03 22:02:47 +01:00
Richard W.M. Jones
6203c50479 sysprep: Refactor setting random seed code into a common library.
This is just code motion.
2013-10-03 21:42:05 +01:00
Richard W.M. Jones
147b4ee87e sysprep: Refactor firstboot code into a common library. 2013-10-03 21:42:05 +01:00
Richard W.M. Jones
e8a092ae87 sysprep: Refactor password handling code into a common library.
Also the crypt binding is moved to mllib because this is a dependency
of the password library.

This is just code motion.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
98d56bb102 mllib: error function has ~prog parameter, instead of assuming virt-resize.
$ virt-sparsify a a
  virt-resize: error: you cannot use the same disk image for input and
  output
  If reporting bugs, run virt-resize with the '-d' option and include the
  complete output.

Note (a) it assumes the program is called "virt-resize" which it
isn't, and (b) it assumes the program has a debug option -d which it
doesn't.

This commit changes the error message and adds a -v option to
virt-resize.
2013-10-03 21:42:04 +01:00
Richard W.M. Jones
09a4f42861 uri: Fix two compiler warnings.
We have to include the right header so that guestfs___free_string_list
is declared.  Unfortunately that means ensuring -I src is passed to
the compiler in every tool subdirectory.

Also fix (bogus) compiler warning about incorrect type of the
parameter to caml_copy_string_array.
2013-09-24 13:41:35 +01:00
Richard W.M. Jones
2a6ce79320 tools: Move shared OCaml code to mllib/ directory.
Previously a lot of shared code lived in the resize/ directory for no
particular reason.

This is just code motion.
2013-09-24 13:41:35 +01:00
Richard W.M. Jones
4cdb5bcc5e sysprep: Fix option quoting in manual page.
This fixes commit b65c1c667b.
2013-09-23 13:49:21 +01:00
Wanlong Gao
ea7088b5ca sysprep: remove tmp files
This removes tmp files under /tmp and /var/tmp.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-06 09:08:14 +01:00
Wanlong Gao
bbd936d32b sysprep: remove firewall rules
If we do not want to keep the original firewall rules, enable
this operation to remove these rules automatically.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

RWMJ:

 - Updated po-file.

 - Change documentation to note that it's disabled by default
   and in theory could make the guest exploitable.
2013-09-05 13:10:00 +01:00
Wanlong Gao
efcf474d42 sysprep: remove log file of ntp
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Wanlong Gao
c76dabf9ec sysprep: remove log file of gdm
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Wanlong Gao
1baf716a7e sysprep: remove log file of sysstat
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Wanlong Gao
e02c4e519e sysprep: remove /var/log/audit/audit.log
audit.log is already included in /var/log/audit/*.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
2013-09-05 10:09:58 +01:00
Nikita Menkovich
f33343a5c1 sysprep: added --mount-options option to mount selected partitions with options. 2013-08-19 08:31:55 +01:00