#!/bin/bash # setconn # Sets up connman on the BeagleBone Blue via SSH over USB. # Assumes one of the standard Debian images. # You need only specify your WiFi SSID and password (NOT that pesky hashed ID). # Afterwards, SSH over WiFi to the BeagleBone (via your router) will be ready to go. # (You can discover the BBone's local IP address using your router or nmap, etc.) # Name this script 'setconn', and make it executable with 'chmod 0744 setconn'. # NOTE: When you are prompted with '[sudo] password for debian:', don't type anything; # just wait a couple of seconds, and the script will continue fine by itself. # Now, before running it, edit the following lines as appropriate: remote_uses_SSID="BTHub4-HDOV" # Change to your WiFi SSID. remote_uses_pwd="abcdefghijkl" # Change to your WiFi password. remote_default_user="debian" # This is the default. Probably leave it alone. remote_default_user_pwd="temppwd" # This is the default. Probably leave it alone. remote_ip="192.168.7.2" # This is the default. Probably leave it alone. cat <tmp sudo -kSs </var/lib/connman/wifi.config [service_\\\$(connmanctl services | grep '$remote_uses_SSID' | grep -Po 'wifi_[^ ]+')] Type = wifi Security = wpa2 Name = $remote_uses_SSID Passphrase = $remote_uses_pwd EOF3 sleep 2 connmanctl disable wifi sleep 2 connmanctl enable wifi sleep 2 while true; do if ping -c 1 www.google.com; then echo "WiFi up." break else echo "Connecting.."; sleep 2 fi done # DEBIAN_FRONTEND=noninteractive apt-get -y update # Uncomment to update the BBone. # DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade echo "Done." EOF2 EOF1 ssh $remote_default_user@$remote_ip '/bin/bash -s'