summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-11-30 12:32:30 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-11-30 12:37:48 +0000
commitf5ae46dca79511cf2d4762ca4ef07b59bd647309 (patch)
tree7fe5861a5a8519a1623d18737a556986d1faaea0 /src
parentfe4cdb2a477e88cd65d418aa3c3f12cb029f3dde (diff)
downloadlibguestfs-f5ae46dca79511cf2d4762ca4ef07b59bd647309.tar.gz
libguestfs-f5ae46dca79511cf2d4762ca4ef07b59bd647309.tar.xz
libguestfs-f5ae46dca79511cf2d4762ca4ef07b59bd647309.zip
inspection, virt-sysprep: Use /etc/hostname on F18+, RHEL7+ (RHBZ#881953, RHBZ#858696).
Diffstat (limited to 'src')
-rw-r--r--src/inspect-fs-unix.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/inspect-fs-unix.c b/src/inspect-fs-unix.c
index a48d1768..8d3e6b08 100644
--- a/src/inspect-fs-unix.c
+++ b/src/inspect-fs-unix.c
@@ -748,11 +748,11 @@ check_hostname_unix (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
- * these files in turn, rather than try anything clever based on
- * distro.
+ /* Red Hat-derived would be in /etc/sysconfig/network or
+ * /etc/hostname (RHEL 7+, F18+). Debian-derived in the file
+ * /etc/hostname. Very old Debian and SUSE use /etc/HOSTNAME.
+ * It's best to just look for each of these files in turn, rather
+ * than try anything clever based on distro.
*/
if (guestfs_is_file (g, "/etc/HOSTNAME")) {
fs->hostname = guestfs___first_line_of_file (g, "/etc/HOSTNAME");
@@ -803,8 +803,9 @@ check_hostname_unix (guestfs_h *g, struct inspect_fs *fs)
return 0;
}
-/* Parse the hostname from /etc/sysconfig/network. This must be called
- * from the inspect_with_augeas wrapper.
+/* Parse the hostname from /etc/sysconfig/network. This must be
+ * called from the inspect_with_augeas wrapper. Note that F18+ and
+ * RHEL7+ use /etc/hostname just like Debian.
*/
static int
check_hostname_redhat (guestfs_h *g, struct inspect_fs *fs)