Pino Toscano
2013-Dec-20 14:09 UTC
[Libguestfs] [PATCH] inspect: fix detection of newer CirrOS versions (RHBZ#1045450).
Add an own case for CirrOS, based on the /etc/cirros/version file provided in newer version instead of the Buildroot-generated /etc/br-version. --- src/inspect-fs-unix.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index a9e5cad..c70960a 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -574,6 +574,18 @@ guestfs___check_linux_root (guestfs_h *g, struct inspect_fs *fs) return -1; } + /* CirrOS versions providing a own version file. + */ + else if (guestfs_is_file_opts (g, "/etc/cirros/version", + GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) { + fs->distro = OS_DISTRO_CIRROS; + + if (parse_release_file (g, fs, "/etc/cirros/version") == -1) + return -1; + + if (guestfs___parse_major_minor (g, fs) == -1) + return -1; + } /* Buildroot (http://buildroot.net) is an embedded Linux distro * toolkit. It is used by specific distros such as Cirros. */ -- 1.8.3.1
Richard W.M. Jones
2013-Dec-20 14:15 UTC
Re: [Libguestfs] [PATCH] inspect: fix detection of newer CirrOS versions (RHBZ#1045450).
On Fri, Dec 20, 2013 at 03:09:05PM +0100, Pino Toscano wrote:> Add an own case for CirrOS, based on the /etc/cirros/version file > provided in newer version instead of the Buildroot-generated > /etc/br-version. > --- > src/inspect-fs-unix.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c > index a9e5cad..c70960a 100644 > --- a/src/inspect-fs-unix.c > +++ b/src/inspect-fs-unix.c > @@ -574,6 +574,18 @@ guestfs___check_linux_root (guestfs_h *g, struct inspect_fs *fs) > return -1; > > } > + /* CirrOS versions providing a own version file. > + */ > + else if (guestfs_is_file_opts (g, "/etc/cirros/version", > + GUESTFS_IS_FILE_OPTS_FOLLOWSYMLINKS, 1, -1) > 0) { > + fs->distro = OS_DISTRO_CIRROS; > + > + if (parse_release_file (g, fs, "/etc/cirros/version") == -1) > + return -1; > + > + if (guestfs___parse_major_minor (g, fs) == -1) > + return -1; > + } > /* Buildroot (http://buildroot.net) is an embedded Linux distro > * toolkit. It is used by specific distros such as Cirros. > */ > -- > 1.8.3.1ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)