[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 2/9] Detect Mageia distribution



From: Michael Scherer <misc zarb org>

---
 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 ++++++++++++
 5 files changed, 21 insertions(+), 0 deletions(-)

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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]