diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-04-18 14:26:28 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-04-18 14:26:28 +0000 |
commit | dbd09b09f267654d104c66c31b6f32d026c8d23e (patch) | |
tree | 2316a4b675c669119bdcb0f2643d1a9a627c7af4 | |
parent | 2dde219f0709122cd8b2df78feff759e3cf0ce72 (diff) | |
download | drakx-dbd09b09f267654d104c66c31b6f32d026c8d23e.tar drakx-dbd09b09f267654d104c66c31b6f32d026c8d23e.tar.gz drakx-dbd09b09f267654d104c66c31b6f32d026c8d23e.tar.bz2 drakx-dbd09b09f267654d104c66c31b6f32d026c8d23e.tar.xz drakx-dbd09b09f267654d104c66c31b6f32d026c8d23e.zip |
configure wpa driver in drakconnect, wpa_supplicant init script is dropped
-rw-r--r-- | perl-install/network/netconnect.pm | 11 | ||||
-rw-r--r-- | perl-install/network/network.pm | 27 |
2 files changed, 25 insertions, 13 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index d95b01d47..c3fe7be8c 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -89,6 +89,7 @@ sub real_main { my ($isdn, $isdn_name, $isdn_type, %isdn_cards, @isdn_dial_methods); my $my_isdn = join('', N("Manual choice"), " (", N("Internal ISDN card"), ")"); my ($ndiswrapper_driver, $ndiswrapper_inf_file); + my $wireless_use_wpa; my ($module, $auto_ip, $protocol, $onboot, $needhostname, $peerdns, $peeryp, $peerntpd, $hotplug, $track_network_id); # lan config my $success = 1; my $ethntf = {}; @@ -1176,6 +1177,7 @@ notation (for example, 1.2.3.4).")), $netc->{wireless_eth} = 1; $ethntf->{WIRELESS_MODE} ||= "Managed"; $ethntf->{WIRELESS_ESSID} ||= "any"; + $wireless_use_wpa = exists $ethntf->{WIRELESS_WPA_DRIVER}; }, name => N("Please enter the wireless parameters for this card:"), data => sub { @@ -1189,7 +1191,7 @@ notation (for example, 1.2.3.4).")), { label => N("Bitrate (in b/s)"), val => \$ethntf->{WIRELESS_RATE}, advanced => 1 }, { label => N("Encryption key"), val => \$ethntf->{WIRELESS_ENC_KEY} }, #- FIXME: ask if the access point is open or restricted - { text => N("Use Wi-Fi Protected Access (WPA)"), val => \$ethntf->{WIRELESS_USE_WPA}, type => "bool" }, + { text => N("Use Wi-Fi Protected Access (WPA)"), val => \$wireless_use_wpa, type => "bool" }, ]; }, complete => sub { @@ -1255,7 +1257,12 @@ See iwpriv(8) man page for further information."), # untranslate parameters $ethntf->{WIRELESS_MODE} = $wireless_mode{$ethntf->{WIRELESS_MODE}}; $module =~ /^prism2_/ and network::network::wlan_ng_configure($in, $ethntf, $module); - network::network::wpa_supplicant_configure($in, $ethntf); + if ($wireless_use_wpa) { + $ethntf->{WIRELESS_WPA_DRIVER} = network::network::wpa_supplicant_get_driver($module); + network::network::wpa_supplicant_configure($in, $ethntf); + } else { + delete $ethntf->{WIRELESS_WPA_DRIVER}; + } return "static_hostname"; }, }, diff --git a/perl-install/network/network.pm b/perl-install/network/network.pm index eb12ba63a..cfd40b9a5 100644 --- a/perl-install/network/network.pm +++ b/perl-install/network/network.pm @@ -163,7 +163,7 @@ sub write_interface_conf { } setVarsInSh($file, $intf, qw(DEVICE BOOTPROTO IPADDR NETMASK NETWORK BROADCAST ONBOOT HWADDR METRIC MII_NOT_SUPPORTED TYPE USERCTL ATM_ADDR), - qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV), + qw(WIRELESS_MODE WIRELESS_ESSID WIRELESS_NWID WIRELESS_FREQ WIRELESS_SENS WIRELESS_RATE WIRELESS_ENC_KEY WIRELESS_RTS WIRELESS_FRAG WIRELESS_IWCONFIG WIRELESS_IWSPY WIRELESS_IWPRIV WIRELESS_WPA_DRIVER), if_($intf->{BOOTPROTO} eq "dhcp", qw(DHCP_CLIENT DHCP_HOSTNAME NEEDHOSTNAME PEERDNS PEERYP PEERNTPD DHCP_TIMEOUT)), if_($intf->{DEVICE} =~ /^ippp\d+$/, qw(DIAL_ON_IFUP)) ); @@ -527,22 +527,27 @@ sub wlan_ng_configure { services::restart($module eq 'prism2_cs' ? 'pcmcia' : 'wlan'); } +sub wpa_supplicant_get_driver { + my ($module) = @_; + $module =~ /^hostap_/ ? "hostap" : + $module eq "prism54" ? "prism54" : + $module =~ /^ath_/ ? "madwifi" : + $module =~ /^at76c50|atmel_/ ? "atmel" : + $module eq "ndiswrapper" ? "ndiswrapper" : + $module =~ /^ipw2[12]00$/ ? "ipw" : + "wext"; +} + 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({ + $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}), scan_ssid => 1, - }); - services::start_service_on_boot('wpa_supplicant'); - services::restart('wpa_supplicant'); - } else { - services::stop('wpa_supplicant'); - services::do_not_start_service_on_boot('wpa_supplicant'); - } + }); } sub wpa_supplicant_add_network { |