From 7d4a99db87b9fe9373b482092db88610fb796012 Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Fri, 14 Oct 2011 01:05:01 +0200 Subject: [PATCH] Detect Mageia distribution --- generator/generator_actions.ml | 4 ++++ src/guestfs-internal.h | 1 + src/inspect.c | 1 + src/inspect_fs.c | 2 ++ src/inspect_fs_unix.c | 5 +++++ src/inspect_icon.c | 12 ++++++++++++ 6 files changed, 25 insertions(+) diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index f76a404..6c8a14d 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -802,6 +802,10 @@ Gentoo. Linux Mint. +=item \"mageia\" + +Mageia. + =item \"mandriva\" Mandriva. diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index 64cf696..58d06e5 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -274,6 +274,7 @@ enum inspect_os_distro { OS_DISTRO_CENTOS, OS_DISTRO_SCIENTIFIC_LINUX, OS_DISTRO_TTYLINUX, + OS_DISTRO_MAGEIA, }; enum inspect_os_package_format { diff --git a/src/inspect.c b/src/inspect.c index f3e2186..be06fde 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -197,6 +197,7 @@ guestfs__inspect_get_distro (guestfs_h *g, const char *root) 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_MAGEIA: ret = safe_strdup (g, "mageia"); 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; diff --git a/src/inspect_fs.c b/src/inspect_fs.c index e317e46..81b3008 100644 --- a/src/inspect_fs.c +++ b/src/inspect_fs.c @@ -361,6 +361,7 @@ 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_MAGEIA: case OS_DISTRO_MANDRIVA: case OS_DISTRO_CENTOS: case OS_DISTRO_SCIENTIFIC_LINUX: @@ -427,6 +428,7 @@ 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_MAGEIA: case OS_DISTRO_MANDRIVA: fs->package_management = OS_PACKAGE_MANAGEMENT_URPMI; break; diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c index 00d3cd7..689fdb5 100644 --- a/src/inspect_fs_unix.c +++ b/src/inspect_fs_unix.c @@ -214,6 +214,11 @@ parse_lsb_release (guestfs_h *g, struct inspect_fs *fs) fs->distro = OS_DISTRO_MANDRIVA; r = 1; } + else if (fs->distro == 0 && + STREQ (lines[i], "DISTRIB_ID=\"Mageia\"")) { + fs->distro = OS_DISTRO_MAGEIA; + r = 1; + } else if (STRPREFIX (lines[i], "DISTRIB_RELEASE=")) { char *major, *minor; if (match2 (g, &lines[i][16], re_major_minor, &major, &minor)) { diff --git a/src/inspect_icon.c b/src/inspect_icon.c index d9e2ee9..f418e4a 100644 --- a/src/inspect_icon.c +++ b/src/inspect_icon.c @@ -53,6 +53,7 @@ static char *icon_favicon (guestfs_h *g, struct inspect_fs *fs, size_t *size_r); static char *icon_fedora (guestfs_h *g, struct inspect_fs *fs, size_t *size_r); static char *icon_rhel (guestfs_h *g, struct inspect_fs *fs, size_t *size_r); static char *icon_debian (guestfs_h *g, struct inspect_fs *fs, size_t *size_r); +static char *icon_mageia (guestfs_h *g, struct inspect_fs *fs, size_t *size_r); static char *icon_windows (guestfs_h *g, struct inspect_fs *fs, size_t *size_r); /* Dummy static object. */ @@ -126,6 +127,10 @@ guestfs__inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r, r = icon_debian (g, fs, &size); break; + case OS_DISTRO_MAGEIA: + r = icon_mageia (g, fs, &size); + break; + /* These are just to keep gcc warnings happy. */ case OS_DISTRO_ARCHLINUX: case OS_DISTRO_GENTOO: @@ -286,6 +291,13 @@ icon_debian (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) return get_png (g, fs, DEBIAN_ICON, size_r, 2048); } +#define MAGEIA_ICON "/usr/share/icons/mageia.png" + +static char * +icon_mageia (guestfs_h *g, struct inspect_fs *fs, size_t *size_r) +{ + return get_png (g, fs, MAGEIA_ICON, size_r, 2048); +} /* Windows, as usual, has to be much more complicated and stupid than * anything else. * -- 1.8.3.1