Use /etc/hosts as alternative of /etc/fstab to detect whether a partition
represents the root of a Linux installation; the latter might not exist
in smaller/special installations like Docker images.
---
Repost (refreshed) of
https://www.redhat.com/archives/libguestfs/2016-February/msg00207.html
src/inspect-fs.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/inspect-fs.c b/src/inspect-fs.c
index 7f7d5d1..e9976cf 100644
--- a/src/inspect-fs.c
+++ b/src/inspect-fs.c
@@ -217,7 +217,8 @@ check_filesystem (guestfs_h *g, const char *mountable,
else if (is_dir_etc &&
(is_dir_bin ||
is_symlink_to (g, "/bin", "usr/bin") > 0) &&
- guestfs_is_file (g, "/etc/fstab") > 0) {
+ (guestfs_is_file (g, "/etc/fstab") > 0 ||
+ guestfs_is_file (g, "/etc/hosts") > 0)) {
fs->is_root = 1;
fs->format = OS_FORMAT_INSTALLED;
if (guestfs_int_check_linux_root (g, fs) == -1)
--
2.5.5