Nikos Skalkotos
2014-Dec-02 17:16 UTC
[Libguestfs] [PATCH 5/5] Add freebsd and netbsd distros
Prior to this commit the distro for a FreeBSD or a NetBSD system, in conjuction to what happened for OpenBSD, was shown as 'unknown'. *BSDs are complete OSes, not a kernel like Linux, but theoritically you could have FreeBSD as ostype and PC-BSD as distro. Signed-off-by: Nikos Skalkotos <skalkoto@grnet.gr> --- generator/actions.ml | 8 ++++++++ src/guestfs-internal.h | 2 ++ src/inspect-fs-unix.c | 2 ++ src/inspect-fs.c | 4 ++++ src/inspect-icon.c | 2 ++ src/inspect.c | 2 ++ src/osinfo.c | 4 ++++ 7 files changed, 24 insertions(+) diff --git a/generator/actions.ml b/generator/actions.ml index 385b620..d4ec0b1 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -1065,6 +1065,10 @@ Debian. Fedora. +=item \"freebsd\" + +FreeBSD. + =item \"freedos\" FreeDOS. @@ -1089,6 +1093,10 @@ Mandriva. MeeGo. +=item \"netbsd\" + +NetBSD. + =item \"openbsd\" OpenBSD. diff --git a/src/guestfs-internal.h b/src/guestfs-internal.h index c8dd084..0a4a6f2 100644 --- a/src/guestfs-internal.h +++ b/src/guestfs-internal.h @@ -543,6 +543,8 @@ enum inspect_os_distro { OS_DISTRO_SLES, OS_DISTRO_OPENBSD, OS_DISTRO_ORACLE_LINUX, + OS_DISTRO_FREEBSD, + OS_DISTRO_NETBSD, }; enum inspect_os_package_format { diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c index b1a2f8f..ff6a156 100644 --- a/src/inspect-fs-unix.c +++ b/src/inspect-fs-unix.c @@ -591,6 +591,7 @@ int guestfs___check_freebsd_root (guestfs_h *g, struct inspect_fs *fs) { fs->type = OS_TYPE_FREEBSD; + fs->distro = OS_DISTRO_FREEBSD; /* FreeBSD has no authoritative version file. The version number is * in /etc/motd, which the system administrator might edit, but @@ -634,6 +635,7 @@ guestfs___check_netbsd_root (guestfs_h *g, struct inspect_fs *fs) if (match2 (g, fs->product_name, re_netbsd, &major, &minor)) { fs->type = OS_TYPE_NETBSD; + fs->distro = OS_DISTRO_NETBSD; fs->major_version = guestfs___parse_unsigned_int (g, major); free (major); if (fs->major_version == -1) { diff --git a/src/inspect-fs.c b/src/inspect-fs.c index aaddb49..e9cc2e9 100644 --- a/src/inspect-fs.c +++ b/src/inspect-fs.c @@ -448,6 +448,8 @@ guestfs___check_package_format (guestfs_h *g, struct inspect_fs *fs) case OS_DISTRO_BUILDROOT: case OS_DISTRO_CIRROS: case OS_DISTRO_FREEDOS: + case OS_DISTRO_FREEBSD: + case OS_DISTRO_NETBSD: case OS_DISTRO_OPENBSD: case OS_DISTRO_UNKNOWN: fs->package_format = OS_PACKAGE_FORMAT_UNKNOWN; @@ -507,6 +509,8 @@ guestfs___check_package_management (guestfs_h *g, struct inspect_fs *fs) case OS_DISTRO_BUILDROOT: case OS_DISTRO_CIRROS: case OS_DISTRO_FREEDOS: + case OS_DISTRO_FREEBSD: + case OS_DISTRO_NETBSD: case OS_DISTRO_OPENBSD: case OS_DISTRO_UNKNOWN: fs->package_management = OS_PACKAGE_MANAGEMENT_UNKNOWN; diff --git a/src/inspect-icon.c b/src/inspect-icon.c index b1b3adf..a7318c6 100644 --- a/src/inspect-icon.c +++ b/src/inspect-icon.c @@ -178,6 +178,8 @@ guestfs__inspect_get_icon (guestfs_h *g, const char *root, size_t *size_r, case OS_DISTRO_SLACKWARE: case OS_DISTRO_TTYLINUX: case OS_DISTRO_WINDOWS: + case OS_DISTRO_FREEBSD: + case OS_DISTRO_NETBSD: case OS_DISTRO_OPENBSD: case OS_DISTRO_UNKNOWN: ; /* nothing */ diff --git a/src/inspect.c b/src/inspect.c index c3b88e1..bdb45c3 100644 --- a/src/inspect.c +++ b/src/inspect.c @@ -203,12 +203,14 @@ guestfs__inspect_get_distro (guestfs_h *g, const char *root) case OS_DISTRO_CIRROS: ret = safe_strdup (g, "cirros"); break; case OS_DISTRO_DEBIAN: ret = safe_strdup (g, "debian"); break; case OS_DISTRO_FEDORA: ret = safe_strdup (g, "fedora"); break; + case OS_DISTRO_FREEBSD: ret = safe_strdup (g, "freebsd"); break; case OS_DISTRO_FREEDOS: ret = safe_strdup (g, "freedos"); 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_NETBSD: ret = safe_strdup (g, "netbsd"); break; case OS_DISTRO_OPENBSD: ret = safe_strdup (g, "openbsd"); break; case OS_DISTRO_OPENSUSE: ret = safe_strdup (g, "opensuse"); break; case OS_DISTRO_ORACLE_LINUX: ret = safe_strdup (g, "oraclelinux"); break; diff --git a/src/osinfo.c b/src/osinfo.c index 3a6d342..aee3b8f 100644 --- a/src/osinfo.c +++ b/src/osinfo.c @@ -498,8 +498,12 @@ parse_distro (guestfs_h *g, xmlNodePtr node, struct osinfo *osinfo) osinfo->distro = OS_DISTRO_DEBIAN; else if (STREQ (content, "fedora")) osinfo->distro = OS_DISTRO_FEDORA; + else if (STREQ (content, "freebsd")) + osinfo->distro = OS_DISTRO_FREEBSD; else if (STREQ (content, "mandriva")) osinfo->distro = OS_DISTRO_MANDRIVA; + else if (STREQ (content, "netbsd")) + osinfo->distro = OS_DISTRO_NETBSD; else if (STREQ (content, "openbsd")) osinfo->distro = OS_DISTRO_OPENBSD; else if (STREQ (content, "opensuse")) -- 2.1.3
Apparently Analagous Threads
- [PATCH 4/4] Add freebsd and netbsd distros
- [PATCH] inspect: recognize the Frugalware distribution
- [PATCH 1/2] inspect: recognize the Alpine Linux distribution
- [PATCH 1/2] inspect: recognize the ALT Linux distribution
- [PATCH 2/3] inspection: Add support for CoreOS