[PATCH 1/2] sysprep: machine_id: simplify implementation
by Pino Toscano
Instead of rm + touch, just truncate the file if existing.
In case there was no file previously, now nothing is created, as most
probably the system was fine even without it.
Also, turn the single path into a list, so more machine-id files can be
handled at once.
---
sysprep/sysprep_operation_machine_id.ml | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sysprep/sysprep_operation_machine_id.ml b/sysprep/sysprep_operation_machine_id.ml
index fbcc692..190ca5b 100644
--- a/sysprep/sysprep_operation_machine_id.ml
+++ b/sysprep/sysprep_operation_machine_id.ml
@@ -21,15 +21,12 @@ open Common_gettext.Gettext
module G = Guestfs
-let machine_id_perform g root side_effects =
+let machine_id_perform (g : Guestfs.guestfs) root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
- let path = "/etc/machine-id" in
- (try g#rm path with G.Error _ -> ());
- (try
- g#touch path;
- side_effects#created_file ()
- with G.Error _ -> ());
+ let paths = [ "/etc/machine-id"; ] in
+ let paths = List.filter g#is_file paths in
+ List.iter g#truncate paths
)
let op = {
--
2.1.0
9 years, 4 months
[PATCH v2] appliance init: find NIC name for dhcpcd
by Cédric Bosdonnat
dhcpcd requires an interface name as parameter to work. We are now
getting it from /proc/sys/net/ipv4/conf/ folder children. dhclient
on Debian also has the problem, thus use the guessed interface name
for it too.
---
appliance/init | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/appliance/init b/appliance/init
index cca62e7..d5a428d 100755
--- a/appliance/init
+++ b/appliance/init
@@ -108,10 +108,11 @@ ip addr add 127.0.0.1/8 brd + dev lo scope host
ip link set dev lo up
if test "$guestfs_network" = 1; then
+ iface=$(ls -I all -I default -I lo /proc/sys/net/ipv4/conf)
if dhclient --version >/dev/null 2>&1; then
- dhclient
+ dhclient $iface
else
- dhcpcd
+ dhcpcd $iface
fi
fi
--
2.1.4
9 years, 4 months
[PATCH 0/2] Misc fixes
by Cédric Bosdonnat
Here are two patches: one fixes the gpg-agent causing unmount to fail
after running dnf to install packages. The other ones fixes dhcpcd call
in the init program to provide it an interface name.
Cédric Bosdonnat (2):
appliance init: find NIC name for dhcpcd
Make sure gpg-agent is terminated before umount
appliance/init | 3 ++-
customize/customize_run.ml | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
--
2.1.4
9 years, 4 months
[PATCH 00/10] tests: Introduce test harness for running tests.
by Richard W.M. Jones
I should probably start by saying this patch series isn't ready for
review yet.
This patch series adds a test harness to libguestfs. It allows us to
run the tests outside the ordinary 'make check' path in the build
tree. In particular, you can use this to run tests when libguestfs
has been installed. 'make check' and the other 'make check-*' rules
still work.
The goals for this series is described in the commit message for
patch 01/10.
Back in Oct last year, I posted an earlier version of this patch
series. I believe the last version of this series posted was this
one:
https://www.redhat.com/archives/libguestfs/2014-October/msg00208.html
Rich.
9 years, 4 months
[PATCH 00/10] RFC: builder: first support for Simple Streams metadata
by Pino Toscano
Hi,
this series adds a basic support for Simple Streams v1.0 metadata
files. This makes it possible to create a repository .conf files with
[cirros]
uri=http://download.cirros-cloud.net
format=simplestreams
to read the latest version of each CirrOS image.
TODO items:
- a bit more testing: listing and creating images works, so the
current metadata is correct
- handle revisions, so newer revisions in images are seen; might
imply switch the internal revision handling from int to string
Except from the actual patch #10, the rest of the work should be fine
for eventual inclusion.
Thanks,
Pino Toscano (10):
builder: add format=FMT in repository .conf files
builder: create and use a new Checksums module
builder: add SHA256 support in Checksums
builder: internally use a list of checksums for indexes
builder: allow signatures from subkeys
builder: split Index_parser.index in an own module
fix -- add Index
builder: expose Sigchecker.verifying_signatures
builder: add Sigchecker.verify_and_remove_signature
builder: support Simple Streams v1.0 as index metadata
builder/Makefile.am | 17 +++-
builder/builder.ml | 45 +++++----
builder/checksums.ml | 58 +++++++++++
builder/checksums.mli | 33 +++++++
builder/index.ml | 117 ++++++++++++++++++++++
builder/index.mli | 41 ++++++++
builder/index_parser.ml | 98 ++----------------
builder/index_parser.mli | 24 +----
builder/list_entries.ml | 6 +-
builder/list_entries.mli | 2 +-
builder/sigchecker.ml | 91 ++++++++++-------
builder/sigchecker.mli | 12 ++-
builder/simplestreams_parser.ml | 207 +++++++++++++++++++++++++++++++++++++++
builder/simplestreams_parser.mli | 19 ++++
builder/sources.ml | 25 +++++
builder/sources.mli | 4 +
builder/virt-builder.pod | 23 +++++
builder/yajl-c.c | 141 ++++++++++++++++++++++++++
builder/yajl.ml | 30 ++++++
builder/yajl.mli | 33 +++++++
po/POTFILES | 1 +
po/POTFILES-ml | 4 +
22 files changed, 853 insertions(+), 178 deletions(-)
create mode 100644 builder/checksums.ml
create mode 100644 builder/checksums.mli
create mode 100644 builder/index.ml
create mode 100644 builder/index.mli
create mode 100644 builder/simplestreams_parser.ml
create mode 100644 builder/simplestreams_parser.mli
create mode 100644 builder/yajl-c.c
create mode 100644 builder/yajl.ml
create mode 100644 builder/yajl.mli
--
2.1.0
9 years, 4 months
[PATCH] customize: Combine separate -a and -d option synopses (RHBZ#1246882)
by Richard W.M. Jones
---
customize/virt-customize.pod | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/customize/virt-customize.pod b/customize/virt-customize.pod
index 838e40c..791a829 100644
--- a/customize/virt-customize.pod
+++ b/customize/virt-customize.pod
@@ -4,10 +4,8 @@ virt-customize - Customize a virtual machine
=head1 SYNOPSIS
- virt-customize [--options] -d domname
-__CUSTOMIZE_SYNOPSIS__
-
- virt-customize [--options] -a disk.img [-a disk.img ...]
+ virt-customize [--options]
+ [ -d domname | -a disk.img [-a disk.img ...] ]
__CUSTOMIZE_SYNOPSIS__
=head1 DESCRIPTION
--
2.4.3
9 years, 4 months
[PATCH] customize: random_seed: add CirrOS location
by Pino Toscano
CirrOS has its random-seed file in /etc.
---
customize/random_seed.ml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/customize/random_seed.ml b/customize/random_seed.ml
index 34a7af7..5a15ad9 100644
--- a/customize/random_seed.ml
+++ b/customize/random_seed.ml
@@ -30,6 +30,7 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
"/var/lib/systemd/random-seed"; (* Fedora after F20? *)
"/var/lib/urandom/random-seed"; (* Debian *)
"/var/lib/misc/random-seed"; (* SuSE *)
+ "/etc/random-seed"; (* CirrOS *)
] in
List.iter (
fun file ->
@@ -52,6 +53,8 @@ let rec set_random_seed (g : Guestfs.guestfs) root =
Some "/var/lib/urandom/random-seed"
| "linux", ("opensuse"|"sles"|"suse-based") ->
Some "/var/lib/misc/random-seed"
+ | "linux", "cirros" ->
+ Some "/etc/random-seed"
| _ ->
None in
match file with
--
2.1.0
9 years, 4 months
[PATCH] daemon: Run lsof when an umount command fails in umount_all call.
by Richard W.M. Jones
Useful for debugging unmount failures. Note that we include lsof in
the appliance already.
---
daemon/mount.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/daemon/mount.c b/daemon/mount.c
index c5b7d89..e139482 100644
--- a/daemon/mount.c
+++ b/daemon/mount.c
@@ -424,6 +424,10 @@ do_umount_all (void)
r = command (NULL, &err, str_umount, mounts.argv[i], NULL);
if (r == -1) {
reply_with_error ("umount: %s: %s", mounts.argv[i], err);
+ if (verbose) {
+ /* Try running lsof to see what is holding the mountpoint open. */
+ command (NULL, NULL, "lsof", mounts.argv[i], NULL);
+ }
free_stringslen (mounts.argv, mounts.size);
return -1;
}
--
2.4.3
9 years, 4 months
[PATCH] appliance: Exclude /usr/lib/modules as well as /lib/modules.
by Richard W.M. Jones
It normally makes no difference to the final size of the appliance,
because 'supermin --build' will copy back the host kernel modules.
---
appliance/excludefiles.in | 1 +
1 file changed, 1 insertion(+)
diff --git a/appliance/excludefiles.in b/appliance/excludefiles.in
index 574c828..181b182 100644
--- a/appliance/excludefiles.in
+++ b/appliance/excludefiles.in
@@ -21,6 +21,7 @@ dnl Of course, this may break the appliance, so be careful.
dnl The right kernel modules are added back by supermin.
-/boot/*
-/lib/modules/*
+-/usr/lib/modules/*
dnl Firmware blobs should not be required by a virtual machine.
dnl Because of UsrMove nonsense, we need to list both directories.
--
2.4.3
9 years, 4 months
[PATCH v2] appliance: exclude /lib/firmware
by Richard W.M. Jones
Brings the size of the appliance down to 95 MB [xz-compressed], which
is the same as for libguestfs 1.28.
---
appliance/excludefiles.in | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/appliance/excludefiles.in b/appliance/excludefiles.in
index d3c66cc..574c828 100644
--- a/appliance/excludefiles.in
+++ b/appliance/excludefiles.in
@@ -22,6 +22,11 @@ dnl The right kernel modules are added back by supermin.
-/boot/*
-/lib/modules/*
+dnl Firmware blobs should not be required by a virtual machine.
+dnl Because of UsrMove nonsense, we need to list both directories.
+-/lib/firmware/*
+-/usr/lib/firmware/*
+
-/usr/lib/locale/*
-/usr/share/cracklib/*
-/usr/share/doc/*
--
2.4.3
9 years, 4 months