diff options
author | Olivier Blin <oblin@mandriva.org> | 2004-10-04 05:56:19 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2004-10-04 05:56:19 +0000 |
commit | 624d2d81fbd74ae5b20eb310c1c7a60877a066a4 (patch) | |
tree | fbdfdac55ee29278d953f6b2d9c9ef28f7b1ad2a | |
parent | a5c33431a321475c547a659f88dc9df6ac305c69 (diff) | |
download | drakx-backup-do-not-use-624d2d81fbd74ae5b20eb310c1c7a60877a066a4.tar drakx-backup-do-not-use-624d2d81fbd74ae5b20eb310c1c7a60877a066a4.tar.gz drakx-backup-do-not-use-624d2d81fbd74ae5b20eb310c1c7a60877a066a4.tar.bz2 drakx-backup-do-not-use-624d2d81fbd74ae5b20eb310c1c7a60877a066a4.tar.xz drakx-backup-do-not-use-624d2d81fbd74ae5b20eb310c1c7a60877a066a4.zip |
write wlan-ng config files for prism2 drivers
-rw-r--r-- | perl-install/network/netconnect.pm | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/perl-install/network/netconnect.pm b/perl-install/network/netconnect.pm index afc205a92..a1a09920c 100644 --- a/perl-install/network/netconnect.pm +++ b/perl-install/network/netconnect.pm @@ -1102,6 +1102,46 @@ See iwpriv(8) man page for further information."), post => sub { # untranslate parameters $ethntf->{WIRELESS_MODE} = $wireless_mode{$ethntf->{WIRELESS_MODE}}; + if ($module =~ /^prism2_/) { + $in->do_pkgs->install('prism2-utils'); + if ($ethntf->{WIRELESS_ESSID}) { + my $update_vars_in_wlan = sub { #- FIXME: to be improved (quotes, comments) and moved in common files + my ($file, $vars) = @_; + substInFile { + while (my ($key, $value) = each(%$vars)) { + s/^#?\Q$key\E=(?:"[^#]*"|[^#\s]*)(\s*#.*)?/$key=$value$1/ and delete $vars->{$key}; + } + $_ .= join('', map { "$_=$vars->{$_}\n" } keys %$vars) if eof; + } $file; + }; + my $wlan_conf_file = "$::prefix/etc/wlan/wlan.conf"; + my @wlan_devices = split(/ /, (cat_($wlan_conf_file) =~ /^WLAN_DEVICES="(.*)"/m)[0]); + push @wlan_devices, $ethntf->{DEVICE} unless member($ethntf->{DEVICE}, @wlan_devices); + #- enable device and make it use the choosen ESSID + $update_vars_in_wlan->($wlan_conf_file, + { + WLAN_DEVICES => qq("@wlan_devices"), + "SSID_$ethntf->{DEVICE}" => qq("$ethntf->{WIRELESS_ESSID}"), + "ENABLE_$ethntf->{DEVICE}" => "y" + }); + my $wlan_ssid_file = "$::prefix/etc/wlan/wlancfg-$ethntf->{WIRELESS_ESSID}"; + #- copy default settings for this ESSID if config file doesn't exist + -f $wlan_ssid_file or cp_f("$::prefix/etc/wlan/wlancfg-DEFAULT", $wlan_ssid_file); + #- enable/disable encryption + $update_vars_in_wlan->($wlan_ssid_file, + { + (map { $_ => $ethntf->{WIRELESS_ENC_KEY} ? "true" : "false" } qw(lnxreq_hostWEPEncrypt lnxreq_hostWEPDecrypt dot11PrivacyInvoked dot11ExcludeUnencrypted)), + AuthType => $ethntf->{WIRELESS_ENC_KEY} ? qq("sharedkey") : qq("opensystem"), + if_($ethntf->{WIRELESS_ENC_KEY}, + dot11WEPDefaultKeyID => 0, + dot11WEPDefaultKey0 => qq("$ethntf->{WIRELESS_ENC_KEY}") + ) + }); + #- apply settings on wlan interface + require services; + services::restart($module eq 'prism2_cs' ? 'pcmcia' : 'wlan'); + } + } return "static_hostname"; }, }, |