So we fire up the notebook at home, work or hotel and have to go through a couple of steps to get connected. Having gone through this several times a day, I can tell you it gets old fast. I figured how about we make this task more automated, like make a script to check for an Ethernet connection (because sometimes there is a loose cable on the desk) then quit if true, or start the wifi.sh script if false.
This script I place in my home/tc/scripts dir and start it from X.d with a small delay. Now when my notebook starts I receive a selection of Access Points to choose from or use it as a reminder that I forgot to connect an Ethernet cable. doh!
#!/bin/sh
#Checks for LAN connectivity then start wifi if needed
eth_f (){
if [ -d /sys/class/net/eth0 ]; then
ETH=`cat /sys/class/net/eth0/carrier`
fi
}
eth_f;
sleep 1
if [ -z "$ETH" ] || [ "$ETH" != 1 ]; then
if [ -d /sys/class/net/wlan0 ]; then
cliorx sudo wifi.sh
exit 1
fi
exit 2
fi
exit 0
Ideally, I'd like to start the script outside of X but am still perfecting that... :|
ps. scrapped this script in favor of the one in last post