Hello there
Can anyone tell me if it is an easier way to do a headless connection to new wifi networks than this?
I made this today because I want to be able to create a wifi.txt file in the fat32 partition of PiCore
from any PC that contains the wifi SSID PASSWORD WPA, but I do not want
to mount and unmount /mnt/mmcblk0p1 if the network is OK!
This is tested with notepad and works great except for the mount unmount stuff
wifi.txt is the same format as wifi.db
SSID[TAB]PASSWORD[TAB]WPA
No space, only TAB's
this is the /opt/bootlocal.sh
mount /dev/mmcblk0p1 /mnt/mmcblk0p1
if [ -f /mnt/mmcblk0p1/wifi.txt ]; then
cp /mnt/mmcblk0p1/wifi.txt /home/tc/wifi.db
rm /mnt/mmcblk0p1/wifi.txt
filetool.sh -b
sudo reboot
fi
umount /dev/mmcblk0p1 /mnt/mmcblk0p1
I was thinking about checking for a hidden file on /home/tc/ but I think it is a messy code
if [ ! -f /home/tc/.wifi ]; then
mount /dev/mmcblk0p1 /mnt/mmcblk0p1
fi
if [ -f /mnt/mmcblk0p1/wifi.txt ]; then
cp /mnt/mmcblk0p1/wifi.txt /home/tc/wifi.db
rm /mnt/mmcblk0p1/wifi.txt
touch /home/tc/.wifi
filetool.sh -b
sudo reboot
fi
umount /dev/mmcblk0p1 /mnt/mmcblk0p1
The Critical Problem with this is that the .wifi will exist even if you change networks and then you have a problem! NO SSH!
as you see i still will perform a unmount even if this is not mounted and that is messy...
To find the new PiCore I run arp -a on windows and then ping with broadcast like example: 192.168.1.255 and run arp -a again to see what ip address is newin the list, but if you have ip scanner or something that will work too