summaryrefslogtreecommitdiffstats
path: root/dhcp_wizard
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-10-17 16:54:53 +0000
committerThierry Vignaud <tv@mageia.org>2012-10-17 16:54:53 +0000
commit6fcca62e9e80e8a14d410b361c7593a02b4e96ed (patch)
treec25b9962759fd762798955a0945b4f6ed5e7dce1 /dhcp_wizard
parent591f339e3a342e1f53ba073af903f45720a5af09 (diff)
downloaddrakwizard-6fcca62e9e80e8a14d410b361c7593a02b4e96ed.tar
drakwizard-6fcca62e9e80e8a14d410b361c7593a02b4e96ed.tar.gz
drakwizard-6fcca62e9e80e8a14d410b361c7593a02b4e96ed.tar.bz2
drakwizard-6fcca62e9e80e8a14d410b361c7593a02b4e96ed.tar.xz
drakwizard-6fcca62e9e80e8a14d410b361c7593a02b4e96ed.zip
simplify this mess
Diffstat (limited to 'dhcp_wizard')
-rwxr-xr-xdhcp_wizard/Dhcp.pm19
1 files changed, 9 insertions, 10 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm
index 23fd555f..526aac54 100755
--- a/dhcp_wizard/Dhcp.pm
+++ b/dhcp_wizard/Dhcp.pm
@@ -211,17 +211,16 @@ sub do_it {
standalone::explanations("now patching etc/sysconfig/dhcpd");
if (!`grep INTERFACES $file`) {
my $tmp = `/bin/mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!";
- open(my $NEW, "> $tmp") or die "can't open $tmp: $!";
- foreach (cat_or_die($file)) {
- if (m|INTERFACE|) {
- print $NEW "# $_";
- }
- # FIXME: we probably lack a "else":
- print $NEW $_;
- }
- MDK::Common::append_to_file($tmp, "\n# Added by drakwizard\nINTERFACES=$wiz_device");
- close($NEW);
chomp($tmp);
+ output($tmp,
+ (map {
+ if (m|INTERFACE|) {
+ "# $_";
+ }
+ # FIXME: we probably lack a "else":
+ $_;
+ } cat_or_die($file)),
+ "\n# Added by drakwizard\nINTERFACES=$wiz_device");
system("mv $tmp $file");
}
$file = "/etc/dhcpd.conf";