summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2010-11-23 19:05:53 +0000
committerRichard W.M. Jones <rjones@redhat.com>2010-11-24 09:41:41 +0000
commit22a50e4e3bb9125c5f2520b812811d4ae2bd7d72 (patch)
treef692bc0cc882fccf1b14a88384510d82d2d9106c
parent72932bd0c94aa18c6054e7b70b852918f3b01293 (diff)
downloadlibguestfs-22a50e4e3bb9125c5f2520b812811d4ae2bd7d72.tar.gz
libguestfs-22a50e4e3bb9125c5f2520b812811d4ae2bd7d72.tar.xz
libguestfs-22a50e4e3bb9125c5f2520b812811d4ae2bd7d72.zip
inspect: Detect if db_dump and db_load programs are available.
If db_dump is not available then disable RPM application detection. Note these utilities have odd names on Debian.
-rw-r--r--README3
-rw-r--r--configure.ac10
-rw-r--r--images/Makefile.am2
-rw-r--r--src/inspect.c8
4 files changed, 21 insertions, 2 deletions
diff --git a/README b/README
index 74926e14..fe3a745c 100644
--- a/README
+++ b/README
@@ -65,6 +65,9 @@ Requirements
- hivex >= 1.2.1 (http://libguestfs.org/download)
+- (Optional) Berkeley DB 'db_dump' and 'db_load' utilities
+ (db4-utils or db4.X-util or similar)
+
- (Optional) FUSE to build the FUSE module
- perldoc (pod2man, pod2text) to generate the manual pages and
diff --git a/configure.ac b/configure.ac
index 8389390e..ac1ec105 100644
--- a/configure.ac
+++ b/configure.ac
@@ -226,6 +226,16 @@ dnl po4a for translating man pages and POD files (optional).
AC_CHECK_PROG([PO4A],[po4a],[po4a],[no])
AM_CONDITIONAL([HAVE_PO4A], [test "x$PO4A" != "xno"])
+dnl Check for db_dump, db_load (optional).
+AC_CHECK_PROGS([DB_DUMP],[db_dump db4_dump db4.8_dump],[no])
+AC_CHECK_PROGS([DB_LOAD],[db_load db4_load db4.8_load],[no])
+if test "x$DB_DUMP" != "xno"; then
+ AC_DEFINE_UNQUOTED([DB_DUMP],["$DB_DUMP"],[Name of db_dump program.])
+fi
+if test "x$DB_LOAD" != "xno"; then
+ AC_DEFINE_UNQUOTED([DB_LOAD],["$DB_LOAD"],[Name of db_load program.])
+fi
+
dnl Check for QEMU for running binaries on this $host_cpu, fall
dnl back to basic 'qemu'. Allow the user to override it.
default_qemu="qemu-kvm kvm qemu-system-$host_cpu qemu"
diff --git a/images/Makefile.am b/images/Makefile.am
index 56880804..40bf90fd 100644
--- a/images/Makefile.am
+++ b/images/Makefile.am
@@ -174,7 +174,7 @@ fedora.img: guest-aux/make-fedora-img.sh guest-aux/fedora-name.db
bash $<
guest-aux/fedora-name.db: guest-aux/fedora-name.db.txt
- db_load $@ < $<
+ $(DB_LOAD) $@ < $<
# Make a (dummy) Debian image.
debian.img: guest-aux/make-debian-img.sh
diff --git a/src/inspect.c b/src/inspect.c
index e42dca86..8b210268 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -1661,7 +1661,9 @@ guestfs__inspect_get_hostname (guestfs_h *g, const char *root)
return safe_strdup (g, fs->hostname ? : "unknown");
}
+#ifdef DB_DUMP
static struct guestfs_application_list *list_applications_rpm (guestfs_h *g, struct inspect_fs *fs);
+#endif
static struct guestfs_application_list *list_applications_deb (guestfs_h *g, struct inspect_fs *fs);
static struct guestfs_application_list *list_applications_windows (guestfs_h *g, struct inspect_fs *fs);
static void add_application (guestfs_h *g, struct guestfs_application_list *, const char *name, const char *display_name, int32_t epoch, const char *version, const char *release, const char *install_path, const char *publisher, const char *url, const char *description);
@@ -1683,9 +1685,11 @@ guestfs__inspect_list_applications (guestfs_h *g, const char *root)
case OS_TYPE_LINUX:
switch (fs->package_format) {
case OS_PACKAGE_FORMAT_RPM:
+#ifdef DB_DUMP
ret = list_applications_rpm (g, fs);
if (ret == NULL)
return NULL;
+#endif
break;
case OS_PACKAGE_FORMAT_DEB:
@@ -1729,6 +1733,7 @@ guestfs__inspect_list_applications (guestfs_h *g, const char *root)
return ret;
}
+#ifdef DB_DUMP
static struct guestfs_application_list *
list_applications_rpm (guestfs_h *g, struct inspect_fs *fs)
{
@@ -1744,7 +1749,7 @@ list_applications_rpm (guestfs_h *g, struct inspect_fs *fs)
char line[1024];
size_t len;
- snprintf (cmd, cmd_len, "db_dump -p '%s'", tmpfile);
+ snprintf (cmd, cmd_len, DB_DUMP " -p '%s'", tmpfile);
if (g->verbose)
fprintf (stderr, "list_applications_rpm: %s\n", cmd);
@@ -1829,6 +1834,7 @@ list_applications_rpm (guestfs_h *g, struct inspect_fs *fs)
return ret;
}
+#endif /* defined DB_DUMP */
static struct guestfs_application_list *
list_applications_deb (guestfs_h *g, struct inspect_fs *fs)