diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-02-24 17:32:10 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-02-24 17:32:10 +0000 |
commit | 0c79fff50fec0ee6b462b4654cc845f718da7a2f (patch) | |
tree | 31d60979bf6f5c3073bb0da92935413b35ae43b0 /perl-install/network/network.pm | |
parent | 4ae35537d7361c603756b81ccce5c4ac5072f73e (diff) | |
download | drakx-backup-do-not-use-0c79fff50fec0ee6b462b4654cc845f718da7a2f.tar drakx-backup-do-not-use-0c79fff50fec0ee6b462b4654cc845f718da7a2f.tar.gz drakx-backup-do-not-use-0c79fff50fec0ee6b462b4654cc845f718da7a2f.tar.bz2 drakx-backup-do-not-use-0c79fff50fec0ee6b462b4654cc845f718da7a2f.tar.xz drakx-backup-do-not-use-0c79fff50fec0ee6b462b4654cc845f718da7a2f.zip |
minimal WPA support
Diffstat (limited to 'perl-install/network/network.pm')
-rw-r--r-- | perl-install/network/network.pm | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index ff1641d75..c604945b6 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -521,6 +521,23 @@ sub wlan_ng_configure { services::restart($module eq 'prism2_cs' ? 'pcmcia' : 'wlan'); } +sub wpa_supplicant_configure { + my ($in, $ethntf) = @_; + require services; + if (delete $ethntf->{WIRELESS_USE_WPA}) { + $in->do_pkgs->install('wpa_supplicant'); + wpa_supplicant_add_network({ + ssid => qq("$ethntf->{WIRELESS_ESSID}"), + psk => network::tools::convert_key_for_wpa_supplicant($ethntf->{WIRELESS_ENC_KEY}), + }); + services::start_service_on_boot("tmdns"); + services::restart('wpa_supplicant'); + } else { + services::stop("tmdns"); + services::do_not_start_service_on_boot("tmdns"); + } +} + sub wpa_supplicant_add_network { my ($new_network) = @_; my $wpa_supplicant_conf = "$::prefix/etc/wpa_supplicant.conf"; @@ -529,12 +546,12 @@ sub wpa_supplicant_add_network { foreach (cat_($wpa_supplicant_conf)) { if (%network) { #- in a "network = {}" block - if (/^\s*(\w+)\s*=\s*(.*?)(\s*#.*)?$/) { + if (/^\s*(\w+)=(.*?)(\s*#.*)?$/) { push @{$network{entries}}, { key => $1, value => $2, comment => $3 }; $1 eq 'ssid' and $network{ssid} = $2; } elsif (/^·*\}/) { #- end of network block, write it - $s .= "network = { $network{comment}\n"; + $s .= "network={$network{comment}\n"; my $update = $network{ssid} eq $new_network->{ssid}; foreach (@{$network{entries}}) { my $key = $_->{key}; @@ -545,14 +562,14 @@ sub wpa_supplicant_add_network { $_->{value} = delete $new_network->{$key}; } if ($key) { - $s .= " $key = $_->{value}$_->{comment}\n"; + $s .= " $key=$_->{value}$_->{comment}\n"; } else { $s .= " $_->{comment}\n"; } } if ($update) { while (my ($key, $value) = each(%$new_network)) { - $s .= " $key = $value\n"; + $s .= " $key=$value\n"; } } $s .= "}\n"; @@ -563,7 +580,7 @@ sub wpa_supplicant_add_network { push @{$network{entries}}, { comment => $_ }; } } else { - if (/^\s*network\s*=\s*\{(.*)/) { + if (/^\s*network={(.*)/) { #- beginning of a new network block $network{comment} = $1; } else { @@ -574,13 +591,13 @@ sub wpa_supplicant_add_network { } if ($new_network) { #- network wasn't found, write it - $s .= "\nnetwork = {\n"; + $s .= "\nnetwork={\n"; #- write ssid first if (my $ssid = delete $new_network->{ssid}) { - $s .= " ssid = $ssid\n"; + $s .= " ssid=$ssid\n"; } while (my ($key, $value) = each(%$new_network)) { - $s .= " $key = $value\n"; + $s .= " $key=$value\n"; } $s .= "}\n"; } |