summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--lib/network/network.pm3
2 files changed, 6 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 5116780..0e899c4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- hostname: update the /etc/hostname (new x-distro standard) file on hostname
+ change (#2983)
+
1.2:
- wireless scan: use programs from prefix, not installer root (#1452)
diff --git a/lib/network/network.pm b/lib/network/network.pm
index 565e438..1f7e79f 100644
--- a/lib/network/network.pm
+++ b/lib/network/network.pm
@@ -15,6 +15,7 @@ use vars qw(@ISA @EXPORT);
use log;
our $network_file = "/etc/sysconfig/network";
+my $hostname_file = "/etc/hostname";
my $resolv_file = "/etc/resolv.conf";
my $tmdns_file = "/etc/tmdns.conf";
our $wireless_d = "/etc/sysconfig/network-scripts/wireless.d";
@@ -107,6 +108,7 @@ sub write_network_conf {
$net->{network}{NETWORKING} = 'yes';
setVarsInSh($::prefix . $network_file, $net->{network}, qw(HOSTNAME NETWORKING GATEWAY GATEWAYDEV NISDOMAIN FORWARD_IPV4 NETWORKING_IPV6 IPV6_DEFAULTDEV CRDA_DOMAIN));
+ output($::prefix . $hostname_file, $net->{network}{HOSTNAME} || "localhost");
}
sub write_zeroconf {
@@ -290,6 +292,7 @@ sub write_hostname {
my ($hostname) = @_;
addVarsInSh($::prefix . $network_file, { HOSTNAME => $hostname }, qw(HOSTNAME));
+ output($::prefix . $hostname_file, $hostname || "localhost");
add2hosts("localhost", "127.0.0.1");
add2hosts($hostname, "127.0.0.1") if $hostname;