Commit Graph

214 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
d7e3aea7bc Fixes for various tests in out-of-tree builds 2014-03-04 00:06:09 +01:00
Pino Toscano
631c7d9241 builder: install a $sysconfdir/virt-builder -> xdg-virt-builder symlink
This way "virt-builder" appears directly in the sysconfdir.
2014-03-03 16:28:14 +01:00
Pino Toscano
962837650c builder: add libguestfs.gpg to EXTRA_DIST
It needs to be in EXTRA_DIST, otherwise it is not put in the dist.
2014-02-28 15:07:32 +01:00
Hilko Bengen
f75142c577 Fix building on architectures where ocamlopt is not available 2014-02-28 14:01:25 +00:00
Pino Toscano
963b0341e2 builder: update documentation
Update the documentation according to the new .conf files structure, the
drop of VIRT_BUILDER_SOURCE and VIRT_BUILDER_FINGERPRINT, the drop of
hardcoded source and its key, etc.
2014-02-27 09:59:56 +00:00
Pino Toscano
47538865f2 builder: remove the default fingerprint/pubkey
Sigchecker can still import keys from the user's keyring, so there is no
need to hardcode fingerprint and key of the index hosted on
libguestfs.org (which is now pointed to using a .conf file).
2014-02-27 09:59:56 +00:00
Pino Toscano
573cae45c3 builder: remove VIRT_BUILDER_SOURCE and VIRT_BUILDER_FINGERPRINT
Drop these two environment variables, and the implicit hardcoded source
hosted at libguestfs.org.
This means all the sources must be provided as .conf files, or at each
invocation with --source.
2014-02-27 09:59:56 +00:00
Pino Toscano
f4990bef1c builder: switch sources to .conf files
Introduce and use simple .conf files to configure the sources of indexes
for virt-builder. The location of these files is in XDG_CONFIG_DIRS /
XDG_CONFIG_HOME, so it can be easily overridden.

There are three .conf(.in) files shipped with this commit:
- "test-index.conf.in" (in "test-config"), which points to the
  "test-index" index (used in tests only); the tests are adapted to
  point to the hierarchy containing this .conf
- "libguestfs.conf.in" (in "test-website"), which points to the local
  "index.asc" (i.e. the offline copy of the libguestfs.org index);
  run(.in) will point to the hierarchy providing this .conf
- "libguestfs.conf.in" (directly among the other sources), which points
  to the online "index.asc" and it is installed in sysconfdir, along
  with the key of this repository

The tests are adapted, other than to the different way to pick sources,
to the different output of --list, as "test-index" is not signed.
2014-02-27 09:59:56 +00:00
Pino Toscano
a3f1ac9a2d builder: extract the default key to file
This is basically default_pubkey from sigchecker.ml, just extracted as
file. Not used right now, but will be in the future.
2014-02-27 09:59:56 +00:00
Pino Toscano
a21da3c801 builder: add functions to read XDG_CONFIG_DIRS and XDG_CONFIG_PATH 2014-02-27 09:59:56 +00:00
Pino Toscano
ad38e68c34 builder: use Sigchecker.gpgkey_type for the fingerprint
Use Sigchecker.gpgkey_type instead of just string as type in the
sources list; adapt the listing code (and its expected output) to that.

No behaviour change which eases a bit the addition of new sources with
other key types.
2014-02-27 09:59:56 +00:00
Pino Toscano
c09f5bbc70 builder: allow "no key" as key in Sigchecker
Additional way to distinguish no actual key available for signature
checking; make sure to not allow signing in such situation.
2014-02-27 09:59:56 +00:00
Richard W.M. Jones
d353b4a3c8 builder: Add arch= entry for Cirros.
Thanks: Pino Toscano.
2014-02-24 20:13:41 +00:00
Richard W.M. Jones
9124730df2 builder: Add arch=x86_64 entries. 2014-02-24 15:43:13 +00:00
Pino Toscano
8ed905c7e6 builder: split INI C <-> OCaml glue code in own module
Move in an own module the code which calls the C
virt_builder_parse_index and does the array -> list conversion of the
result. This way this code can be easily called also in places different
than Index_parser without the need to copy the types mapping, etc.

Just code motion, no actual behaviour changes.
2014-02-24 15:08:03 +01:00
Pino Toscano
61323fabaf builder: add a mandatory 'arch' key in index files
Introduce a mandatory arch= key in all the entries of index files, to
identify which architecture is each. Adapt the long and JSON list
outputs to print also this new field.

