From: Richard Jones Date: Fri, 29 Oct 2010 09:32:53 +0000 (+0100) Subject: inspect: Add detection of Arch Linux. X-Git-Tag: 1.5.26~3 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=b4618fb060b40ba70f2be28b1b1ad625722a7edf;p=libguestfs.git inspect: Add detection of Arch Linux. --- diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 4fadd17..6c21227 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -779,6 +779,10 @@ Currently defined distros are: =over 4 +=item \"archlinux\" + +Arch Linux. + =item \"debian\" Debian or a Debian-derived distro such as Ubuntu. diff --git a/inspector/virt-inspector b/inspector/virt-inspector index 4936068..9309b27 100755 --- a/inspector/virt-inspector +++ b/inspector/virt-inspector @@ -377,7 +377,11 @@ sub output_applications # and package management. my ($package_format, $package_management); if (defined $distro) { - if ($distro eq "debian") { + if ($distro eq "archlinux") { + $package_format = "pacman"; + $package_management = "pacman"; + } + elsif ($distro eq "debian") { $package_format = "deb"; $package_management = "apt"; } diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index 529aa7d..e1723a4 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -167,6 +167,7 @@ enum inspect_os_distro { OS_DISTRO_RHEL, OS_DISTRO_WINDOWS, OS_DISTRO_PARDUS, + OS_DISTRO_ARCHLINUX, }; struct inspect_fs { diff --git a/src/inspect.c b/src/inspect.c index 8e42408..dbb194b 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -731,6 +731,13 @@ check_linux_root (guestfs_h *g, struct inspect_fs *fs) if (parse_major_minor (g, fs) == -1) return -1; } + else if (guestfs_exists (g, "/etc/arch-release") > 0) { + fs->distro = OS_DISTRO_ARCHLINUX; + + /* /etc/arch-release file is empty and I can't see a way to + * determine the actual release or product string. + */ + } /* Determine the architecture. */ const char *binaries[] = @@ -1245,6 +1252,7 @@ guestfs__inspect_get_distro (guestfs_h *g, const char *root) char *ret; switch (fs->distro) { + 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_PARDUS: ret = safe_strdup (g, "pardus"); break;