From: Michael Scherer Date: Thu, 13 Oct 2011 23:05:03 +0000 (+0200) Subject: Add Opensuse and zypper detection support X-Git-Tag: 1.13.21~6 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=5332515db3ed87716d702ef2b973816a73ab5702;p=libguestfs.git Add Opensuse and zypper detection support This would also erronously detect SLES as Opensuse. --- diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml index 6c8a14d..60fca9b 100644 --- a/generator/generator_actions.ml +++ b/generator/generator_actions.ml @@ -814,6 +814,10 @@ Mandriva. MeeGo. +=item \"opensuse\" + +OpenSUSE. + =item \"pardus\" Pardus. @@ -1190,7 +1194,7 @@ a real packaging system (eg. Windows). Possible strings include: C, C, C (for all Debian derivatives), -C, C, 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 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:;