summaryrefslogtreecommitdiffstats
path: root/perl-install/network.pm
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2000-09-07 16:43:32 +0000
committerdamien <damien@mandriva.com>2000-09-07 16:43:32 +0000
commit241ac866dc8d3d872aa7848eb0d56eb57cf82233 (patch)
treeeceaee6b940d6861516a41e40b3d58ec796a63f2 /perl-install/network.pm
parent412cc80224817af6d2b9374c0e1cb369c089a12e (diff)
downloaddrakx-241ac866dc8d3d872aa7848eb0d56eb57cf82233.tar
drakx-241ac866dc8d3d872aa7848eb0d56eb57cf82233.tar.gz
drakx-241ac866dc8d3d872aa7848eb0d56eb57cf82233.tar.bz2
drakx-241ac866dc8d3d872aa7848eb0d56eb57cf82233.tar.xz
drakx-241ac866dc8d3d872aa7848eb0d56eb57cf82233.zip
updated
Diffstat (limited to 'perl-install/network.pm')
-rw-r--r--perl-install/network.pm13
1 files changed, 7 insertions, 6 deletions
diff --git a/perl-install/network.pm b/perl-install/network.pm
index 51d094e46..c9eaaf9ba 100644
--- a/perl-install/network.pm
+++ b/perl-install/network.pm
@@ -84,13 +84,14 @@ sub write_resolv_conf {
log::l("neither domain name nor dns server are configured");
return 0;
}
- my @l = cat_($file);
- local *F;
- open F, "> $file" or die "cannot write $file: $!";
- print F "search $netc->{DOMAINNAME}\n" if $netc->{DOMAINNAME};
- print F "nameserver $_\n" foreach dnsServers($netc);
- print F "#$_" foreach @l;
+ substInFile {
+ s/^([^#].*\n)/\#$1/;
+ if (eof) {
+ $_ .= "search $netc->{DOMAINNAME}\n" if $netc->{DOMAINNAME};
+ $_ .= "nameserver $_\n" foreach dnsServers($netc);
+ }
+ } $file;
#-res_init(); # reinit the resolver so DNS changes take affect
1;