wok-current rev 1941
tazndis, Ask for starting at boot timeadd. Add CHANGELOG file.
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Sat Dec 27 22:07:42 2008 +0100 (2008-12-27) |
parents | ef142acb45e8 |
children | 8c110ce7ce64 |
files | tazndis/stuff/CHANGELOG tazndis/stuff/tazndis |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tazndis/stuff/CHANGELOG Sat Dec 27 22:07:42 2008 +0100 1.3 @@ -0,0 +1,10 @@ 1.4 +2008-12-27 Eric Jsoeph-Alexandre <erjoslitaz.org> 1.5 + 1.6 +* Add set_rcs_config, add ndiswrapper to LOAD_MODULES in /etc/rcS.conf. 1.7 + 1.8 +* Add load_ndiswrapper, load ndiswrapper kernel module. 1.9 + 1.10 +* set_net_config, set WIFI="yes" in /etc/network.conf. 1.11 + 1.12 +* new vars: $net_config, set network.conf path. 1.13 + $rcs_config, set rcS.conf path.
2.1 --- a/tazndis/stuff/tazndis Fri Dec 26 20:56:19 2008 +0000 2.2 +++ b/tazndis/stuff/tazndis Sat Dec 27 22:07:42 2008 +0100 2.3 @@ -26,6 +26,7 @@ 2.4 #* 2.5 #*/ 2.6 2.7 +$VERSION="1.53.1"; 2.8 $ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin"; 2.9 2.10 my $WRAP_PCI_BUS = 5; 2.11 @@ -45,7 +46,9 @@ 2.12 my $re_dev_conf = "$re_dev_id:$re_dev_id\.([[:xdigit:]]+)\.conf"; 2.13 2.14 my $rcs_config = "/etc/rcS.conf"; 2.15 -$rcs_config_change = 1; 2.16 +my $net_config = "/etc/network.conf"; 2.17 +my $config_change = 1; 2.18 + 2.19 2.20 # fixup list for parameters. 2.21 my %param_fixlist = ("EnableRadio|0" => "1", 2.22 @@ -66,6 +69,7 @@ 2.23 2.24 # "-D" is for development/debugging only 2.25 if ($ARGV[0] eq "-D") { 2.26 + my $dbg = true; 2.27 $dbg_file = "/tmp/ndiswrapper.dbg"; 2.28 $confdir = "/tmp/ndiswrapper"; 2.29 open(DBG, "> $dbg_file") or die "couldn't open $dbg_file: $!"; 2.30 @@ -194,6 +198,7 @@ 2.31 " by driver ('%s')!\n", $utils_version, $module_utils_version; 2.32 $res = -1; 2.33 } 2.34 + printf "tazndis version: %s\n ", $VERSION; 2.35 printf "utils version: '%s', utils version needed by module: '%s'\n", 2.36 $utils_version, $module_utils_version; 2.37 printf "module details:\n"; 2.38 @@ -209,32 +214,60 @@ 2.39 2.40 sub set_rcs_config { 2.41 # Add ndiswrapper to LOAD_MODULES if needed. 2.42 - open (RCS_CONF, "< $rcs_config") or die "couldn't open $rcs_config:$!"; 2.43 - open (RCS_CONF1, "> $rcs_config.tmp") or die "couldn't open $rcs_config.tmp for writting:$!"; 2.44 - LINE: while(<RCS_CONF>){ 2.45 + open (CONFIG, "< $rcs_config") or die "couldn't open $rcs_config:$!"; 2.46 + open (CONFIG1, "> $rcs_config.tmp") or die "couldn't open $rcs_config.tmp for writting:$!"; 2.47 + LINE: while(<CONFIG>){ 2.48 if(/^LOAD_MODULES/){ 2.49 if (!/^LOAD_MODULES=.*ndiswrapper/){ 2.50 print "Add ndiswrapper to module list...\n"; 2.51 $_ =~ s/(.*)\"$/$1 ndiswrapper\"/; 2.52 - $rcs_config_change = 0; 2.53 + $file_change = 0; 2.54 } 2.55 } 2.56 chomp; 2.57 - print RCS_CONF1 "$_\n"; 2.58 + print CONFIG1 "$_\n"; 2.59 } 2.60 - close RCS_CONF, RCS_CONF1; 2.61 + close CONFIG, CONFIG1; 2.62 2.63 - if($rcs_config_change == 0){ 2.64 + if($file_change == 0){ 2.65 rename "$rcs_config.tmp","$rcs_config" or die "couldn't update $rcs_config: $!"; 2.66 + $config_change=1; 2.67 } else { 2.68 unlink "$rcs_config.tmp"; 2.69 } 2.70 +} 2.71 + 2.72 +sub set_net_config { 2.73 + # 2.74 + open (CONFIG, "< $net_config") or die "couldn't open $net_config:$!"; 2.75 + open (CONFIG1, "> $net_config.tmp") or die "couldn't open $net_config.tmp for writting:$!"; 2.76 + print "Set WiFi to start at boot time...\n"; 2.77 + LINE: while(<CONFIG>){ 2.78 + if(/^WIFI=/){ 2.79 + if (/^WIFI="no"$/){ 2.80 + $_ =~ s/^WIFI="no"$/WIFI="yes"/; 2.81 + $config_change = 0; 2.82 + } 2.83 + } 2.84 + chomp; 2.85 + print CONFIG1 "$_\n"; 2.86 + } 2.87 + close CONFIG, CONFIG1; 2.88 2.89 + if($rcs_config_change == 0){ 2.90 + rename "$net_config.tmp","$net_config" or die "couldn't update $rcs_config: $!"; 2.91 + $config_change=1; 2.92 + } else { 2.93 + unlink "$net_config.tmp"; 2.94 + } 2.95 } 2.96 2.97 sub load_ndiswrapper { 2.98 open (LSMOD, " lsmod |") or die "couldn't get loaded module list: $!"; 2.99 - `modprobe ndiswrapper` unless (/^ndiswrapper/); 2.100 + if(!/^ndiswrapper/){ 2.101 + print "Loading ndiswrapper...\n"; 2.102 + `modprobe ndiswrapper`; 2.103 + } 2.104 } 2.105 2.106 sub install { 2.107 @@ -268,6 +301,12 @@ 2.108 set_rcs_config(); 2.109 load_ndiswrapper(); 2.110 2.111 + # Ask for WiFi at boot time. 2.112 + print "Would you to start WiFi at boot time [y/N]? "; 2.113 + chomp(my $answer = <STDIN>); 2.114 + if (lc($answer) eq "y") { 2.115 + set_net_config(); 2.116 + } 2.117 2.118 return 0; 2.119 }