Commit Graph

7443 Commits

Author SHA1 Message Date
Pino Toscano
a5426cce5f build: check for libintl, and use it
Look for libint/gettext and link to it; this properly detects whether
libint is part of libc.
2014-11-05 13:45:17 +01:00
Richard W.M. Jones
c58d335952 v2v: -i libvirt vcenter: Change 'esx:' to 'vcenter:' in errors/warnings.
'esx' is inaccurate.
2014-11-04 21:21:20 +00:00
Pino Toscano
1fab78c7b2 tests/qemu: isolate MD5 calculation in an own shared function
md5sum(1) does not exist everywhere, so wrap it in an own function so
the right implementation can be chosen on each OS.  Also, wrapping it
avoid using awk everytime.
2014-11-04 18:02:20 +01:00
Pino Toscano
3d02e53c48 ruby: fix detection of ruby library
Query RbConfig::CONFIG for "libdir", and use that when trying to link to
the ruby library.  This fixes the libruby detection when it is installed
in a non-standard library directory.
2014-11-04 18:02:20 +01:00
Pino Toscano
9deafea846 test-charset-fidelity: use and link against gnulib
It uses error() which is specific to GNU libc, but supplied by gnulib if
not available.
2014-11-04 18:02:04 +01:00
Pino Toscano
a293ac1e91 build: isolate the libdb tools search in an own autoconf macro
Create an autoconf macro to deal with the possible combinations of names
and versions of the libdb tools. This also eases the addition of a libdb
version, or a new pattern for the names of tools.

There is no functional change.
2014-11-04 17:59:55 +01:00
Pino Toscano
aba82825a3 builder: fix inclusion of <config.h> in lex-generated source
Use a %top block for including <config.h>, so it is included prior to
any other include, even for system ones. This makes sure its definitions
are properly used in gnulib replacement headers.
2014-11-04 17:59:55 +01:00
Pino Toscano
d1634799e3 src: launch: cast the sockaddr args to sockaddr*
This matches what generally done for passing socket addresses to e.g.
socket and bind, and already done in other parts of libguestfs.
2014-11-04 15:33:23 +01:00
Pino Toscano
8c8e089ad1 build: check for UNIX_PATH_MAX, and properly define it if not
Do a configure check to see whether UNIX_PATH_MAX is defined; if it is
not defined, provide it with the size of sun_path in the struct
sockaddr_un, thus with the proper size for any libc.
2014-11-04 15:33:22 +01:00
Pino Toscano
65a54c6c92 bash: fix build/clean when srcdir==builddir
Use CLEANFILES to remove the generated symlinks, and just ignore the
errors when copying the scripts in srcdir!=builddir situations.

Followup of commit 40ac54829d.
2014-11-04 10:50:59 +01:00
Hilko Bengen
40ac54829d Fix, simplify out-of-tree build/install for bash completions 2014-11-04 09:40:13 +00:00
Pino Toscano
25cad1e62f customize: firstboot: fix Linux log output
Pass -a to each tee invocation, otherwise just the last one (so only for
the last script executed) will appear in the log file.
2014-11-04 09:16:17 +01:00
Pino Toscano
f8ed15462f customize: firstboot: make sure to run Linux scripts only once
If a script does not finish, hangs, etc, it would be executed again at
the next boot, since the injected firstboot.sh helper removes it only
after it finished.

Before executing a script, move it to another internal subdirectory
(scripts-done) and execute it from there, so it is not run again by
firstboot.sh.  The downside is that now scripts are executed only once
at all, so if a script fails it will not be attempted at the next boot.

Also, remove all the files found in scripts-done, as they have been run
(or at least attempted) in a previous boot.

This fixes RHBZ#1159651.
2014-11-03 21:15:59 +01:00
Pino Toscano
3d6c2af450 customize: Add --ssh-inject option for injecting SSH keys.
This adds a customize option:

  virt-customize --ssh-inject USER
  virt-customize --ssh-inject USER:string:KEY_STRING
  virt-customize --ssh-inject USER:file:FILENAME

(ditto for virt-builder and virt-sysprep)

In each case this injects into the guest user USER
a) the current (host) user's ssh pubkey
b) the key specified as KEY_STRING
c) the key in FILENAME
adding it to ~USER/.ssh/authorized_keys in the guest.

For example:

  virt-builder fedora-20 --ssh-inject root

will add the local user's ssh pubkey into the root account of the
newly created guest.  Or:

  virt-customize -a disk.img \
     --ssh-inject 'mary:string:ssh-rsa AAAA.... mary@localhost'

adds the given ssh pubkey to mary's account in the guest.

This doesn't set the SELinux labels correctly on newly created files
and directories, so you have to use --selinux-relabel (probably we
should fix this as part of the general effort to fix SELinux
relabelling).  However it should preserve the labels if the
~/.ssh/authorized_keys file already exists.

