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. and connects 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 - Steen 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. 

Steen



piCorePlayer a small player for the Raspberry Pi (25MB in RAM).
Homepage: https://sites.google.com/site/picoreplayer/home and
discussion:
http://forums.slimdevices.com/showthread.php?97803-piCoPlayer-Squeezelite-on-Microcore-linux-An-embedded-OS-in-RAM-with-Squeezelite

Squeezeboxserver on Voyage Linux 500 MB CF-card (read-only)
http://forums.slimdevices.com/showthread.php?90581-HOW-TO-install-squeezeboxserver-on-very-small-Linux-(Voyage-linux)
Please 'donate'
(https://www.paypal.com/uk/cgi-bin/webscr?cmd=_flow&SESSION=_Wc9nDqkHvtg-sUXCIrz1nB1Ct8pwHDrBSxETDiHfpX5H6F4Wflav3VBIAK&dispatch=5885d80a13c0db1f8e263663d3faee8d7ff5e1e81f2ed97dd1e90bd72966c40c)
if you like the piCorePlayer
------------------------------------------------------------------------
sbp's Profile: http://forums.slimdevices.com/member.php?userid=37237
View this thread: http://forums.slimdevices.com/showthread.php?t=97803

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to