Skip to content

Commit

Permalink
application code
Browse files Browse the repository at this point in the history
  • Loading branch information
sambrenner committed Jan 3, 2015
1 parent 73036ae commit c373279
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
26 changes: 26 additions & 0 deletions easy-wifi-switch
@@ -0,0 +1,26 @@
#!/bin/sh

# check config exist
wificfg="/mnt/sda1/trophy/wifi.cfg"

if [ -f "$wificfg" ]
then
# load wifi config
source "$wificfg"

echo "Updating wifi settings:"
echo " - SSID: $ssid"
echo " - Key: $key"
echo " - Encryption: $encryption"
echo " "

# apply to OpenWrt UCI
# see: http://wiki.openwrt.org/doc/uci/wireless
/sbin/uci "set" "wireless.@wifi-iface[0].ssid=$ssid"
/sbin/uci "set" "wireless.@wifi-iface[0].key=$key"
/sbin/uci "set" "wireless.@wifi-iface[0].encryption=$encryption"
/sbin/uci commit wireless
wifi
else
echo "$wificfg was not found. Leaving wifi alone."
fi
20 changes: 20 additions & 0 deletions wifi.cfg
@@ -0,0 +1,20 @@
# Enter your WiFi network information here.

# Make sure each value comes between the double quotes, and that
# there are no spaces on either side of the equals sign.

# Your WiFi network name. This is case-sensitive.
ssid="My Network Name"

# Your WiFi network password. This is case-sensitive.
key="password123"

# Your WiFi network encryption method. Assuming you have this set
# up at home, it is very unlikely you'll have to change this.
# Possible options are:
# psk - wpa personal
# psk2 - wpa2 personal
# wpa - wpa enterprise
# wpa2 - wpa2 enterprise
# none - unencrypted network
encryption="psk2"

0 comments on commit c373279

Please sign in to comment.