summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2012-01-04 11:05:26 +0000
committerColin Guthrie <colin@mageia.org>2012-01-04 11:05:26 +0000
commit614ccfe502a93d8cb80775a53c244d743240019f (patch)
treede0d4f923bb36f1beecfe1b1755d08a1c455b3a2
parente77b65225409b8d3367e46e0abafce9d14a0c978 (diff)
downloaddrakx-net-614ccfe502a93d8cb80775a53c244d743240019f.tar
drakx-net-614ccfe502a93d8cb80775a53c244d743240019f.tar.gz
drakx-net-614ccfe502a93d8cb80775a53c244d743240019f.tar.bz2
drakx-net-614ccfe502a93d8cb80775a53c244d743240019f.tar.xz
drakx-net-614ccfe502a93d8cb80775a53c244d743240019f.zip
hostname: update the /etc/hostname (new x-distro standard) file on hostname change (#2983)
-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;