From 96b44334dd7421b8209f839faccb216a2cb0f773 Mon Sep 17 00:00:00 2001 From: Richard Jones Date: Fri, 29 Oct 2010 10:53:05 +0100 Subject: [PATCH] inspect: Add detection of Gentoo. --- generator/generator_actions.ml | 4 ++++ inspector/virt-inspector | 4 ++++ src/guestfs-internal.h | 1 + src/inspect.c | 10 ++++++++++ 4 files changed, 19 insertions(+) diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 6c21227..5aa5359 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -791,6 +791,10 @@ Debian or a Debian-derived distro such as Ubuntu. Fedora. +=item \"gentoo\" + +Gentoo. + =item \"pardus\" Pardus. diff --git a/inspector/virt-inspector b/inspector/virt-inspector index 9309b27..fbe05d8 100755 --- a/inspector/virt-inspector +++ b/inspector/virt-inspector @@ -389,6 +389,10 @@ sub output_applications $package_format = "rpm"; $package_management = "yum"; } + elsif ($distro eq "gentoo") { + $package_format = "ebuild"; + $package_management = "portage"; + } elsif ($distro eq "pardus") { $package_format = "pisi"; $package_management = "pisi"; diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index e1723a4..6a4a422 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -168,6 +168,7 @@ enum inspect_os_distro { OS_DISTRO_WINDOWS, OS_DISTRO_PARDUS, OS_DISTRO_ARCHLINUX, + OS_DISTRO_GENTOO, }; struct inspect_fs { diff --git a/src/inspect.c b/src/inspect.c index dbb194b..6e22360 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -738,6 +738,15 @@ check_linux_root (guestfs_h *g, struct inspect_fs *fs) * determine the actual release or product string. */ } + else if (guestfs_exists (g, "/etc/gentoo-release") > 0) { + fs->distro = OS_DISTRO_GENTOO; + + if (parse_release_file (g, fs, "/etc/gentoo-release") == -1) + return -1; + + if (parse_major_minor (g, fs) == -1) + return -1; + } /* Determine the architecture. */ const char *binaries[] = @@ -1255,6 +1264,7 @@ guestfs__inspect_get_distro (guestfs_h *g, const char *root) case OS_DISTRO_ARCHLINUX: ret = safe_strdup (g, "archlinux"); break; case OS_DISTRO_DEBIAN: ret = safe_strdup (g, "debian"); break; case OS_DISTRO_FEDORA: ret = safe_strdup (g, "fedora"); break; + case OS_DISTRO_GENTOO: ret = safe_strdup (g, "gentoo"); break; case OS_DISTRO_PARDUS: ret = safe_strdup (g, "pardus"); break; case OS_DISTRO_REDHAT_BASED: ret = safe_strdup (g, "redhat-based"); break; case OS_DISTRO_RHEL: ret = safe_strdup (g, "rhel"); break; -- 1.8.3.1