inspect: Add detection of Arch Linux.

This commit is contained in:
Richard Jones
2010-10-29 10:32:53 +01:00
parent 233530d354
commit b4618fb060
4 changed files with 18 additions and 1 deletions

View File

@@ -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.

View File

@@ -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";
}

View File

@@ -167,6 +167,7 @@ enum inspect_os_distro {
OS_DISTRO_RHEL,
OS_DISTRO_WINDOWS,
OS_DISTRO_PARDUS,
OS_DISTRO_ARCHLINUX,
};
struct inspect_fs {

View File

@@ -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;