sbp wrote:
> Hi Randy.
>
> I tried to use your set_wifi.sh file, but I have a small problem.
>
> I hope you have a good idea.
> Steen
Hello Steen. It was interesting in trying to troubleshoot. It seems
that the field separator rules work differently in x86 versus ARM
environments (or at least that was one difference I could see right off
the start). I should always test in the RPi environment to make sure
before throwing something out there. I had to pick a character that
would allow for the explicit delimiting of the return string from AWK.
I chose the "+" sign. It could be most any other character if you think
there is a risk for SSID and password to contain "+".
I was able to quickly test with your default wifi.db (contains the
Steens\ 2.4GHz parm) and verify that it would work for the config.cfg
file translation. I have to make another appointment now, but tomorrow
I should be able to bring up another AP and exercise with "spaced out"
SSIDs. In the mean time, take a look at this and try it in your
environment.
Code:
--------------------
#!/bin/sh
alias awk="busybox awk"
IFS=+
CONFIG=/usr/local/sbin/config.cfg
read TCUSER < /etc/sysconfig/tcuser
DB=/home/"$TCUSER"/wifi.db
set -- $(echo "" | awk -v dbfile="$DB" '
BEGIN {
getline dbitem < dbfile
split(dbitem,field,"\t")
ssid = field[1]
passwd = field[2]
enc = field[3]
close(dbfile)
}
END {
print( "\"" ssid "\"" "+" "\"" passwd "\"" "+" "\"" enc "\"" )
} ' )
sudo sed -i "s/\(SSID *=*\).*/\1$1/" $CONFIG
sudo sed -i "s/\(PASSWORD *=*\).*/\1$2/" $CONFIG
sudo sed -i "s/\(ENCRYPTION *=*\).*/\1$3/" $CONFIG
--------------------
------------------------------------------------------------------------
mcdudeabides's Profile: http://forums.slimdevices.com/member.php?userid=57765
View this thread: http://forums.slimdevices.com/showthread.php?t=97803
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix