summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakroam
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.org>2004-08-11 15:40:50 +0000
committerOlivier Blin <oblin@mandriva.org>2004-08-11 15:40:50 +0000
commitd375cd72acbcf57dd99a50db11923ed1543f7df2 (patch)
treeb42cf71e0c181bc48fc6cbe6b36f4b2a03b07071 /perl-install/standalone/drakroam
parentb6872479918dc3d2cb98f6774d79771187ef1ab6 (diff)
downloaddrakx-d375cd72acbcf57dd99a50db11923ed1543f7df2.tar
drakx-d375cd72acbcf57dd99a50db11923ed1543f7df2.tar.gz
drakx-d375cd72acbcf57dd99a50db11923ed1543f7df2.tar.bz2
drakx-d375cd72acbcf57dd99a50db11923ed1543f7df2.tar.xz
drakx-d375cd72acbcf57dd99a50db11923ed1543f7df2.zip
rewrite write_config for wlandetect to use output()
Diffstat (limited to 'perl-install/standalone/drakroam')
-rwxr-xr-xperl-install/standalone/drakroam34
1 files changed, 13 insertions, 21 deletions
diff --git a/perl-install/standalone/drakroam b/perl-install/standalone/drakroam
index e46de2454..62fb08a4c 100755
--- a/perl-install/standalone/drakroam
+++ b/perl-install/standalone/drakroam
@@ -75,29 +75,21 @@ my %available_roaming_daemons = (
},
write_config => sub {
my ($config) = @_;
- open(my $CONFIG, "> $config") or die("Can't open configuration file\n");
- print $CONFIG "#wlandetect configuration file\n#format: essid<tab><tab>commands\n#use \@DEV\@ for device name\n";
+ my @contents = (
+ "#wlandetect configuration file\n",
+ "#format: essid<tab><tab>commands\n",
+ "#use \@DEV\@ for device name\n"
+ );
foreach my $row (@{$KnownList->{data}}) { # again, lame
- print $CONFIG "$row->[0]\t\t$IWConfig essid $row->[0]";
- if ($row->[1]) {
- print $CONFIG "mode $row->[1] ";
- }
- if ($row->[2]) {
- print $CONFIG "channel $row->[2] ";
- }
- if ($row->[3]) {
- print $CONFIG "key $row->[3] ";
- }
- print $CONFIG "; ";
- if ($row->[4]) {
- print $CONFIG "$IFConfig \@DEV\@ up; $DHClient \@DEV\@";
- }
- else {
- print $CONFIG "$IFUp \@DEV\@"
- }
- print $CONFIG "\n";
+ my $essid = $row->[0];
+ my $iwc = join(' ', $IWConfig, "essid $essid",
+ if_($row->[1], "mode $row->[1]"),
+ if_($row->[2], "channel $row->[2]"),
+ if_($row->[3], "key $row->[3]"));
+ my $ifc = $row->[4] ? "$IFConfig \@DEV\@ up; $DHClient \@DEV\@" : "$IFUp \@DEV\@";
+ push @contents, "$essid\t\t$iwc; $ifc\n";
}
- close $CONFIG;
+ output($config, @contents);
},
},
);