NetBSD.
+=item \"hurd\"
+
+GNU/Hurd.
+
=item \"unknown\"
The operating system type could not be determined.
FS_CONTENT_FREEBSD_ROOT,
FS_CONTENT_NETBSD_ROOT,
FS_CONTENT_INSTALLER,
+ FS_CONTENT_HURD_ROOT,
};
enum inspect_os_format {
OS_TYPE_WINDOWS,
OS_TYPE_FREEBSD,
OS_TYPE_NETBSD,
+ OS_TYPE_HURD,
};
enum inspect_os_distro {
extern int guestfs___check_linux_root (guestfs_h *g, struct inspect_fs *fs);
extern int guestfs___check_freebsd_root (guestfs_h *g, struct inspect_fs *fs);
extern int guestfs___check_netbsd_root (guestfs_h *g, struct inspect_fs *fs);
+extern int guestfs___check_hurd_root (guestfs_h *g, struct inspect_fs *fs);
extern int guestfs___has_windows_systemroot (guestfs_h *g);
extern int guestfs___check_windows_root (guestfs_h *g, struct inspect_fs *fs);
#endif
char *ret;
switch (fs->type) {
case OS_TYPE_FREEBSD: ret = safe_strdup (g, "freebsd"); break;
+ case OS_TYPE_HURD: ret = safe_strdup (g, "hurd"); break;
case OS_TYPE_LINUX: ret = safe_strdup (g, "linux"); break;
case OS_TYPE_NETBSD: ret = safe_strdup (g, "netbsd"); break;
case OS_TYPE_WINDOWS: ret = safe_strdup (g, "windows"); break;
if (fs->format == OS_FORMAT_INSTALLED) {
switch (fs->type) {
case OS_TYPE_LINUX:
+ case OS_TYPE_HURD:
switch (fs->package_format) {
case OS_PACKAGE_FORMAT_RPM:
#ifdef DB_DUMP
if (guestfs___check_netbsd_root (g, fs) == -1)
return -1;
}
+ /* Hurd root? */
+ else if (guestfs_is_file (g, "/hurd/console") > 0 &&
+ guestfs_is_file (g, "/hurd/hello") > 0 &&
+ guestfs_is_file (g, "/hurd/null") > 0) {
+ fs->is_root = 1;
+ fs->content = FS_CONTENT_HURD_ROOT;
+ fs->format = OS_FORMAT_INSTALLED; /* XXX could be more specific */
+ if (guestfs___check_hurd_root (g, fs) == -1)
+ return -1;
+ }
/* Linux root? */
else if (is_dir_etc &&
is_dir_bin &&
return 0;
}
+/* The currently mounted device may be a Hurd root. Hurd has distros
+ * just like Linux.
+ */
+int
+guestfs___check_hurd_root (guestfs_h *g, struct inspect_fs *fs)
+{
+ int r;
+
+ fs->type = OS_TYPE_HURD;
+
+ if (guestfs_exists (g, "/etc/debian_version") > 0) {
+ fs->distro = OS_DISTRO_DEBIAN;
+
+ if (parse_release_file (g, fs, "/etc/debian_version") == -1)
+ return -1;
+
+ if (guestfs___parse_major_minor (g, fs) == -1)
+ return -1;
+ }
+
+ /* Arch Hurd also exists, but inconveniently it doesn't have
+ * the normal /etc/arch-release file. XXX
+ */
+
+ /* Determine the architecture. */
+ check_architecture (g, fs);
+
+ /* XXX Check for /etc/fstab. */
+
+ /* Determine hostname. */
+ if (check_hostname_unix (g, fs) == -1)
+ return -1;
+
+ return 0;
+}
static void
check_architecture (guestfs_h *g, struct inspect_fs *fs)
{
switch (fs->type) {
case OS_TYPE_LINUX:
+ case OS_TYPE_HURD:
/* Red Hat-derived would be in /etc/sysconfig/network, and
* Debian-derived in the file /etc/hostname. Very old Debian and
* SUSE use /etc/HOSTNAME. It's best to just look for each of
*/
switch (fs->type) {
case OS_TYPE_LINUX:
+ case OS_TYPE_HURD:
switch (fs->distro) {
case OS_DISTRO_FEDORA:
r = icon_fedora (g, fs, &size);