diff options
author | Colin Guthrie <colin@mageia.org> | 2012-01-04 11:05:26 +0000 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2012-01-04 11:05:26 +0000 |
commit | 614ccfe502a93d8cb80775a53c244d743240019f (patch) | |
tree | de0d4f923bb36f1beecfe1b1755d08a1c455b3a2 /lib/network/network.pm | |
parent | e77b65225409b8d3367e46e0abafce9d14a0c978 (diff) | |
download | drakx-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)
Diffstat (limited to 'lib/network/network.pm')
-rw-r--r-- | lib/network/network.pm | 3 |
1 files changed, 3 insertions, 0 deletions
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; |