sbp wrote:
> Hi Randy.
>
> I tried to use your set_wifi.sh file, but I have a small problem.
>
> Originally my config.cfg file contains this info:
> >
Code:
--------------------
> >
> SSID="Cisco04554"
> PASSWORD="smiley12"
> ENCRYPTION="WPA"
--------------------
> >
>
> Then I used the picoreplayer script (with your modifications) and the
> set_wifi.sh script.
> I used option 8 (wifi set-up) and connect to my other wifi net:
> >
Code:
--------------------
> > Steens 2.4GHz
--------------------
> >
> Supply the password and it connects fine.
>
>
> The content of my wifi.db file is OK:
> >
Code:
--------------------
> > tc@piCorePlayer:~$ cat /home/tc/wifi.dbSteens\ 2.4GHz smiley12
WPA
>
--------------------
> >
>
> But the content of the config.cfg file become:
> >
Code:
--------------------
> >
> SSID="Cisco04554"
> PASSWORD=2.4GHz"
> ENCRYPTION="smiley12"
--------------------
> >
>
> The problem is as you can see:
> 1. The old SSID is kept and not changed
> 2. The PASSWORD is missing a leading " and it takes the second part of
> the SSID name which have a space in it - Steens 2.4GHz
> 3. The ENCRYPTION contains the password instead of WPA.
>
>
> This is the content of the set_wifi.sh:
> >
Code:
--------------------
> > #!/bin/sh
>
>
> alias awk="busybox awk"
>
>
> 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 "\"")
> print("\"" passwd "\"")
> print("\"" 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
>
>
>
--------------------
> >
>
> The code works fine if no space is present in the SSID name - but give
> the problem described if it contain a space.
> I think it is because wifi.sh will transform "Steens 2.4GHZ" to
> "Steens\ 2.4GHz" in the wifi.db file.
>
>
> I hope you have a good idea.
> Steen
Hello Steen. That sounds familiar to an error I was seeing when trying
to isolate, understand and test the SED logic. I thought I tested with
spaces in everything. I'll be able to take a crack at it when I return
home tonight.
------------------------------------------------------------------------
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