From: Richard Jones Date: Mon, 15 Nov 2010 22:06:34 +0000 (+0000) Subject: inspect: Add support for Linux Mint and Mandriva. X-Git-Tag: 1.7.8~4 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=2729421d176e1194537b499911a5eeb5e32a8b09;p=libguestfs.git 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. --- diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index f44725b..d62ca82 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -799,6 +799,14 @@ Fedora. Gentoo. +=item \"linuxmint\" + +Linux Mint. + +=item \"mandriva\" + +Mandriva. + =item \"meego\" MeeGo. @@ -1164,7 +1172,7 @@ a real packaging system (eg. Windows). Possible strings include: C, C, C (for all Debian derivatives), -C, C, C. +C, C, C, C. Future versions of libguestfs may return other strings. Please read L for more details."); diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index a1dd36f..abcd456 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 962fd00..e8c29a3 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");