diff --git a/net/CHANGELOG b/net/CHANGELOG index 4fc25bcc2..ec9a35664 100644 --- a/net/CHANGELOG +++ b/net/CHANGELOG @@ -48,3 +48,4 @@ When changing the hostname on Debian or Ubuntu, update /etc/mailname too. Fixed editing of bonding network interfaces on Debian Linux. ---- Changes since 1.480 ---- Fixed network interface management on SuSE 10.2. +Updated the Hostname and DNS Client page to always show the hostname from config files, rather than the system's short hostname. diff --git a/net/debian-linux-lib.pl b/net/debian-linux-lib.pl index 5910d0114..519e00a1a 100644 --- a/net/debian-linux-lib.pl +++ b/net/debian-linux-lib.pl @@ -350,6 +350,11 @@ return &check_ipaddress_any($_[0]); # get_hostname() sub get_hostname { +local $hn = &read_file_contents("/etc/hostname"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } return &get_system_hostname(1); } diff --git a/net/freebsd-lib.pl b/net/freebsd-lib.pl index 80dd0f00a..16ff885b5 100644 --- a/net/freebsd-lib.pl +++ b/net/freebsd-lib.pl @@ -452,6 +452,10 @@ else { # get_hostname() sub get_hostname { +local %rc = &get_rc_conf(); +if ($rc{'hostname'}) { + return $rc{'hostname'}; + } return &get_system_hostname(); } diff --git a/net/gentoo-linux-lib.pl b/net/gentoo-linux-lib.pl index 3f9078a9a..d76c99c7f 100644 --- a/net/gentoo-linux-lib.pl +++ b/net/gentoo-linux-lib.pl @@ -261,6 +261,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local %host; +&read_env_file("/etc/conf.d/hostname", \%host); +if ($host{'HOSTNAME'}) { + return $host{'HOSTNAME'}; + } return &get_system_hostname(1); } diff --git a/net/macos-lib.pl b/net/macos-lib.pl index a9c512208..468e811ec 100644 --- a/net/macos-lib.pl +++ b/net/macos-lib.pl @@ -370,6 +370,10 @@ return undef; # get_hostname() sub get_hostname { +local $hc = &read_hostconfig(); +if ($hc->{'HOSTNAME'}) { + return $hc->{'HOSTNAME'}; + } return &get_system_hostname(); } diff --git a/net/open-linux-lib.pl b/net/open-linux-lib.pl index b1d96b14d..f7daadc7d 100644 --- a/net/open-linux-lib.pl +++ b/net/open-linux-lib.pl @@ -105,6 +105,11 @@ return &check_ipaddress($_[0]); sub get_hostname { +local %conf; +&read_env_file($network_config, \%conf); +if ($conf{'HOSTNAME'}) { + return $conf{'HOSTNAME'}; + } return &get_system_hostname(1); } diff --git a/net/openbsd-lib.pl b/net/openbsd-lib.pl index 8449d7f32..f32331e81 100644 --- a/net/openbsd-lib.pl +++ b/net/openbsd-lib.pl @@ -389,9 +389,14 @@ sub parse_order # get_hostname() sub get_hostname - { - return &get_system_hostname(); - } +{ +local $hn = &read_file_contents("/etc/myname"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } +return &get_system_hostname(); +} # save_hostname(name) sub save_hostname diff --git a/net/redhat-linux-lib.pl b/net/redhat-linux-lib.pl index c41b9bb4b..f5faa5727 100644 --- a/net/redhat-linux-lib.pl +++ b/net/redhat-linux-lib.pl @@ -205,6 +205,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local %conf; +&read_env_file($network_config, \%conf); +if ($conf{'HOSTNAME'}) { + return $conf{'HOSTNAME'}; + } return &get_system_hostname(1); } diff --git a/net/slackware-linux-9.1-ALL-lib.pl b/net/slackware-linux-9.1-ALL-lib.pl index ccb56ad9c..c97981168 100644 --- a/net/slackware-linux-9.1-ALL-lib.pl +++ b/net/slackware-linux-9.1-ALL-lib.pl @@ -254,6 +254,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local $hn = &read_file_contents("/etc/HOSTNAME"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } return &get_system_hostname(1); } diff --git a/net/slackware-linux-lib.pl b/net/slackware-linux-lib.pl index 4ab31abf3..60eceaa2a 100644 --- a/net/slackware-linux-lib.pl +++ b/net/slackware-linux-lib.pl @@ -216,6 +216,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local $hn = &read_file_contents("/etc/HOSTNAME"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } return &get_system_hostname(1); } diff --git a/net/solaris-lib.pl b/net/solaris-lib.pl index 33786615b..3c3d3d727 100644 --- a/net/solaris-lib.pl +++ b/net/solaris-lib.pl @@ -296,6 +296,11 @@ else { # get_hostname() sub get_hostname { +local $hn = &read_file_contents("/etc/nodename"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } return &get_system_hostname(); } diff --git a/net/suse-linux-9.0-lib.pl b/net/suse-linux-9.0-lib.pl index 4bb3176d9..74b353af1 100644 --- a/net/suse-linux-9.0-lib.pl +++ b/net/suse-linux-9.0-lib.pl @@ -151,6 +151,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local $hn = &read_file_contents("/etc/HOSTNAME"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } return &get_system_hostname(1); } diff --git a/net/suse-linux-9.2-ALL-lib.pl b/net/suse-linux-9.2-ALL-lib.pl index 20a40e4ed..6d0af4469 100644 --- a/net/suse-linux-9.2-ALL-lib.pl +++ b/net/suse-linux-9.2-ALL-lib.pl @@ -237,6 +237,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local $hn = &read_file_contents("/etc/HOSTNAME"); +$hn =~ s/\r|\n//g; +if ($hn) { + return $hn; + } return &get_system_hostname(1); } diff --git a/net/united-linux-lib.pl b/net/united-linux-lib.pl index f5f4dc575..c2aee5e90 100644 --- a/net/united-linux-lib.pl +++ b/net/united-linux-lib.pl @@ -110,6 +110,11 @@ return &check_ipaddress($_[0]); # get_hostname() sub get_hostname { +local %conf; +&read_env_file($network_config, \%conf); +if ($conf{'HOSTNAME'}) { + return $conf{'HOSTNAME'}; + } return &get_system_hostname(1); }