This introduces an incompatibility with index files created with
virt-builder < 1.26, as they will be rejected until entries will have
the arch= key added (which is ignored by older virt-builder, so adding
it will not create backward-compatibility issues).
2014-02-24 11:31:35 +01:00
Pino Toscano
35e53c0381 builder: allow Sigchecker to import keys from file
Extend Sigchecker so it allows both fingerprints (to be imported from
user's keyring, as before) and keys stored in files. To simplify this
process (and have the fingerprint always around), the key is imported
on Sigchecker.create time, instead of lazily at the first verification.
2014-02-21 15:21:08 +01:00
Pino Toscano
dd03d38be3 builder: use a disposable GPG keyring for every Sigchecker
Create a temporary directory and tell gpg to use it as homedir, so
imported keys do not get into the user's keyring. This also avoid
importing the default key  when a different one is needed to check the
signature.

The only exception is when a non-default fingerprint is used: in this
case, that key is read from the user's keyring, since it is where it is.
2014-02-21 14:39:57 +01:00
Richard W.M. Jones
7794d9a187 builder: Add ScientificLinux 6.5. 2014-02-21 08:35:49 +00:00
Pino Toscano
4c5a6afc84 builder: accept also '_' in group names 2014-02-19 16:40:00 +01:00
Pino Toscano
bb35e72503 builder: move the XDG path handling in an own file
Just code motion and renaming, no actual behaviour changes.
2014-02-18 12:55:14 +01:00
Richard W.M. Jones
360abeebda builder: Fix dependencies which are not generated correctly by automake.
See the error messages here:
https://www.redhat.com/archives/libguestfs/2014-February/msg00148.html

This fixes commit e2cc8b6465.
2014-02-17 09:53:25 +00:00
Richard W.M. Jones
9018356a67 Use bindtextdomain in some programs where it was missing.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
e3d23cccf4 builder: Suppress warning about unused yyunput.
CC       virt_index_validate-index-validate.o
index-scan.c:1270:17: warning: 'yyunput' defined but not used [-Wunused-function]
     static void yyunput (int c, register char * yy_bp )
                 ^
  CCLD     virt-index-validate

By using %option nounput we can prevent this from being generated in
the first place.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
e4fe09c5ae builder: pxzcat: Fix char * signedness warning. 2014-02-13 17:48:23 +00:00
Pino Toscano
76e3e15d03 builder: do a copy when downloading local files
Instead of spawning curl even to "download" file:// URIs, just copy
them.
2014-02-11 12:52:10 +01:00
Pino Toscano
ba3569704c builder: prepare for different per-protocol download actions
Small refactor of Downloader.download_to to allow different download
actions depending on the protocol of the URI (which is now parsed).

No actual behaviour changes, just mostly code motion.
2014-02-11 12:39:56 +01:00
Pino Toscano
c66cec6ffa builder: isolate C libraries in an own OCAMLCLIBS
Just moving stuff within Makefile.am, no functional changes.
2014-02-11 10:40:31 +01:00
Pino Toscano
bed8a168c0 builder: remove unused variables
Leftovers of the list_entries_short+list_entries_long split done in
commit 91aae893c7.
2014-01-30 17:06:42 +01:00
Pino Toscano
07ef60c63f builder: output translated notes
Output all the translations available for the notes in the "verbose"
output and the JSON output, while trying to match the system langauge in
the "show notes" output.

The JSON output is slightly changed to handle translations, with the
"untranslated" notes being matched as "C". The version is not bumped
though, since there have been no stable releases with the former output
yet.
2014-01-30 17:05:34 +01:00
Richard W.M. Jones
2595fa5069 builder: Move Perl_edit module into common code.
There is no functional change.
2014-01-29 14:04:40 +00:00
Richard W.M. Jones
bd12e784e7 builder: Use disk-create API instead of calling qemu-img create. 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
080300dfec builder: Add documentation for enabling Puppet (agent) in a guest. 2014-01-25 09:41:10 +00:00
Richard W.M. Jones
90e23b4e56 builder: Add --selinux-relabel option to perform SELinux relabelling.
This adds the --selinux-relabel option which enables selinux in the
appliance and runs:

  if load_policy && fixfiles restore; then
    rm -f /.autorelabel
  else
    touch /.autorelabel
  fi

at the end of installation.

When possible this fixes SELinux labels in the guest and makes the
autorelabel step unnecessary.

Notes:

 - The previous commit is required so that load_policy works.

 - During the build, SELinux is enabled but no policy is loaded.  This
   works because SELinux is in permissive mode.

 - This flag does not work if the appliance kernel and the guest have
   greatly differing versions, eg. a RHEL 6 guest with a Fedora 20
   appliance.  This is because SELinux changes the policy format and
   breaks backwards compatibility.  You would see errors like this:

   libsepol.policydb_write: policy version 15 cannot support MLS
   libsepol.policydb_to_image: could not compute policy length
   libsepol.policydb_to_image: could not create policy image
   SELinux:  Could not downgrade policy file /etc/selinux/targeted/policy/policy.24, searching for an older version.
   SELinux:  Could not open policy file <= /etc/selinux/targeted/policy/policy.24:  No such file or directory

   These errors are ignored (they go to the log file) and relabelling
   is done at boot instead.

 - It's not clear if loading guest policy is safe.  You should trust
   the virt-builder templates and to use libguestfs confinement for
   additional protection.
2014-01-25 09:41:07 +00:00
Pino Toscano
b7cd63fc1d builder: read all the available notes from the index
Switch the internal storage for the notes of each entry to a sorted list
with all the subkeys available (which should represent the translations
to various languages).
The current outputs are the same (i.e. still the untranslated notes), so
this is just internal refactoring/preparation.
2014-01-23 15:36:15 +01:00
Pino Toscano
958e84d699 builder: small code simplification
No actual behaviour changes, just remove extra match statements.
2014-01-23 10:19:16 +01:00
Pino Toscano
9e4357ca54 builder: fix small regression in subkey parsing
Introduced in 5cbdf35d65, it caused the
first character of the value to be skipped if the key has a subkey.
2014-01-22 15:34:22 +01:00
Richard W.M. Jones
c6ec6cde27 builder: Add -monitor none to example command line. 2014-01-22 12:55:52 +00:00
Pino Toscano
5cbdf35d65 builder: proper consider subkeys in index files
The index files already allowed the 'key[subkey]=...' syntax for keys,
but considering such string as whole key. Proper split the parsing and
the handling of the subkeys, so they can be searched a bit easier.

This causes no actual behaviour changes, it is just internal
micro-refactoring. (Thanks Rich for the hints, too.)
2014-01-21 19:19:22 +01:00
Richard W.M. Jones
20a4bfde96 builder: Add tip for how to relabel SELinux guest at build time.
Thanks: purpleidea/James.
2014-01-21 17:33:35 +00:00
Richard W.M. Jones
88094f3da4 builder: Clearer note in man page about SELinux and where /.autorelabel file comes from.
It's not added by virt-builder.  It is present in the templates (added
by virt-sysprep in fact).
2014-01-21 17:33:35 +00:00
Richard W.M. Jones
be5fd2fd34 builder: Add note about cloning to man page. 2014-01-21 17:33:35 +00:00
Pino Toscano
4505f61979 builder: allow more empty lines in index files
Improve the index grammar to allow more than one empty line between
sections, and to allow any number of empty lines at the end of the file
(after the last section).
2014-01-21 17:54:23 +01:00
Pino Toscano
e2cc8b6465 builder: add index-struct.h as dependency for index-parser-c.c
Just like with index-parse.h, also index-struct.h is a dependency of
index-parser-c.c which automake cannot generate correctly.
Thus, add it manually.
2014-01-21 13:47:29 +01:00
Richard W.M. Jones
b3cf877e58 builder: Fix unterminated I<...> in man page.
Thanks: Lukas Zapletal.
2014-01-16 18:01:46 +00:00
Pino Toscano
5b42351294 builder: add a JSON output for --list
Simple JSON output for sources and templates, to be able to query them
with no need to parse unstructured outputs like the "--list-format long"
one.
2014-01-16 14:58:25 +01:00
Pino Toscano
e45bfe0d36 builder: add --list-format
Add a --list-format which allows to choose which in format should be the
output of --list.
2014-01-16 12:34:48 +01:00
Pino Toscano
91aae893c7 builder: small refactor of the list output
Switch from a boolean for the short/long list output to labels for the
actual format. Also, split the output of each list format to an own
function for easier maintaineance.
2014-01-16 11:49:05 +01:00