Most of this work is based on a patch sent to the mailing list by
Richard W.M. Jones <rjones@redhat.com>:
https://www.redhat.com/archives/libguestfs/2014-November/msg00000.html
2014-11-03 20:47:38 +01:00
Richard W.M. Jones
39f524d79b v2v: Ensure --bridge and --network args are documented correctly in --help output. 2014-11-03 19:38:37 +00:00
Richard W.M. Jones
0121f4fd56 generator: customize: Insert whitespace between entries.
Just a whitespace change.
2014-11-01 21:08:53 +00:00
Richard W.M. Jones
0701b24e5c daemon: No longer needs its own copy of gnulib.
Since the daemon has long since used the same build system as the rest
of libguestfs, it no longer needs its own gnulib.

This arcane bit of code was left over from
commit e05ddc70f1 (added 2009-08-03 !)
2014-10-31 18:30:36 +00:00
Richard W.M. Jones
a6b3943783 Version 1.29.4. 1.29.4 2014-10-31 17:47:18 +00:00
Richard W.M. Jones
6d6644d52d launch: libvirt: Implement drive secrets (RHBZ#1159016).
Implement the GUESTFS_ADD_DRIVE_OPTS_SECRET argument of
guestfs_add_drive_opts.  For libvirt we have to save the secret in
libvirtd first, get a UUID, and then pass the UUID back through the
domain XML.
2014-10-31 17:24:54 +00:00
Richard W.M. Jones
68dc488a44 v2v: -o libvirt: Get the <features/> right in the output XML (RHBZ#1159258).
Implement what old virt-v2v did (from
lib/Sys/VirtConvert/Connection/LibVirtTarget.pm)

Thanks: Tingting Zheng, Matthew Booth
2014-10-31 17:24:53 +00:00
Pino Toscano
7ba102dc4c fish: complete symlink properly
When an entry is a symlink, check whether it points to a directory, so
the entry for it can be completed correctly.
2014-10-31 17:49:54 +01:00
Pino Toscano
a8b95a5535 fish: fix dir completion on filesystems w/o dirent.d_type (RHBZ#1153844).
On filesystems whose dirent.d_type is DT_UNKNOWN or some unknown value,
manually check whether an entry is a directory, thus completing in the
proper way.
2014-10-31 17:49:54 +01:00
Pino Toscano
d082cd6ae5 builder: pass Sources.source objects directly
Instead of passing the (uri, key, proxy) tuple around, pass the whole
Sources.source record; this requires creating proper Sources.source also
for uri+fingerprint passed via command line.

No functional changes.
2014-10-31 17:49:46 +01:00
Pino Toscano
56bd781b76 builder: use gpgkey_type for the gpgkey field in sources 2014-10-31 17:46:14 +01:00
Pino Toscano
3987bbcd91 builder: move the gpgkey_type type from Sigchecker to Utils
No functional change, just code motion.
2014-10-31 17:46:14 +01:00
Richard W.M. Jones
1470be7f3b v2v: Add bounds check to Xml.xpathobj_node function.
I accidentally called it with an out-of-bounds index, and it caused a
core dump.  Add a bounds check to stop this from happening in
production.
2014-10-31 15:58:43 +00:00
Richard W.M. Jones
c085a0ba73 builder: Updated CentOS image to 6.6. 2014-10-31 13:57:26 +00:00
Richard W.M. Jones
847465a794 src/info.c: Remove incorrect comment. 2014-10-31 10:50:20 +00:00
Richard W.M. Jones
3e4024a1ea Version 1.29.3. 1.29.3 2014-10-30 22:21:47 +00:00
Richard W.M. Jones
65abc44203 v2v: Add --password-file parameter (RHBZ#1158526).
This allows you to send passwords to virt-v2v input modes without
being interactive.
2014-10-30 13:47:54 +00:00
Richard W.M. Jones
b35b84684c v2v: vmware: Use 'curl --config' to pass arguments securely to curl.
Instead of making up an ordinary curl command line, write a temporary
config file and use 'curl --config tmpfile' to pass the arguments.

The advantage is that it's more secure if we want to supply passwords
to curl, since a '--user username:password' parameter on the command
line could be read (eg. by 'ps ax'), but the temporary file has mode
0600 and cannot be read by other users.

This is mostly code motion, but it also passes the '-q' option to curl
to stop it from reading default configuration files.
2014-10-30 13:47:37 +00:00
Richard W.M. Jones
d82c5fb5a0 v2v: Remove useless parentheses around expression. 2014-10-30 13:47:36 +00:00
Richard W.M. Jones
8efbe49df6 p2v: kickstart: Add rpm to list of packages.
Avoids RHBZ#1089566.
2014-10-29 18:02:29 +00:00
Richard W.M. Jones
26952db56f p2v: kickstart: Remove 'install' line.
'install' is the default operation, it doesn't have to be specified.
2014-10-29 18:02:28 +00:00
Richard W.M. Jones
c48114cd24 p2v: kickstart: Add firewalld to the ISO to allow firewall to be enabled. 2014-10-29 18:02:28 +00:00
Richard W.M. Jones
439bf5e42a p2v: kickstart: Name the ISO 'virt-p2v'. 2014-10-29 18:02:28 +00:00
Richard W.M. Jones
a03bffa15a v2v: Add a support matrix to the manual page.
This explains what does and doesn't work.
2014-10-29 18:02:28 +00:00
Richard W.M. Jones
6d338ae4e6 builder: Document that --edit option can be split across lines. 2014-10-28 22:49:58 +00:00
Richard W.M. Jones
cb291d7e46 p2v: Ensure we are using virt-v2v >= 1.28.
Must NOT use:

- One of the interim versions of virt-v2v (1.27.x) that we published
  during development.

- Old virt-v2v (0.9.x).

Also use the --version option (instead of -V) since old virt-v2v
required it:

  $ virt-v2v -V
  Option v is ambiguous (version, vmtype)
  Usage:
  [...]
  $ virt-v2v --version
  0.9.1
2014-10-28 11:21:34 +00:00
Hu Tao
d0eba7f260 sysprep: remove /var/spool/mail/username
remove /var/spool/mail/username if --enable user-account.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
2014-10-28 11:21:33 +00:00
Richard W.M. Jones
7f7c153347 Document three (fixed) security problems in the main manual page.
Previously these were only covered in the release notes, but not in
the "SECURITY" section of guestfs(3).
2014-10-27 17:51:40 +00:00
Richard W.M. Jones
777e2175ab Add warnings about using guestfs_strings* APIs because of CVE-2014-8484 and CVE-2014-8485. 2014-10-27 17:44:54 +00:00
Richard W.M. Jones
b09b60c987 p2v: Add usb-storage module and rebuild initrd (RHBZ#1157679).
Include the usb-storage kernel module, to permit booting from USB
keys.

Rerun dracut to rebuild the initramfs.  This is complicated because by
default dracut will try to build an initramfs for the running
(ie. appliance) kernel, which is completely useless.  We need to find
the latest installed kernel and rebuild the initramfs for that
instead, which is hairy.

This also does a small refactoring of the distro-specific code,
removing the $selinux_relabel variable and replacing it with a generic
$extra_args variable.

I only added this to the virt-builder script, since one assumes that
livecd-creator/whatever should make the kickstart ISO bootable by
installing whatever drivers and modules are necessary.
2014-10-27 16:56:13 +00:00
Richard W.M. Jones
4c31cae279 Revert "p2v: Add usb-storage dracut module to allow boot from USB key (RHBZ#1157679)."
Running 'dracut -f' installs a dracut for the running kernel (of the
appliance) not the installed kernel.  Stupid stupid stupid.

This reverts commit 7a6d44ebfe.
2014-10-27 16:10:28 +00:00
Richard W.M. Jones
7a6d44ebfe p2v: Add usb-storage dracut module to allow boot from USB key (RHBZ#1157679).
I only added this to the virt-builder script, since one assumes that
livecd-creator/whatever should make the kickstart ISO bootable by
installing whatever drivers and modules are necessary.
2014-10-27 16:02:38 +00:00
Richard W.M. Jones
91788cd76f p2v: Add "Hardware Support" group to the P2V images (RHBZ#1157679).
Thanks: Chris Adams
2014-10-27 13:52:06 +00:00
Richard W.M. Jones
fab95a52bd p2v: Explain in the man page why the virt-p2v ISO is used. 2014-10-26 19:35:36 +00:00
Richard W.M. Jones
5862a4391d Version 1.29.2. 1.29.2 2014-10-25 17:56:45 +01:00
Richard W.M. Jones
09584a8bc6 sparsify: Add Utils module and use common error/warning/info functions.
This program needs quite a lot more work, in particular to make the
regular messages use 'make_message_function' instead of 'printf'.
2014-10-25 15:35:49 +01:00
Richard W.M. Jones
b01582623d resize: Tidy up messages.
Add common error/warning/info functions.

Examine every existing call to printf/eprintf and change where
necessary so that:

 - error is used instead of eprintf + exit 1

 - warning no longer needs ~prog argument (it is added by Utils module)

 - any verbose output should go to stdout, not stderr

 - info is used to print general informational messages

Also, don't indent summary of changes.
2014-10-25 15:28:58 +01:00