# HG changeset patch # User Eric Joseph-Alexandre # Date 1230412062 -3600 # Node ID f9f8efc8b0a86160c5bdb3be253bc043d0cacd55 # Parent ef142acb45e8308be57bcad086b6637b6d2d8a4d tazndis, Ask for starting at boot timeadd. Add CHANGELOG file. diff -r ef142acb45e8 -r f9f8efc8b0a8 tazndis/stuff/CHANGELOG --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tazndis/stuff/CHANGELOG Sat Dec 27 22:07:42 2008 +0100 @@ -0,0 +1,10 @@ +2008-12-27 Eric Jsoeph-Alexandre + +* Add set_rcs_config, add ndiswrapper to LOAD_MODULES in /etc/rcS.conf. + +* Add load_ndiswrapper, load ndiswrapper kernel module. + +* set_net_config, set WIFI="yes" in /etc/network.conf. + +* new vars: $net_config, set network.conf path. + $rcs_config, set rcS.conf path. diff -r ef142acb45e8 -r f9f8efc8b0a8 tazndis/stuff/tazndis --- a/tazndis/stuff/tazndis Fri Dec 26 20:56:19 2008 +0000 +++ b/tazndis/stuff/tazndis Sat Dec 27 22:07:42 2008 +0100 @@ -26,6 +26,7 @@ #* #*/ +$VERSION="1.53.1"; $ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin"; my $WRAP_PCI_BUS = 5; @@ -45,7 +46,9 @@ my $re_dev_conf = "$re_dev_id:$re_dev_id\.([[:xdigit:]]+)\.conf"; my $rcs_config = "/etc/rcS.conf"; -$rcs_config_change = 1; +my $net_config = "/etc/network.conf"; +my $config_change = 1; + # fixup list for parameters. my %param_fixlist = ("EnableRadio|0" => "1", @@ -66,6 +69,7 @@ # "-D" is for development/debugging only if ($ARGV[0] eq "-D") { + my $dbg = true; $dbg_file = "/tmp/ndiswrapper.dbg"; $confdir = "/tmp/ndiswrapper"; open(DBG, "> $dbg_file") or die "couldn't open $dbg_file: $!"; @@ -194,6 +198,7 @@ " by driver ('%s')!\n", $utils_version, $module_utils_version; $res = -1; } + printf "tazndis version: %s\n ", $VERSION; printf "utils version: '%s', utils version needed by module: '%s'\n", $utils_version, $module_utils_version; printf "module details:\n"; @@ -209,32 +214,60 @@ sub set_rcs_config { # Add ndiswrapper to LOAD_MODULES if needed. - open (RCS_CONF, "< $rcs_config") or die "couldn't open $rcs_config:$!"; - open (RCS_CONF1, "> $rcs_config.tmp") or die "couldn't open $rcs_config.tmp for writting:$!"; - LINE: while(){ + open (CONFIG, "< $rcs_config") or die "couldn't open $rcs_config:$!"; + open (CONFIG1, "> $rcs_config.tmp") or die "couldn't open $rcs_config.tmp for writting:$!"; + LINE: while(){ if(/^LOAD_MODULES/){ if (!/^LOAD_MODULES=.*ndiswrapper/){ print "Add ndiswrapper to module list...\n"; $_ =~ s/(.*)\"$/$1 ndiswrapper\"/; - $rcs_config_change = 0; + $file_change = 0; } } chomp; - print RCS_CONF1 "$_\n"; + print CONFIG1 "$_\n"; } - close RCS_CONF, RCS_CONF1; + close CONFIG, CONFIG1; - if($rcs_config_change == 0){ + if($file_change == 0){ rename "$rcs_config.tmp","$rcs_config" or die "couldn't update $rcs_config: $!"; + $config_change=1; } else { unlink "$rcs_config.tmp"; } +} + +sub set_net_config { + # + open (CONFIG, "< $net_config") or die "couldn't open $net_config:$!"; + open (CONFIG1, "> $net_config.tmp") or die "couldn't open $net_config.tmp for writting:$!"; + print "Set WiFi to start at boot time...\n"; + LINE: while(){ + if(/^WIFI=/){ + if (/^WIFI="no"$/){ + $_ =~ s/^WIFI="no"$/WIFI="yes"/; + $config_change = 0; + } + } + chomp; + print CONFIG1 "$_\n"; + } + close CONFIG, CONFIG1; + if($rcs_config_change == 0){ + rename "$net_config.tmp","$net_config" or die "couldn't update $rcs_config: $!"; + $config_change=1; + } else { + unlink "$net_config.tmp"; + } } sub load_ndiswrapper { open (LSMOD, " lsmod |") or die "couldn't get loaded module list: $!"; - `modprobe ndiswrapper` unless (/^ndiswrapper/); + if(!/^ndiswrapper/){ + print "Loading ndiswrapper...\n"; + `modprobe ndiswrapper`; + } } sub install { @@ -268,6 +301,12 @@ set_rcs_config(); load_ndiswrapper(); + # Ask for WiFi at boot time. + print "Would you to start WiFi at boot time [y/N]? "; + chomp(my $answer = ); + if (lc($answer) eq "y") { + set_net_config(); + } return 0; }