From: Michael Scherer <misc(a)zarb.org>
This would also erronously detect SLES as Opensuse.
---
src/guestfs-internal.h | 2 ++
src/inspect.c | 2 ++
src/inspect_fs.c | 5 +++++
src/inspect_fs_unix.c | 10 ++++++++++
4 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h
index 58d06e5..cee3048 100644
--- a/src/guestfs-internal.h
+++ b/src/guestfs-internal.h
@@ -275,6 +275,7 @@ enum inspect_os_distro {
OS_DISTRO_SCIENTIFIC_LINUX,
OS_DISTRO_TTYLINUX,
OS_DISTRO_MAGEIA,
+ OS_DISTRO_OPENSUSE,
};
enum inspect_os_package_format {
@@ -295,6 +296,7 @@ enum inspect_os_package_management {
OS_PACKAGE_MANAGEMENT_PORTAGE,
OS_PACKAGE_MANAGEMENT_PISI,
OS_PACKAGE_MANAGEMENT_URPMI,
+ OS_PACKAGE_MANAGEMENT_ZYPPER,
};
struct inspect_fs {
diff --git a/src/inspect.c b/src/inspect.c
index be06fde..62cbc85 100644
--- a/src/inspect.c
+++ b/src/inspect.c
@@ -200,6 +200,7 @@ guestfs__inspect_get_distro (guestfs_h *g, const char *root)
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_OPENSUSE: ret = safe_strdup (g, "opensuse"); break;
case OS_DISTRO_PARDUS: ret = safe_strdup (g, "pardus"); break;
case OS_DISTRO_REDHAT_BASED: ret = safe_strdup (g, "redhat-based"); break;
case OS_DISTRO_RHEL: ret = safe_strdup (g, "rhel"); break;
@@ -480,6 +481,7 @@ guestfs__inspect_get_package_management (guestfs_h *g, const char
*root)
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_ZYPPER: ret = safe_strdup (g, "zypper"); break;
case OS_PACKAGE_MANAGEMENT_UNKNOWN:
default:
ret = safe_strdup (g, "unknown");
diff --git a/src/inspect_fs.c b/src/inspect_fs.c
index 81b3008..2533626 100644
--- a/src/inspect_fs.c
+++ b/src/inspect_fs.c
@@ -363,6 +363,7 @@ check_package_format (guestfs_h *g, struct inspect_fs *fs)
case OS_DISTRO_RHEL:
case OS_DISTRO_MAGEIA:
case OS_DISTRO_MANDRIVA:
+ case OS_DISTRO_OPENSUSE:
case OS_DISTRO_CENTOS:
case OS_DISTRO_SCIENTIFIC_LINUX:
fs->package_format = OS_PACKAGE_FORMAT_RPM;
@@ -433,6 +434,10 @@ check_package_management (guestfs_h *g, struct inspect_fs *fs)
fs->package_management = OS_PACKAGE_MANAGEMENT_URPMI;
break;
+ case OS_DISTRO_OPENSUSE:
+ fs->package_management = OS_PACKAGE_MANAGEMENT_ZYPPER;
+ break;
+
case OS_DISTRO_SLACKWARE:
case OS_DISTRO_TTYLINUX:
case OS_DISTRO_WINDOWS:
diff --git a/src/inspect_fs_unix.c b/src/inspect_fs_unix.c
index 689fdb5..20c164e 100644
--- a/src/inspect_fs_unix.c
+++ b/src/inspect_fs_unix.c
@@ -419,6 +419,16 @@ guestfs___check_linux_root (guestfs_h *g, struct inspect_fs *fs)
if (guestfs___parse_major_minor (g, fs) == -1)
return -1;
}
+ else if (guestfs_exists (g, "/etc/SuSE-release") > 0) {
+ fs->distro = OS_DISTRO_OPENSUSE;
+
+ if (parse_release_file (g, fs, "/etc/SuSE-release") == -1)
+ return -1;
+
+ if (guestfs___parse_major_minor (g, fs) == -1)
+ return -1;
+ }
+
skip_release_checks:;
--
1.7.1