diff options
author | Richard Jones <rjones@redhat.com> | 2010-11-15 22:06:34 +0000 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-11-15 22:21:52 +0000 |
commit | 2729421d176e1194537b499911a5eeb5e32a8b09 (patch) | |
tree | 2432e1e5e1c0e32b1f5560f5b264ec71afbbcaff /src | |
parent | a22d5a7390339eca5d9bafb2155439ad1ccc02ac (diff) | |
download | libguestfs-2729421d176e1194537b499911a5eeb5e32a8b09.tar.gz libguestfs-2729421d176e1194537b499911a5eeb5e32a8b09.tar.xz libguestfs-2729421d176e1194537b499911a5eeb5e32a8b09.zip |
inspect: Add support for Linux Mint and Mandriva.
Linux Mint is derived from Ubuntu.
Mandriva has a release file, but it also has /etc/lsb-release and
the same parsing code can be reused. Mandriva has a package manager
called urpmi.
Diffstat (limited to 'src')
-rw-r--r-- | src/guestfs-internal.h | 3 | ||||
-rw-r--r-- | src/inspect.c | 36 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index a1dd36f1..abcd4567 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -181,6 +181,8 @@ enum inspect_os_distro { OS_DISTRO_GENTOO, OS_DISTRO_UBUNTU, OS_DISTRO_MEEGO, + OS_DISTRO_LINUX_MINT, + OS_DISTRO_MANDRIVA, }; enum inspect_os_package_format { @@ -200,6 +202,7 @@ enum inspect_os_package_management { OS_PACKAGE_MANAGEMENT_PACMAN, OS_PACKAGE_MANAGEMENT_PORTAGE, OS_PACKAGE_MANAGEMENT_PISI, + OS_PACKAGE_MANAGEMENT_URPMI, }; struct inspect_fs { diff --git a/src/inspect.c b/src/inspect.c index 962fd009..e8c29a36 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -389,7 +389,22 @@ parse_major_minor (guestfs_h *g, struct inspect_fs *fs) * DISTRIB_RELEASE=10.04 # Version * DISTRIB_CODENAME=lucid * DISTRIB_DESCRIPTION="Ubuntu 10.04.1 LTS" # Product name - * In theory other distros could have this LSB file, but none do. + * + * [Ubuntu-derived ...] Linux Mint was found to have this: + * DISTRIB_ID=LinuxMint + * DISTRIB_RELEASE=10 + * DISTRIB_CODENAME=julia + * DISTRIB_DESCRIPTION="Linux Mint 10 Julia" + * Linux Mint also has /etc/linuxmint/info with more information, + * but we can use the LSB file. + * + * Mandriva has: + * LSB_VERSION=lsb-4.0-amd64:lsb-4.0-noarch + * DISTRIB_ID=MandrivaLinux + * DISTRIB_RELEASE=2010.1 + * DISTRIB_CODENAME=Henry_Farman + * DISTRIB_DESCRIPTION="Mandriva Linux 2010.1" + * Mandriva also has a normal release file called /etc/mandriva-release. */ static int parse_lsb_release (guestfs_h *g, struct inspect_fs *fs) @@ -408,6 +423,16 @@ parse_lsb_release (guestfs_h *g, struct inspect_fs *fs) fs->distro = OS_DISTRO_UBUNTU; r = 1; } + else if (fs->distro == 0 && + STREQ (lines[i], "DISTRIB_ID=LinuxMint")) { + fs->distro = OS_DISTRO_LINUX_MINT; + r = 1; + } + else if (fs->distro == 0 && + STREQ (lines[i], "DISTRIB_ID=MandrivaLinux")) { + fs->distro = OS_DISTRO_MANDRIVA; + r = 1; + } else if (STRPREFIX (lines[i], "DISTRIB_RELEASE=")) { char *major, *minor; if (match2 (g, &lines[i][16], re_major_minor, &major, &minor)) { @@ -1113,11 +1138,13 @@ check_package_format (guestfs_h *g, struct inspect_fs *fs) case OS_DISTRO_MEEGO: case OS_DISTRO_REDHAT_BASED: case OS_DISTRO_RHEL: + case OS_DISTRO_MANDRIVA: fs->package_format = OS_PACKAGE_FORMAT_RPM; break; case OS_DISTRO_DEBIAN: case OS_DISTRO_UBUNTU: + case OS_DISTRO_LINUX_MINT: fs->package_format = OS_PACKAGE_FORMAT_DEB; break; @@ -1158,6 +1185,7 @@ check_package_management (guestfs_h *g, struct inspect_fs *fs) case OS_DISTRO_DEBIAN: case OS_DISTRO_UBUNTU: + case OS_DISTRO_LINUX_MINT: fs->package_management = OS_PACKAGE_MANAGEMENT_APT; break; @@ -1170,6 +1198,9 @@ check_package_management (guestfs_h *g, struct inspect_fs *fs) case OS_DISTRO_PARDUS: fs->package_management = OS_PACKAGE_MANAGEMENT_PISI; break; + case OS_DISTRO_MANDRIVA: + fs->package_management = OS_PACKAGE_MANAGEMENT_URPMI; + break; case OS_DISTRO_WINDOWS: case OS_DISTRO_UNKNOWN: @@ -1272,6 +1303,8 @@ guestfs__inspect_get_distro (guestfs_h *g, const char *root) 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_LINUX_MINT: ret = safe_strdup (g, "linuxmint"); break; + case OS_DISTRO_MANDRIVA: ret = safe_strdup (g, "mandriva"); break; case OS_DISTRO_MEEGO: ret = safe_strdup (g, "meego"); break; case OS_DISTRO_PARDUS: ret = safe_strdup (g, "pardus"); break; case OS_DISTRO_REDHAT_BASED: ret = safe_strdup (g, "redhat-based"); break; @@ -1440,6 +1473,7 @@ guestfs__inspect_get_package_management (guestfs_h *g, const char *root) case OS_PACKAGE_MANAGEMENT_PACMAN: ret = safe_strdup (g, "pacman"); break; case OS_PACKAGE_MANAGEMENT_PORTAGE: ret = safe_strdup (g, "portage"); break; case OS_PACKAGE_MANAGEMENT_PISI: ret = safe_strdup (g, "pisi"); break; + case OS_PACKAGE_MANAGEMENT_URPMI: ret = safe_strdup (g, "urpmi"); break; case OS_PACKAGE_MANAGEMENT_UNKNOWN: default: ret = safe_strdup (g, "unknown"); |