Pino Toscano
2019-Dec-10 16:50 UTC
[Libguestfs] [PATCH] inspect: correct osinfo ID for CentOS >= 8
CentOS 8 is represented with a simpler "centos8" osinfo ID. --- lib/inspect-osinfo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c index 90b7ffd86..ba07e4564 100644 --- a/lib/inspect-osinfo.c +++ b/lib/inspect-osinfo.c @@ -40,7 +40,9 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root) if (STREQ (type, "linux")) { if (STREQ (distro, "centos")) { - if (major >= 7) + if (major >= 8) + return safe_asprintf (g, "%s%d", distro, major); + else if (major == 7) return safe_asprintf (g, "%s%d.0", distro, major); else if (major == 6) return safe_asprintf (g, "%s%d.%d", distro, major, minor); -- 2.23.0
Richard W.M. Jones
2019-Dec-11 10:32 UTC
Re: [Libguestfs] [PATCH] inspect: correct osinfo ID for CentOS >= 8
On Tue, Dec 10, 2019 at 05:50:42PM +0100, Pino Toscano wrote:> CentOS 8 is represented with a simpler "centos8" osinfo ID. > --- > lib/inspect-osinfo.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/lib/inspect-osinfo.c b/lib/inspect-osinfo.c > index 90b7ffd86..ba07e4564 100644 > --- a/lib/inspect-osinfo.c > +++ b/lib/inspect-osinfo.c > @@ -40,7 +40,9 @@ guestfs_impl_inspect_get_osinfo (guestfs_h *g, const char *root) > > if (STREQ (type, "linux")) { > if (STREQ (distro, "centos")) { > - if (major >= 7) > + if (major >= 8) > + return safe_asprintf (g, "%s%d", distro, major); > + else if (major == 7) > return safe_asprintf (g, "%s%d.0", distro, major); > else if (major == 6) > return safe_asprintf (g, "%s%d.%d", distro, major, minor);Obvious one, ACK, thanks. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Seemingly Similar Threads
- [PATCH] inspect: avoid returning "unknownX.Y" for unknown Linux distros
- [PATCH 0/5] Small inspection improvements
- [PATCH 5/5] inspect: correct osinfo ID for ALT Linux >= 8
- [PATCH] inspect: return osinfo short IDs for recent Windows versions
- [PATCH v2] inspect: return osinfo short IDs for recent Windows versions